net.grelf.grip
Class RangeInt

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

public class RangeInt
extends java.lang.Object

Convenience record for holding a pair of integers 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
 int high
           
 int low
           
 
Constructor Summary
RangeInt(int lowValue, int 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 int low

high

public int high
Constructor Detail

RangeInt

public RangeInt(int lowValue,
                int 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