org.locomotive.util.data
Class NumberKey

java.lang.Object
  |
  +--org.locomotive.util.data.NumberKey

public class NumberKey
extends java.lang.Object
implements ComparisonKey

this class provides a comparison key for most primitive data types


Field Summary
 double key
           
 
Constructor Summary
NumberKey(byte value)
          Constructor creates a new NumberKey from a byte
NumberKey(char value)
          Constructor creates a new NumberKey from a char
NumberKey(double value)
          Constructor creates a new NumberKey from a double
NumberKey(float value)
          Constructor creates a new NumberKey from a float
NumberKey(int value)
          Constructor creates a new NumberKey from a int
NumberKey(long value)
          Constructor creates a new NumberKey from a long
NumberKey(java.lang.Number value)
          Constructor creates a new NumberKey from a Number object
NumberKey(short value)
          Constructor creates a new NumberKey from a short
 
Method Summary
 int compare(ComparisonKey value)
          Compare myself to another object
 java.lang.String toString()
          to assure a decent string representation of the comparisonKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

key

public double key
Constructor Detail

NumberKey

public NumberKey(double value)
Constructor creates a new NumberKey from a double
Parameters:
value - the number to be used

NumberKey

public NumberKey(char value)
Constructor creates a new NumberKey from a char
Parameters:
value - the number to be used

NumberKey

public NumberKey(byte value)
Constructor creates a new NumberKey from a byte
Parameters:
value - the number to be used

NumberKey

public NumberKey(short value)
Constructor creates a new NumberKey from a short
Parameters:
value - the number to be used

NumberKey

public NumberKey(int value)
Constructor creates a new NumberKey from a int
Parameters:
value - the number to be used

NumberKey

public NumberKey(long value)
Constructor creates a new NumberKey from a long
Parameters:
value - the number to be used

NumberKey

public NumberKey(float value)
Constructor creates a new NumberKey from a float
Parameters:
value - the number to be used

NumberKey

public NumberKey(java.lang.Number value)
Constructor creates a new NumberKey from a Number object
Parameters:
value - the number to be used
Method Detail

compare

public int compare(ComparisonKey value)
            throws ComparisonKeyException
Compare myself to another object
Specified by:
compare in interface ComparisonKey
Parameters:
key - - the key to which this object is to be compared
Returns:
-1 - if this dateKey comes before otherKey
1 - if this this dateKey comes after otherKey
0 - if this dateKey is equivalent to otherKey
Throws:
ComparisonKeyException -
if otherKey cannot be compared with this object

toString

public java.lang.String toString()
Description copied from interface: ComparisonKey
to assure a decent string representation of the comparisonKey
Specified by:
toString in interface ComparisonKey
Overrides:
toString in class java.lang.Object