|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.Pair
Pair: A Class for holding a pair of objects.
Field Summary | |
Object |
first
Direct access is deprecated. |
boolean |
intern
|
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(DataInputStream in)
Read a string representation of a Pair from a DataStream. |
void |
save(DataOutputStream out)
Write a string representation of a Pair from a DataStream. |
Object |
second()
|
void |
setFirst(Object o)
|
void |
setSecond(Object o)
|
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
public boolean intern
Constructor Detail |
public Pair()
public Pair(Object first, Object second)
Method Detail |
public Object first()
public Object second()
public void setFirst(Object o)
public void setSecond(Object o)
public String toString()
public boolean equals(Object o)
public int hashCode()
public void read(DataInputStream in)
String
.
public void save(DataOutputStream 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 |