org.locomotive.util.data
Class NameKey

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

public class NameKey
extends java.lang.Object
implements ComparisonKey

this class provides a comparison key for names.


Field Summary
 java.lang.String firstName
           
 java.lang.String lastName
           
 
Constructor Summary
NameKey(java.lang.String lastName, java.lang.String firstName)
          Constructor creates a new NameKey from a full name
 
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: 'lastName, firstName'
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lastName

public java.lang.String lastName

firstName

public java.lang.String firstName
Constructor Detail

NameKey

public NameKey(java.lang.String lastName,
               java.lang.String firstName)
Constructor creates a new NameKey from a full name
Parameters:
lastName - the last name of the name
firstName - the first name of the name
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 nameKey comes before otherKey
1 - if this this nameKey comes after otherKey
0 - if this nameKey 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: 'lastName, firstName'
Specified by:
toString in interface ComparisonKey
Overrides:
toString in class java.lang.Object