|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.util.range.Range
A Range is defined by its end-points (this is effectively a one-dimensional
range). A value falls "in the range" if it is "above" the lower bound and
"below" the upper bound. Determination of above/below is done using the
boundary point values' int compareTo(Object value)
method.
Whether or not a boundary point is inclusive or exclusive depends upon the
choice of BoundaryPoint. Ranges need not be bounded of both ends.
int compareTo(Object value)
can return something useful.
InclusiveBelowBoundaryPoint
,
InclusiveAboveBoundaryPoint
,
InfiniteBoundaryPoint
,
Serialized FormField Summary | |
private static String |
CLASSNAME
|
private BoundaryPoint |
lowerBound_
|
(package private) Range |
range_
|
private static String |
RESOURCE
|
private BoundaryPoint |
upperBound_
|
Constructor Summary | |
Range(BoundaryPoint lower_bound,
BoundaryPoint upper_bound)
Create an instance of a range from two boundary points. |
Method Summary | |
private void |
checkBoundaryPointOrdering()
Confirms that the lower bound is indeed below the upper bound. |
boolean |
contains(Comparable comparable)
Determines if the the supplied value is "in the range." What this means depends upon the boundary points that are supplied as the end points. |
boolean |
equals(Object other)
|
Comparable |
getLowerBoundValue()
Gets the Comparable value that is used as the lower boundary point of the range. |
Comparable |
getUpperBoundValue()
Gets the Comparable value that is used as the upper boundary point of the range. |
boolean |
hasLowerBound()
Determine if the range is bounded "below." |
boolean |
hasUpperBound()
Determine if the range is bounded "above." |
boolean |
isLowerBoundExclusive()
return lowerBound_ instanceof InclusiveBelowBoundaryPoint; |
boolean |
isLowerBoundInclusive()
Determine if the lower bound is an instance of InclusiveAboveBoundaryPoint. |
boolean |
isUpperBoundExclusive()
Determine if the upper bound is an instance of InclusiveBelowBoundaryPoint. |
boolean |
isUpperBoundInclusive()
Determine if the upper bound is an instance of InclusiveBelowBoundaryPoint. |
static Range |
newExcludeLowExcludeHigh(Comparable low,
Comparable high)
Create an instance that operates conceptually as: (low, high) |
static Range |
newExcludeLowIncludeHigh(Comparable low,
Comparable high)
Create an instance that operates conceptually as: (low, high] |
static Range |
newExcludeLowUnboundedHigh(Comparable low)
Create an instance that operates conceptually as: (low, infinity) |
static Range |
newIncludeLowExcludeHigh(Comparable low,
Comparable high)
Create an instance that operates conceptually as: [low, high) |
static Range |
newIncludeLowIncludeHigh(Comparable low,
Comparable high)
Create an instance that operates conceptually as: [low, high] |
static Range |
newIncludeLowUnboundedHigh(Comparable low)
Create an instance that operates conceptually as: [low, infinity) |
static Range |
newParameterized(Comparable low,
boolean low_inclusive,
Comparable high,
boolean high_inclusive)
|
static Range |
newUnboundedLowExcludeHigh(Comparable high)
Create an instance that operates conceptually as: (-infinity, high) |
static Range |
newUnboundedLowIncludeHigh(Comparable high)
Create an instance that operates conceptually as: (-infinity, high] |
String |
toString()
Produces a string that compactly describes the range. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static final String CLASSNAME
private BoundaryPoint lowerBound_
private BoundaryPoint upperBound_
Range range_
Constructor Detail |
public Range(BoundaryPoint lower_bound, BoundaryPoint upper_bound) throws RangeException
lower_bound
- upper_bound
-
RangeException
BoundaryPoint
Method Detail |
private void checkBoundaryPointOrdering() throws RangeException
RangeException
- if the check failspublic final boolean contains(Comparable comparable)
comparable
-
RangeException
- If either of the boundary points is nullpublic final boolean hasLowerBound()
public final boolean hasUpperBound()
public final boolean isLowerBoundInclusive()
public final boolean isLowerBoundExclusive()
public final boolean isUpperBoundInclusive()
public final boolean isUpperBoundExclusive()
public final Comparable getLowerBoundValue()
hasLowerBound()
public final Comparable getUpperBoundValue()
hasUpperBound()
public String toString()
If the inclusive-ness of boundary point cannot be determined (most likely because it is a custom subclass of BoundaryPoint), then a question mark will replace the parenthesis or square-bracket.
public static Range newIncludeLowIncludeHigh(Comparable low, Comparable high) throws RangeException
low
- high
-
RangeException
public static Range newIncludeLowExcludeHigh(Comparable low, Comparable high) throws RangeException
low
- high
-
RangeException
public static Range newExcludeLowIncludeHigh(Comparable low, Comparable high) throws RangeException
low
- high
-
RangeException
public static Range newExcludeLowExcludeHigh(Comparable low, Comparable high) throws RangeException
low
- high
-
RangeException
public static Range newIncludeLowUnboundedHigh(Comparable low) throws RangeException
low
-
RangeException
public static Range newExcludeLowUnboundedHigh(Comparable low) throws RangeException
low
-
RangeException
public static Range newUnboundedLowIncludeHigh(Comparable high) throws RangeException
high
-
RangeException
public static Range newUnboundedLowExcludeHigh(Comparable high) throws RangeException
high
-
RangeException
public static Range newParameterized(Comparable low, boolean low_inclusive, Comparable high, boolean high_inclusive) throws RangeException
RangeException
public boolean equals(Object other)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |