|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--iglu.util.ObjectValuePair
A mapping of an object to some value or score. Since this class
is Comparable, it can be used in conjunction
with a SortedSet or sorted array to keep objects
in order of decreasing values.
| Field Summary | |
private java.lang.Object |
object
|
private java.lang.Object |
value
|
| Constructor Summary | |
ObjectValuePair(java.lang.Object object,
double value)
Constructs a pair. |
|
ObjectValuePair(java.lang.Object object,
java.lang.Object value)
Constructs a pair. |
|
| Method Summary | |
int |
compareTo(java.lang.Object obj)
Compares this object to another object. |
int |
compareTo(ObjectValuePair obj)
Compares this object to another object. |
java.lang.Object |
getObject()
Returns the object from this pair. |
java.lang.Object |
getValue()
Returns the value from this pair. |
static void |
main(java.lang.String[] args)
Runs some tests on this class. |
void |
setValue(java.lang.Object value)
Changes the value for this object. |
java.lang.String |
toString()
Returns the string representation of the object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private java.lang.Object object
private java.lang.Object value
| Constructor Detail |
public ObjectValuePair(java.lang.Object object,
java.lang.Object value)
public ObjectValuePair(java.lang.Object object,
double value)
| Method Detail |
public java.lang.Object getObject()
public java.lang.Object getValue()
public void setValue(java.lang.Object value)
public int compareTo(java.lang.Object obj)
ObjectValuePairs are only comparable to other
ObjectValuePairs, so passing any other type of
object to this method will result in a
ClassCastException.
compareTo in interface java.lang.Comparablepublic int compareTo(ObjectValuePair obj)
Comparable,
they are compared alphabetically based on their string representations.
Therefore, this method consideres objects to be equal if their
values are equal and their string representations are equal.
public java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||