|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jppf.utils.Range<T>
T - the type of values handled by this object.public class Range<T extends Comparable<T>>
Instances of this class represent a range of values.
| Constructor Summary | |
|---|---|
Range(T value)
Initialize this range with the specified single value used as both lower and upper bounds. |
|
Range(T lower,
T upper)
Initialize this range with the specified lower and upper bounds. |
|
| Method Summary | |
|---|---|
T |
getLower()
Get the lower bound. |
T |
getUpper()
Get the upper bound. |
boolean |
includes(Range<T> other)
Determine whether this range is a superset of the specified other. |
Range<T> |
intersection(Range<T> other)
Construct a Range that represents the intersection of this range and the other specified one. |
boolean |
intersects(Range<T> other)
Determine whether this range and the specified one have at least one value in common. |
boolean |
isValueInRange(T value)
Determine if the specified value is included in this range. |
Range<T> |
merge(Range<T> other)
Construct a Range that is made of all values between the lowest lower bound and the highest upper bound
of this range and the other specified range. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Range(T value)
value - the value to use for the bounds.
public Range(T lower,
T upper)
lower - the lower bound.upper - the upper bound.| Method Detail |
|---|
public boolean isValueInRange(T value)
value - the value to check.
public String toString()
toString in class Objectpublic T getLower()
public T getUpper()
public boolean intersects(Range<T> other)
other - the range to check against.
other overlaps this range.public boolean includes(Range<T> other)
other.lower >= this.lower and other.upper <= this.upper.
other - the range to check against.
other.public Range<T> merge(Range<T> other)
Range that is made of all values between the lowest lower bound and the highest upper bound
of this range and the other specified range. This works even if the ranges are completely disjointed
(i.e if this.intersects(other) == false)min(this.lower, other.lower)
and its upper bound equal to max(this.upper, other.upper)
other - the range to merge with.
Range object that encompasses all values between the lowest lower bound and the highest upper bound,
or a copy of this range if the other is null.public Range<T> intersection(Range<T> other)
Range that represents the intersection of this range and the other specified one.max(this.lower, other.lower)
and its upper bound equal to min(this.upper, other.upper)
other - the range to check against.
other is null or the ranges are disjointed
(i.e if this.intersects(other) == false).
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||