|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Interval
A single contiguous interval subset of some Comparable class. The interval is specified by a lower and upper bound and a closedness for each bound. In the constructor and getBound methods, null signifies that the bound is infinite, but all other uses of null to represent infinity are forbidden. Use the set/get infinite() methods instead. Simple intervals come in three flavors: ranges, singletons and empties. Ranges are those where the lower bound is less than the upper (the interval contains more than one element). Singletons are those with equal bounds of which at least one is closed (the interval contains exactly one element). All other intervals are deemed empty (contain no elements). All the Comparable objects must be of the same class for each interval. Otherwise, a ClassCastException is thrown when they are compared.
| Method Summary | |
|---|---|
Comparable |
getLowerBound()
Get the lower bound. |
Comparable |
getUpperBound()
Get the upper bound. |
boolean |
isEmpty()
Is the interval empty (contains no elements)? |
boolean |
isLowerBoundClosed()
Is the lower bound closed. |
boolean |
isLowerInfinite()
Is the lower bound negative-infinity? |
boolean |
isLowerThan(Interval interval)
Are all the elements of this interval less than all the elements of the specified interval? If either are empty, false. |
boolean |
isOverlappedBy(Interval interval)
Is there a element such that both this and the specified interval contain it? If either are empty, false. |
boolean |
isRange()
Is the upper bound greater than the lower bound? (is there more than one element in the interval) |
boolean |
isRangeOverlappedBy(Interval interval)
Is there a range of elements which are shared by this and the specified interval? |
boolean |
isSingleton()
Are the bounds equal and is at least one of them closed (contains exactly one element)? |
boolean |
isSupersetOf(Comparable element)
Is the specified element a member of the interval? A null specified element causes an error. |
boolean |
isUpperBoundClosed()
Is the upper bound closed. |
boolean |
isUpperInfinite()
Is the upper bound positive infinity? |
void |
setLowerBound(Comparable comparable)
Set the lower bound. |
void |
setLowerBoundClosed(boolean b)
Set the closedness of the lower bound. |
void |
setLowerInfinite(boolean b)
Set the lower bound to be negative-inifinity. |
void |
setUpperBound(Comparable comparable)
Set the upper bound. |
void |
setUpperBoundClosed(boolean b)
Set the closedness of the upper bound. |
void |
setUpperInfinite(boolean b)
Set the upper bound to be positive-infinity. |
| Method Detail |
|---|
Comparable getLowerBound()
Comparable getUpperBound()
boolean isEmpty()
boolean isLowerBoundClosed()
boolean isLowerInfinite()
boolean isLowerThan(Interval interval)
boolean isOverlappedBy(Interval interval)
boolean isRange()
boolean isRangeOverlappedBy(Interval interval)
boolean isSingleton()
boolean isSupersetOf(Comparable element)
boolean isUpperBoundClosed()
boolean isUpperInfinite()
void setLowerBound(Comparable comparable)
void setLowerBoundClosed(boolean b)
void setLowerInfinite(boolean b)
void setUpperBound(Comparable comparable)
void setUpperBoundClosed(boolean b)
void setUpperInfinite(boolean b)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||