Package xal.tools.math
Class ClosedInterval
java.lang.Object
xal.tools.math.Interval
xal.tools.math.ClosedInterval
- All Implemented Interfaces:
Serializable
Represents a closed interval of the real line.
- Author:
- Christopher K. Allen
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor - creates a new instance of Interval with one point, the origin.ClosedInterval
(double pt) Initializing constructor - creates a single point (zero length) interval given by the value of the argumentpt
.ClosedInterval
(double min, double max) Initializing constructor - create a new open interval with specified endpoints.ClosedInterval
(Interval interval) Copy constructor - create a new open interval initialized to the argument. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(ClosedInterval interval) Is the given interval a subset of this interval.boolean
Are intervals equalint
hashCode()
boolean
intersect
(ClosedInterval interval) Is there a nonzero intersection between this interval and the argument.boolean
membership
(double x) Is point a member of the open intervaltoString()
Return the contents of the interval as aString
.Methods inherited from class xal.tools.math.Interval
containsAE, convexHull, createFromEndpoints, createFromMidpoint, getMax, getMin, intersection, intersects, isBoundary, isRealLine, measure, midpoint, print, println, setMax, setMin, vertexCoordinates
-
Constructor Details
-
ClosedInterval
public ClosedInterval()Default constructor - creates a new instance of Interval with one point, the origin. -
ClosedInterval
public ClosedInterval(double pt) Initializing constructor - creates a single point (zero length) interval given by the value of the argumentpt
.- Parameters:
pt
- The single point contained in the interval
-
ClosedInterval
Initializing constructor - create a new open interval with specified endpoints.- Parameters:
min
- left endpointmax
- right endpoint- Throws:
MathException
- max is smaller than min
-
ClosedInterval
Copy constructor - create a new open interval initialized to the argument.- Parameters:
interval
- interval to copy- Throws:
MathException
- malformed interval to copy
-
-
Method Details
-
membership
public boolean membership(double x) Is point a member of the open interval- Overrides:
membership
in classInterval
- Parameters:
x
- point to test for membership- Returns:
- true if x is in interval
-
intersect
Is there a nonzero intersection between this interval and the argument.- Parameters:
interval
- interval to be tested- Returns:
- true if the intervals intersect
-
contains
Is the given interval a subset of this interval.- Parameters:
interval
- interval under test- Returns:
true
if I⊂this
,false
otherwise.- Since:
- Apr 27, 2011
-
equals
Are intervals equal -
hashCode
public int hashCode() -
toString
Return the contents of the interval as aString
. return string representation of interval
-