|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object finiteAutomata.Association
public class Association
A key-value pair such that the key cannot be modified. Associations are used by the Hashtable class. Adapted from code in "Java Structures: Data Structures in Java for the Principled Programmer", 2nd edition, Duane A. Bailey, 2003 (McGraw-Hill Publishers), p.14.
Field Summary | |
---|---|
protected java.lang.Object |
theKey
the key |
protected java.lang.Object |
theValue
the value |
Constructor Summary | |
---|---|
Association(java.lang.Object key)
1-parameter constructor. |
|
Association(java.lang.Object key,
java.lang.Object value)
2-parameter constructor. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object other)
Tests whether this Association and the given Association have equal keys. |
java.lang.Object |
getKey()
Returns the key. |
java.lang.Object |
getValue()
Returns the value. |
static void |
main(java.lang.String[] args)
|
java.lang.Object |
setValue(java.lang.Object value)
Sets the value of this Association to the given Object. |
java.lang.String |
toString()
Converts this Association to a String for pretty-printing. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map.Entry |
---|
hashCode |
Field Detail |
---|
protected java.lang.Object theKey
protected java.lang.Object theValue
Constructor Detail |
---|
public Association(java.lang.Object key, java.lang.Object value)
key
- Object to store as the keyvalue
- Object to store as the valuepublic Association(java.lang.Object key)
key
- Object to store as the keyMethod Detail |
---|
public java.lang.Object getKey()
getKey
in interface java.util.Map.Entry
public java.lang.Object getValue()
getValue
in interface java.util.Map.Entry
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object setValue(java.lang.Object value)
setValue
in interface java.util.Map.Entry
value
- Object to store as the new value
public boolean equals(java.lang.Object other)
equals
in interface java.util.Map.Entry
equals
in class java.lang.Object
other
- Association to compare with this
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |