edu.stanford.nlp.util
Class UnorderedPair

java.lang.Object
  extended byedu.stanford.nlp.util.Pair
      extended byedu.stanford.nlp.util.UnorderedPair
All Implemented Interfaces:
Comparable, Serializable

public class UnorderedPair
extends Pair
implements Comparable

Unordered Pair Class for holding an unordered pair of objects

Author:
Dan Klein
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.stanford.nlp.util.Pair
first, intern, second
 
Constructor Summary
UnorderedPair()
           
UnorderedPair(Object first, Object second)
           
 
Method Summary
 int compareTo(Object o)
          Compares this Pair to another object.
 boolean equals(Object o)
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class edu.stanford.nlp.util.Pair
first, read, save, second, setFirst, setSecond
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnorderedPair

public UnorderedPair()

UnorderedPair

public UnorderedPair(Object first,
                     Object second)
Method Detail

toString

public String toString()
Overrides:
toString in class Pair

equals

public boolean equals(Object o)
Overrides:
equals in class Pair

hashCode

public int hashCode()
Overrides:
hashCode in class Pair

compareTo

public int compareTo(Object o)
Description copied from class: Pair
Compares this Pair to another object. If the object is a Pair, this function will work providing the elements of the Pair 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 Pair, it throws a ClassCastException.

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class Pair
Parameters:
o - the Object to be compared.
Returns:
the value 0 if the argument is a Pair equal to this Pair; a value less than 0 if the argument is a Pair greater than this Pair; and a value greater than 0 if the argument is a Pair less than this Pair.
See Also:
Comparable


Stanford NLP Group