rita.support
Class ObjectPair

java.lang.Object
  extended by rita.support.ObjectPair
All Implemented Interfaces:
java.lang.Comparable

public class ObjectPair
extends java.lang.Object
implements java.lang.Comparable

A utility class for holding a pair of objects.


Constructor Summary
ObjectPair()
           
ObjectPair(java.lang.Object first, java.lang.Object second)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this ObjectPair to another object.
 boolean equals(java.lang.Object o)
           
 java.lang.Object first()
           
 int hashCode()
           
 java.lang.Object second()
           
 void setFirst(java.lang.Object o)
           
 void setSecond(java.lang.Object o)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectPair

public ObjectPair()

ObjectPair

public ObjectPair(java.lang.Object first,
                  java.lang.Object second)
Method Detail

first

public java.lang.Object first()

second

public java.lang.Object second()

setFirst

public void setFirst(java.lang.Object o)

setSecond

public void setSecond(java.lang.Object o)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Compares this ObjectPair to another object. If the object is a ObjectPair, this function will work providing the elements of the ObjectPair are themselves comparable. It will then return a value based on the pair of objects, where p > q iff p.first() > q.first() || (p.first().equals(q.first()) && p.second() > q.second()). If the other object is not a ObjectPair, it throws a ClassCastException.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the Object to be compared.
Returns:
the value 0 if the argument is a ObjectPair equal to this ObjectPair; a value less than 0 if the argument is a ObjectPair greater than this ObjectPair; and a value greater than 0 if the argument is a ObjectPair less than this ObjectPair.
Throws:
java.lang.ClassCastException - if the argument is not a ObjectPair.
See Also:
Comparable