structure
Class ComparableAssociation

java.lang.Object
  extended by structure.Association
      extended by structure.ComparableAssociation
All Implemented Interfaces:
Comparable, Map.Entry

public class ComparableAssociation
extends Association
implements Comparable

An association that can be compared.


Constructor Summary
ComparableAssociation(Comparable key)
          Construct an association that can be ordered, from only a key.
ComparableAssociation(Comparable key, Object value)
          Construct a key-value association that can be ordered.
 
Method Summary
 int compareTo(Object other)
          Determine the order of two comparable associations, based on key.
 String toString()
          Construct a string representation of the ComparableAssociation.
 
Methods inherited from class structure.Association
equals, getKey, getValue, hashCode, setValue
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComparableAssociation

public ComparableAssociation(Comparable key)
Construct an association that can be ordered, from only a key. The value is set to null.

Parameters:
key - The (comparable) key.

ComparableAssociation

public ComparableAssociation(Comparable key,
                             Object value)
Construct a key-value association that can be ordered.

Parameters:
key - The (comparable) key.
value - The (possibly comparable) associated value.
Method Detail

compareTo

public int compareTo(Object other)
Determine the order of two comparable associations, based on key.

Specified by:
compareTo in interface Comparable
Parameters:
other - The other comparable association.
Returns:
Value less-than equal to or greater than zero based on comparison

toString

public String toString()
Construct a string representation of the ComparableAssociation.

Overrides:
toString in class Association
Returns:
The string representing the ComparableAssociation.