|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectRange
NumberRange
public class NumberRange
A range of numbers. Union and intersection are computed as usual, except that widening conversions will be applied as needed.
modules/library/metadata (gt2-metadata.jar) (Maven report) (SVN head)| Constructor Summary | |
|---|---|
NumberRange(byte minimum,
boolean isMinIncluded,
byte maximum,
boolean isMaxIncluded)
Constructs a range of byte values. |
|
NumberRange(byte minimum,
byte maximum)
Constructs an inclusive range of byte values. |
|
NumberRange(Class type,
Number minimum,
boolean isMinIncluded,
Number maximum,
boolean isMaxIncluded)
Constructs a range of Number objects. |
|
NumberRange(Class type,
Number minimum,
Number maximum)
Constructs an inclusive range of Number objects. |
|
NumberRange(double minimum,
boolean isMinIncluded,
double maximum,
boolean isMaxIncluded)
Constructs a range of double values. |
|
NumberRange(double minimum,
double maximum)
Constructs an inclusive range of double values. |
|
NumberRange(float minimum,
boolean isMinIncluded,
float maximum,
boolean isMaxIncluded)
Constructs a range of float values. |
|
NumberRange(float minimum,
float maximum)
Constructs an inclusive range of float values. |
|
NumberRange(int minimum,
boolean isMinIncluded,
int maximum,
boolean isMaxIncluded)
Constructs a range of int values. |
|
NumberRange(int minimum,
int maximum)
Constructs an inclusive range of int values. |
|
NumberRange(long minimum,
boolean isMinIncluded,
long maximum,
boolean isMaxIncluded)
Constructs a range of long values. |
|
NumberRange(long minimum,
long maximum)
Constructs an inclusive range of long values. |
|
NumberRange(Range range)
Constructs a range with the same type and the same values than the specified range. |
|
NumberRange(short minimum,
boolean isMinIncluded,
short maximum,
boolean isMaxIncluded)
Constructs a range of short values. |
|
NumberRange(short minimum,
short maximum)
Constructs an inclusive range of short values. |
|
| Method Summary | |
|---|---|
NumberRange |
castTo(Class type)
Casts this range to the specified type. |
boolean |
contains(Comparable value)
Returns true if the specified value is within this range. |
boolean |
contains(Number value)
Returns true if the specified value is within this range. |
boolean |
contains(Range range)
Returns true if the supplied range is fully contained within this range. |
double |
getMaximum()
Returns the maximum value as a double. |
double |
getMaximum(boolean inclusive)
Returns the maximum value with the specified inclusive or exclusive state. |
double |
getMinimum()
Returns the minimum value as a double. |
double |
getMinimum(boolean inclusive)
Returns the minimum value with the specified inclusive or exclusive state. |
Range |
intersect(Range range)
Returns the intersection of this range with the given range. |
boolean |
intersects(Range range)
Returns true if this range intersects the given range. |
Range[] |
subtract(Range range)
Returns the range of values that are in this range but not in the given range. |
Range |
union(Range range)
Returns the union of this range with the given range. |
static NumberRange |
wrap(Range range)
Wraps the specified Range in a NumberRange object. |
| Methods inherited from class Range |
|---|
equals, getElementClass, getMaxValue, getMinValue, hashCode, isEmpty, isMaxIncluded, isMinIncluded, toString |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NumberRange(byte minimum,
byte maximum)
byte values.
minimum - The minimum value, inclusive.maximum - The maximum value, inclusive.
public NumberRange(byte minimum,
boolean isMinIncluded,
byte maximum,
boolean isMaxIncluded)
byte values.
minimum - The minimum value.isMinIncluded - Defines whether the minimum value is included in the Range.maximum - The maximum value.isMaxIncluded - Defines whether the maximum value is included in the Range.
public NumberRange(short minimum,
short maximum)
short values.
minimum - The minimum value, inclusive.maximum - The maximum value, inclusive.
public NumberRange(short minimum,
boolean isMinIncluded,
short maximum,
boolean isMaxIncluded)
short values.
minimum - The minimum value.isMinIncluded - Defines whether the minimum value is included in the Range.maximum - The maximum value.isMaxIncluded - Defines whether the maximum value is included in the Range.
public NumberRange(int minimum,
int maximum)
int values.
minimum - The minimum value, inclusive.maximum - The maximum value, inclusive.
public NumberRange(int minimum,
boolean isMinIncluded,
int maximum,
boolean isMaxIncluded)
int values.
minimum - The minimum value.isMinIncluded - Defines whether the minimum value is included in the Range.maximum - The maximum value.isMaxIncluded - Defines whether the maximum value is included in the Range.
public NumberRange(long minimum,
long maximum)
long values.
minimum - The minimum value, inclusive.maximum - The maximum value, inclusive.
public NumberRange(long minimum,
boolean isMinIncluded,
long maximum,
boolean isMaxIncluded)
long values.
minimum - The minimum value.isMinIncluded - Defines whether the minimum value is included in the Range.maximum - The maximum value.isMaxIncluded - Defines whether the maximum value is included in the Range.
public NumberRange(float minimum,
float maximum)
float values.
minimum - The minimum value, inclusive.maximum - The maximum value, inclusive.
public NumberRange(float minimum,
boolean isMinIncluded,
float maximum,
boolean isMaxIncluded)
float values.
minimum - The minimum value.isMinIncluded - Defines whether the minimum value is included in the Range.maximum - The maximum value.isMaxIncluded - Defines whether the maximum value is included in the Range.
public NumberRange(double minimum,
double maximum)
double values.
minimum - The minimum value, inclusive.maximum - The maximum value, inclusive.
public NumberRange(double minimum,
boolean isMinIncluded,
double maximum,
boolean isMaxIncluded)
double values.
minimum - The minimum value.isMinIncluded - Defines whether the minimum value is included in the Range.maximum - The maximum value.isMaxIncluded - Defines whether the maximum value is included in the Range.
public NumberRange(Class type,
Number minimum,
Number maximum)
Number objects.
type - The element class, usually one of Byte, Short,
Integer, Long, Float or Double.minimum - The minimum value, inclusive.maximum - The maximum value, inclusive.
public NumberRange(Class type,
Number minimum,
boolean isMinIncluded,
Number maximum,
boolean isMaxIncluded)
Number objects.
type - The element class, usually one of Byte, Short,
Integer, Long, Float or Double.minimum - The minimum value.isMinIncluded - Defines whether the minimum value is included in the Range.maximum - The maximum value.isMaxIncluded - Defines whether the maximum value is included in the Range.
public NumberRange(Range range)
throws ClassCastException
range - The range to copy. The elements must be Number instances.
ClassCastException - if some elements are not instances of Number.| Method Detail |
|---|
public static NumberRange wrap(Range range)
Range in a NumberRange object. If the specified
range is already an instance of NumberRange, then it is returned unchanged.
range - The range to wrap
range as a NumberRange object.public NumberRange castTo(Class type)
type - The class to cast to. Must be one of Byte, Short,
Integer, Long, Float or Double.
this if this range already uses
the specified type.public boolean contains(Comparable value)
true if the specified value is within this range.
contains in class Rangepublic boolean contains(Number value)
true if the specified value is within this range.
public boolean contains(Range range)
contains in class Rangepublic boolean intersects(Range range)
intersects in class Rangepublic Range union(Range range)
union in class Rangepublic Range intersect(Range range)
intersect in class Rangepublic Range[] subtract(Range range)
subtract in class Rangepublic double getMinimum()
double.
If this range is unbounded, then Double.NEGATIVE_INFINITY is returned.
public double getMinimum(boolean inclusive)
Double.NEGATIVE_INFINITY is
returned.
inclusive - true for the minimum value inclusive,
or false for the minimum value exclusive.
public double getMaximum()
double.
If this range is unbounded, then Double.POSITIVE_INFINITY is returned.
public double getMaximum(boolean inclusive)
Double.POSITIVE_INFINITY is
returned.
inclusive - true for the maximum value inclusive,
or false for the maximum value exclusive.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||