|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmain.Range
public class Range
The Range
class attributes an object to a range of values. It
provides methods for setting and getting the lower and upper bounds of the
range and the object associated with the range.
Field Summary | |
---|---|
static int |
ELSE
Indicates a range corresponding to weights that neither fit in a standard range nor are invalid. |
private double |
high
|
static int |
INVALID
Indicates a range corresponding to invalid weights, such as fields with missing data. |
private double |
low
|
static int |
STANDARD
Indicates a standard range with a lower boundary and an upper boundary. |
private int |
type
|
private java.lang.Object |
value
|
Constructor Summary | |
---|---|
Range(double low,
double high,
java.lang.Object value)
Creates a new standard range initialized with the arguments. |
|
Range(int type,
java.lang.Object value)
Creates a range corresponding to invalid weights or weights that do not fit in a standard range. |
Method Summary | |
---|---|
int |
compareTo(Range range)
Compares this instance of Range with the specified
instance. |
double |
getHigh()
Gets the upper boundary of the range. |
double |
getLow()
Gets the lower boundary of the range. |
int |
getType()
Gets the type of range that this Range represents. |
java.lang.Object |
getValue()
Gets the object associated with this range. |
boolean |
includesWeight(java.lang.Double weight)
Determines whether this range encompasses the weight specified by the argument. |
java.lang.String |
toString()
Returns a representation of of this Range . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int STANDARD
public static final int INVALID
public static final int ELSE
private int type
private double low
private double high
private java.lang.Object value
Constructor Detail |
---|
public Range(double low, double high, java.lang.Object value)
low
- a double
representing the lower boundhigh
- a double
representing the upper boundvalue
- an Object
associated with the rangepublic Range(int type, java.lang.Object value)
type
- the type of rangevalue
- an Object
associated with the rangeMethod Detail |
---|
public int getType()
Range
represents.
public boolean includesWeight(java.lang.Double weight)
weight
- a Double
representing the weight
true
if this range encompasses the weight,
false
otherwisepublic double getLow()
public double getHigh()
public java.lang.Object getValue()
public int compareTo(Range range)
Range
with the specified
instance. Returns a negative integer if this instance comes first in a
natural ordering, a positive integer if the specified instance comes
first in a natural ordering, or zero if they're equal. Note: this class
has a natural ordering that is inconsistent with equals.
compareTo
in interface java.lang.Comparable<Range>
range
- another instance of Range
public java.lang.String toString()
Range
. This is for
debugging purposes.
toString
in class java.lang.Object
Range
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |