public class Range<T extends Number> extends Object implements Cloneable, Comparable<Range<T>>
Modifier and Type | Method and Description |
---|---|
Range<T> |
clone() |
int |
compareTo(Range<T> inObj2) |
boolean |
contains(double inValue) |
boolean |
contains(float inValue) |
boolean |
contains(int inValue) |
boolean |
contains(Number inValue) |
boolean |
contains(Range<T> inRange2) |
boolean |
endValueIsExclusive() |
boolean |
equals(Object inObj2) |
T |
getEnd() |
T |
getStart() |
int |
hashCode() |
Range<T> |
intersection(Range<T> inRange2) |
boolean |
intersects(Range<T> inRange2) |
Double |
length() |
Range<T> |
setEnd(T inValue) |
Range<T> |
setStart(T inValue) |
List<Range<T>> |
subtract(Range<T> inRange2) |
static <T extends Number> |
superUnion(Collection<Range<T>> inOrigList)
Returns a single Range that encompasses the collection of input ranges and ignores internal gaps.
|
Range<T> |
superUnion(Range<T> inRange2)
Returns a single Range that encompasses both input ranges and ignores internal gaps.
|
void |
swapStartEndValues() |
String |
toString() |
static <T extends Number> |
union(Collection<Range<T>> inOrigList)
Collapses a collection of specified ranges.
|
public int compareTo(Range<T> inObj2)
compareTo
in interface Comparable<Range<T extends Number>>
public boolean contains(int inValue)
public boolean contains(float inValue)
public boolean contains(double inValue)
public static <T extends Number> List<Range<T>> union(Collection<Range<T>> inOrigList)
Ex: given three ranges: [1,4], [2,10], and [14,15] the result would be two ranges: [1,10] and [14,15].
inOrigList
- a collection of Ranges to be combined.public static <T extends Number> Range<T> superUnion(Collection<Range<T>> inOrigList)
inOrigList
- a collection of input rangespublic Range<T> superUnion(Range<T> inRange2)
inRange2
- the second Range to union with the current rangepublic boolean endValueIsExclusive()
public Range<T> intersection(Range<T> inRange2)
public boolean intersects(Range<T> inRange2)
public void swapStartEndValues()