Method Summary |
|
public static Range | combine(Range range1, Range range2) Creates a new range by combining two existing ranges.
Note that:
- either range can be
null , in which case the other
range is returned;
- if both ranges are
null the return value is
null .
Parameters: range1 - the first range (null permitted). Parameters: range2 - the second range (null permitted). |
public double | constrain(double value) Returns the value within the range that is closest to the specified
value.
Parameters: value - the value. |
public boolean | contains(double value) Returns true if the range contains the specified value and
false otherwise.
Parameters: value - the value to lookup. |
public boolean | equals(Object obj) Tests this object for equality with an arbitrary object.
Parameters: obj - the object to test against (null permitted). |
public static Range | expand(Range range, double lowerMargin, double upperMargin) Creates a new range by adding margins to an existing range.
Parameters: range - the range (null not permitted). Parameters: lowerMargin - the lower margin (expressed as a percentage of the range length). Parameters: upperMargin - the upper margin (expressed as a percentage of the range length). |
public static Range | expandToInclude(Range range, double value) Returns a range that includes all the values in the specified
range AND the specified value .
Parameters: range - the range (null permitted). Parameters: value - the value that must be included. |
public double | getCentralValue() Returns the central value for the range. |
public double | getLength() Returns the length of the range. |
public double | getLowerBound() Returns the lower bound for the range. |
public double | getUpperBound() Returns the upper bound for the range. |
public int | hashCode() Returns a hash code. |
public boolean | intersects(double b0, double b1) Returns true if the range intersects with the specified
range, and false otherwise.
Parameters: b0 - the lower bound (should be <= b1). Parameters: b1 - the upper bound (should be >= b0). |
public static Range | shift(Range base, double delta) Shifts the range by the specified amount.
Parameters: base - the base range. Parameters: delta - the shift amount. |
public static Range | shift(Range base, double delta, boolean allowZeroCrossing) Shifts the range by the specified amount.
Parameters: base - the base range. Parameters: delta - the shift amount. Parameters: allowZeroCrossing - a flag that determines whether or not the bounds of the range are allowed to crosszero after adjustment. |
public String | toString() Returns a string representation of this Range. |