net.grelf.grip
Class RangeDouble

java.lang.Object
  extended by net.grelf.grip.RangeDouble

public class RangeDouble
extends java.lang.Object

Convenience record for holding a pair of doubles indicating the low and high ends of a range. NB: This was intended to be written using generics but (a) base types cannot be used as T in Range<T> and (b) surprisingly, java.lang.Number does not implement Comparable. Range<T extends Number> becomes too cumbersome to write and to use.


Field Summary
 double high
           
 double low
           
 
Constructor Summary
RangeDouble(double lowValue, double highValue)
           
 
Method Summary
 boolean equals(java.lang.Object other)
           
 int hashCode()
          Enable objects of this class to be used as hash keys.
 boolean order()
          Ensure that low <= high.
 java.lang.String toString()
          Get a String representation of the RangeInt
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

low

public double low

high

public double high
Constructor Detail

RangeDouble

public RangeDouble(double lowValue,
                   double highValue)
Method Detail

order

public boolean order()
Ensure that low <= high. Swap the values if this is not the case. Returns true if a swap happened.


toString

public java.lang.String toString()
Get a String representation of the RangeInt

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Enable objects of this class to be used as hash keys.

Overrides:
hashCode in class java.lang.Object