| java.lang.Object org.apache.commons.lang.NumberRange
NumberRange | final public class NumberRange (Code) | | 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.
author: Christopher Elkins author: Stephen Colebourne since: 1.0 version: $Revision: 437554 $ $Date: 2006-08-27 23:21:41 -0700 (Sun, 27 Aug 2006) $ |
NumberRange | public NumberRange(Number num)(Code) | | Constructs a new NumberRange using
number as both the minimum and maximum in
this range.
Parameters: num - the number to use for this range throws: NullPointerException - if the number is null |
NumberRange | public NumberRange(Number min, Number max)(Code) | | 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!.
Parameters: min - the minimum number in this range Parameters: max - the maximum number in this range throws: NullPointerException - if either the minimum or maximum number isnull |
equals | public boolean equals(Object obj)(Code) | | Indicates whether some other Object is
"equal" to this one.
Parameters: obj - the reference object with which to compare true if this object is the same as the objargument; false otherwise |
getMaximum | public Number getMaximum()(Code) | | Returns the maximum number in this range.
the maximum number in this range |
getMinimum | public Number getMinimum()(Code) | | Returns the minimum number in this range.
the minimum number in this range |
hashCode | public int hashCode()(Code) | | Returns a hash code value for this object.
a hash code value for this object |
includesNumber | public boolean includesNumber(Number number)(Code) | | Tests whether the specified number occurs within
this range using double comparison.
Parameters: number - the number to test true if the specified number occurs within thisrange; otherwise, false |
includesRange | public boolean includesRange(NumberRange range)(Code) | | Tests whether the specified range occurs entirely within this
range using double comparison.
Parameters: range - the range to test true if the specified range occurs entirely withinthis range; otherwise, false |
overlaps | public boolean overlaps(NumberRange range)(Code) | | Tests whether the specified range overlaps with this range
using double comparison.
Parameters: range - the range to test true if the specified range overlaps with thisrange; otherwise, false |
toString | public String toString()(Code) | | 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.
the string representation of this range |
|
|