public class Interval<C>
extends java.lang.Object
| Constructor and Description |
|---|
Interval() |
Interval(java.lang.Comparable<C> lower,
boolean lowerInclusive,
java.lang.Comparable<C> upper,
boolean upperInclusive)
Constructs an interval from the two specified end points.
|
Interval(java.lang.Comparable<C> lower,
java.lang.Comparable<C> upper)
Constructs a closed interval from the two specified end points.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Comparable<C> |
getLower()
Returns the lower end point of the interval.
|
java.lang.Comparable<C> |
getUpper()
Returns the upper end point of the interval.
|
boolean |
isInInterval(C o)
Returns
true if the specified object is between the end
points of this interval. |
boolean |
isLowerExclusive()
Returns
true if this interval is not lower inclusive. |
boolean |
isLowerInclusive()
Returns
true if this interval is lower inclusive. |
boolean |
isUpperExclusive()
Returns
true if this interval is upper exclusive. |
boolean |
isUpperInclusive()
Returns
true if this interval is upper inclusive. |
void |
setLower(java.lang.Comparable<C> lower)
Sets the lower end point of the interval.
|
void |
setLowerExclusive(boolean exclusive)
Sets the interval to lower exclusive or lower inclusive.
|
void |
setLowerInclusive(boolean inclusive)
Sets the interval to lower inclusive or lower exclusive.
|
void |
setUpper(java.lang.Comparable<C> upper)
Sets the upper end point of the interval.
|
void |
setUpperExclusive(boolean exclusive)
Sets the interval to upper exclusive or upper inclusive.
|
void |
setUpperInclusive(boolean inclusive)
Sets the interval to upper inclusive or upper exclusive.
|
java.lang.String |
toString() |
public Interval()
public Interval(java.lang.Comparable<C> lower, java.lang.Comparable<C> upper)
lower - the lower end point of the intervalupper - the upper end point of the intervalpublic Interval(java.lang.Comparable<C> lower, boolean lowerInclusive, java.lang.Comparable<C> upper, boolean upperInclusive)
lower - the lower end point of the intervallowerInclusive - wether or not the lower end of the interval is inclusive of
its value.upper - the upper end point of the intervalupperInclusive - whether or not the upper end of the interval is inclusive of
its value.public boolean isInInterval(C o)
true if the specified object is between the end
points of this interval.true if the specified value is between the end
points of this interval.public boolean isLowerInclusive()
true if this interval is lower inclusive.true if this interval is lower inclusive.public boolean isLowerExclusive()
true if this interval is not lower inclusive.true if this interval is not lower inclusive.public void setLowerInclusive(boolean inclusive)
inclusive - true represents lower inclusive and
false represents lower exclusive.public void setLowerExclusive(boolean exclusive)
exclusive - true represents lower exclusive and
false represents lower inclusive.public java.lang.Comparable<C> getLower()
public void setLower(java.lang.Comparable<C> lower)
lower - the lower end point of the intervalpublic boolean isUpperInclusive()
true if this interval is upper inclusive.true if this interval is upper inclusive.public boolean isUpperExclusive()
true if this interval is upper exclusive.true if this interval is upper exclusive.public void setUpperInclusive(boolean inclusive)
inclusive - true represents upper inclusive and
false represents upper exclusive.public void setUpperExclusive(boolean exclusive)
exclusive - true represents upper exclusive and
false represents upper inclusive.public java.lang.Comparable<C> getUpper()
public void setUpper(java.lang.Comparable<C> upper)
upper - the upper end point of the interval.public java.lang.String toString()
toString in class java.lang.Object