edu.stanford.nlp.util
Class UnorderedPair
java.lang.Object
edu.stanford.nlp.util.Pair
edu.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
UnorderedPair
public UnorderedPair()
UnorderedPair
public UnorderedPair(Object first,
Object second)
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