All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class structure.ComparableAssociation

java.lang.Object
    |
    +----structure.Association
            |
            +----structure.ComparableAssociation

public class ComparableAssociation
extends Association
implements Comparable
An association that can be compared.


Constructor Index

 o ComparableAssociation(Comparable)
Construct an association that can be ordered, from only a key.
 o ComparableAssociation(Comparable, Object)
Construct a key-value association that can be ordered.

Method Index

 o compareTo(Object)
Determine the order of two comparable associations, based on key.
 o toString()
Construct a string representation of the ComparableAssociation.

Constructors

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

Precondition:
key is non-null
Postcondition:
constructs comparable association with null value

Parameters:
key - The (comparable) key.
 o ComparableAssociation
public ComparableAssociation(Comparable key,
                             Object value)
Construct a key-value association that can be ordered.

Precondition:
key is non-null
Postcondition:
constructs association between a comparable key and a value

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

Methods

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

Precondition:
other is non-null ComparableAssociation
Postcondition:
returns integer representing relation between values.

Parameters:
other - The other comparable association.
Returns:
Value less-than equal to or greater than zero based on comparison
 o toString
public String toString()
Construct a string representation of the ComparableAssociation.

Postcondition:
returns string representation

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

All Packages  Class Hierarchy  This Package  Previous  Next  Index