|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.lang.NumberRange
Represents a range of Number
objects.
This class uses double
comparisons. This means that it
is unsuitable for dealing with large Long
, BigDecimal
or BigInteger
numbers.
Constructor Summary | |
NumberRange(java.lang.Number num)
Deprecated. Constructs a new NumberRange using
number as both the minimum and maximum in
this range. |
|
NumberRange(java.lang.Number min,
java.lang.Number max)
Deprecated. Constructs a new NumberRange with the specified
minimum and maximum numbers. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Deprecated. Indicates whether some other Object is
"equal" to this one. |
java.lang.Number |
getMaximum()
Deprecated. Returns the maximum number in this range. |
java.lang.Number |
getMinimum()
Deprecated. Returns the minimum number in this range. |
int |
hashCode()
Deprecated. Returns a hash code value for this object. |
boolean |
includesNumber(java.lang.Number number)
Deprecated. Tests whether the specified number occurs within
this range using double comparison. |
boolean |
includesRange(NumberRange range)
Deprecated. Tests whether the specified range occurs entirely within this range using double comparison. |
boolean |
overlaps(NumberRange range)
Deprecated. Tests whether the specified range overlaps with this range using double comparison. |
java.lang.String |
toString()
Deprecated. Returns the string representation of this range. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public NumberRange(java.lang.Number num)
Constructs a new NumberRange
using
number
as both the minimum and maximum in
this range.
num
- the number to use for this range
java.lang.NullPointerException
- if the number is null
public NumberRange(java.lang.Number min, java.lang.Number max)
Constructs a new NumberRange
with the specified
minimum and maximum numbers.
If the maximum is less than the minimum, the range will be constructed from the minimum value to the minimum value, not what you would expect!.
min
- the minimum number in this rangemax
- the maximum number in this range
java.lang.NullPointerException
- if either the minimum or maximum number is
null
Method Detail |
public java.lang.Number getMinimum()
Returns the minimum number in this range.
public java.lang.Number getMaximum()
Returns the maximum number in this range.
public boolean includesNumber(java.lang.Number number)
Tests whether the specified number
occurs within
this range using double
comparison.
number
- the number to test
true
if the specified number occurs within this
range; otherwise, false
public boolean includesRange(NumberRange range)
Tests whether the specified range occurs entirely within this
range using double
comparison.
range
- the range to test
true
if the specified range occurs entirely within
this range; otherwise, false
public boolean overlaps(NumberRange range)
Tests whether the specified range overlaps with this range
using double
comparison.
range
- the range to test
true
if the specified range overlaps with this
range; otherwise, false
public boolean equals(java.lang.Object obj)
Indicates whether some other Object
is
"equal" to this one.
obj
- the reference object with which to compare
true
if this object is the same as the obj
argument; false
otherwisepublic int hashCode()
Returns a hash code value for this object.
public java.lang.String toString()
Returns the string representation of this range.
This string is the string representation of the minimum and maximum numbers in the range, separated by a hyphen. If a number is negative, then it is enclosed in parentheses.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |