csli.util
Class ComparablePair<Type1 extends Comparable<Type1>,Type2 extends Comparable<Type2>>

java.lang.Object
  extended by csli.util.Pair<Type1,Type2>
      extended by csli.util.ComparablePair<Type1,Type2>
All Implemented Interfaces:
Serializable, Comparable<ComparablePair<Type1,Type2>>

public class ComparablePair<Type1 extends Comparable<Type1>,Type2 extends Comparable<Type2>>
extends Pair<Type1,Type2>
implements Comparable<ComparablePair<Type1,Type2>>

A comparable pair. I.e., a pair comparable to another pair of the same element types.

Author:
David Haley
See Also:
Serialized Form

Field Summary
 
Fields inherited from class csli.util.Pair
a, b, onlyFirstToString
 
Constructor Summary
ComparablePair(Type1 elem1, Type2 elem2)
           
 
Method Summary
 int compareTo(ComparablePair<Type1,Type2> rhs)
          Compare this pair to another pair of same type.
 
Methods inherited from class csli.util.Pair
equals, first, getBool, getDouble, getInt, second, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComparablePair

public ComparablePair(Type1 elem1,
                      Type2 elem2)
Method Detail

compareTo

public int compareTo(ComparablePair<Type1,Type2> rhs)
Compare this pair to another pair of same type.

Comparison occurs in the following order:

In other words, the first element of the pair takes precedence over the second element during comparison.

Specified by:
compareTo in interface Comparable<ComparablePair<Type1 extends Comparable<Type1>,Type2 extends Comparable<Type2>>>
Parameters:
rhs - The pair to compare to.
Returns:
-1 if this < rhs; 0 if this == rhs; 1 if this > rhs
Since:
2005-08-08