org.locomotive.util.data
Class StringKey

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

public class StringKey
extends java.lang.Object
implements ComparisonKey

this class provides a comparison key for strings


Field Summary
 java.lang.String value
           
 
Constructor Summary
StringKey(java.lang.String value)
          Constructor creates a new StringKey
 
Method Summary
 int compare(ComparisonKey otherKey)
          Compare myself to another object
 java.lang.String toString()
          returns a string representation of the object, of the form: 'value, firstName'
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

public java.lang.String value
Constructor Detail

StringKey

public StringKey(java.lang.String value)
Constructor creates a new StringKey
Parameters:
value - the String to compare
Method Detail

compare

public int compare(ComparisonKey otherKey)
            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 StringKey comes before otherKey
1 - if this this StringKey comes after otherKey
0 - if this StringKey is equivalent to otherKey
Throws:
ComparisonKeyException -
if otherKey cannot be compared with this object

toString

public java.lang.String toString()
returns a string representation of the object, of the form: 'value, firstName'
Specified by:
toString in interface ComparisonKey
Overrides:
toString in class java.lang.Object