|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.util.Pair
Pair: A Class for holding a pair of objects.
Field Summary | |
Object |
first
Direct access is deprecated. |
Object |
second
Direct access is deprecated. |
Constructor Summary | |
Pair()
|
|
Pair(Object first,
Object second)
|
Method Summary | |
int |
compareTo(Object o)
Compares this Pair to another object. |
boolean |
equals(Object o)
|
Object |
first()
|
int |
hashCode()
|
void |
read(InDataStreamFile in)
Read a string representation of a Pair from a DataStream. |
void |
save(OutDataStreamFile out)
Write a string representation of a Pair from a DataStream. |
Object |
second()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public Object first
public Object second
Constructor Detail |
public Pair()
public Pair(Object first, Object second)
Method Detail |
public Object first()
public Object second()
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public void read(InDataStreamFile in)
String
.
public void save(OutDataStreamFile out)
toString()
method is called on each of the pair
of objects and a String
representation is written.
This might not allow one to recover the pair of objects unless they
are of type String
.
public int compareTo(Object o)
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
.
compareTo
in interface Comparable
o
- the Object
to be compared.
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
.
ClassCastException
- if the argument is not a
Pair
.Comparable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |