Class NumberRange
- java.lang.Object
 - 
- org.apache.commons.lang.NumberRange
 
 
- 
public final class NumberRange extends java.lang.ObjectDeprecated.Use one of the Range classes in org.apache.commons.lang.math. Class will be removed in Commons Lang 3.0.Represents a range of
Numberobjects.This class uses
doublecomparisons. This means that it is unsuitable for dealing with largeLong,BigDecimalorBigIntegernumbers.- Since:
 - 1.0
 
 
- 
- 
Constructor Summary
Constructors Constructor Description NumberRange(java.lang.Number num)Deprecated.Constructs a newNumberRangeusingnumberas both the minimum and maximum in this range.NumberRange(java.lang.Number min, java.lang.Number max)Deprecated.Constructs a newNumberRangewith the specified minimum and maximum numbers. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Deprecated.Indicates whether some otherObjectis "equal" to this one.java.lang.NumbergetMaximum()Deprecated.Returns the maximum number in this range.java.lang.NumbergetMinimum()Deprecated.Returns the minimum number in this range.inthashCode()Deprecated.Returns a hash code value for this object.booleanincludesNumber(java.lang.Number number)Deprecated.Tests whether the specifiednumberoccurs within this range usingdoublecomparison.booleanincludesRange(NumberRange range)Deprecated.Tests whether the specified range occurs entirely within this range usingdoublecomparison.booleanoverlaps(NumberRange range)Deprecated.Tests whether the specified range overlaps with this range usingdoublecomparison.java.lang.StringtoString()Deprecated.Returns the string representation of this range. 
 - 
 
- 
- 
Constructor Detail
- 
NumberRange
public NumberRange(java.lang.Number num)
Deprecated.Constructs a new
NumberRangeusingnumberas both the minimum and maximum in this range.- Parameters:
 num- the number to use for this range- Throws:
 java.lang.NullPointerException- if the number isnull
 
- 
NumberRange
public NumberRange(java.lang.Number min, java.lang.Number max)Deprecated.Constructs a new
NumberRangewith 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 rangemax- the maximum number in this range- Throws:
 java.lang.NullPointerException- if either the minimum or maximum number isnull
 
 - 
 
- 
Method Detail
- 
getMinimum
public java.lang.Number getMinimum()
Deprecated.Returns the minimum number in this range.
- Returns:
 - the minimum number in this range
 
 
- 
getMaximum
public java.lang.Number getMaximum()
Deprecated.Returns the maximum number in this range.
- Returns:
 - the maximum number in this range
 
 
- 
includesNumber
public boolean includesNumber(java.lang.Number number)
Deprecated.Tests whether the specified
numberoccurs within this range usingdoublecomparison.- Parameters:
 number- the number to test- Returns:
 trueif the specified number occurs within this range; otherwise,false
 
- 
includesRange
public boolean includesRange(NumberRange range)
Deprecated.Tests whether the specified range occurs entirely within this range using
doublecomparison.- Parameters:
 range- the range to test- Returns:
 trueif the specified range occurs entirely within this range; otherwise,false
 
- 
overlaps
public boolean overlaps(NumberRange range)
Deprecated.Tests whether the specified range overlaps with this range using
doublecomparison.- Parameters:
 range- the range to test- Returns:
 trueif the specified range overlaps with this range; otherwise,false
 
- 
equals
public boolean equals(java.lang.Object obj)
Deprecated.Indicates whether some other
Objectis "equal" to this one.- Overrides:
 equalsin classjava.lang.Object- Parameters:
 obj- the reference object with which to compare- Returns:
 trueif this object is the same as the obj argument;falseotherwise
 
- 
hashCode
public int hashCode()
Deprecated.Returns a hash code value for this object.
- Overrides:
 hashCodein classjava.lang.Object- Returns:
 - a hash code value for this object
 
 
- 
toString
public java.lang.String toString()
Deprecated.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.
- Overrides:
 toStringin classjava.lang.Object- Returns:
 - the string representation of this range
 
 
 - 
 
 -