|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.generic.util.StableHashMap
This version of a HashMap keeps the order of its elements.
This is different from the original java1.3 HashMap that
imposes no order on its elements. Java 1.4 has a class that resembles this
class.
The order of the values in the StableHashMap is stable and
does not change throughout the lifetime of the map.
The class also allows to remove a value from the order and bring it to front
or to the back of the order in linear time. Methods that do this are
moveToBegin(Object) and moveToEnd(Object).
| Nested Class Summary |
| Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
| Constructor Summary | |
StableHashMap()
Constructs a new empty StableHashMap. |
|
StableHashMap(int initialCapacity)
Constructs a new empty StableHashMap with the specified
initial capacity. |
|
StableHashMap(StableHashMap stablehashmap)
Constructs a new empty StableHashMap that is filled with
the key/value pairs from the given StableHashMap. |
|
| Method Summary | |
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
java.lang.Object |
getFirst()
Return the object that comes as first in the internal order. |
java.lang.Object |
getLast()
Return the object that comes as last in the internal order. |
java.lang.Object |
getPredecessor(java.lang.Object key)
Returns the predecessor of the value represented by the given key. |
java.lang.Object |
getPredecessorKey(java.lang.Object key)
Returns the key for the predecessor of the value represented by the given key. |
java.lang.Object |
getSuccessor(java.lang.Object key)
Returns the successor of the value represented by the given key. |
java.lang.Object |
getSuccessorKey(java.lang.Object key)
Returns the key for the successor of the value represented by the given key. |
java.util.List |
internalEntriesBetween(java.lang.Object key0,
java.lang.Object key1)
Undocumented Tensegrity Visualization Framework internal method. |
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
boolean |
moveBackward(java.lang.Object key)
Brings the object with the associated key one step backwards in the internal order. |
boolean |
moveBefore(java.lang.Object keyPivot,
java.lang.Object key)
Brings the object indetified by the given key right before
the object identified by the given keyPivot in the internal
order. |
boolean |
moveBehind(java.lang.Object keyPivot,
java.lang.Object key)
Brings the object indetified by the given key right behind
the object identified by the given keyPivot in the internal
order. |
boolean |
moveForward(java.lang.Object key)
Brings the object with the associated key one step forward in the internal order. |
boolean |
moveToBegin(java.lang.Object key)
Brings the object with the associated key to the beginning of the internal order. |
boolean |
moveToEnd(java.lang.Object key)
Brings the object with the associated key to the end of the internal order. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map t)
|
boolean |
putBefore(java.lang.Object keyPivot,
java.lang.Object key,
java.lang.Object value)
Inserts the specified key-value pair right before the mapping specified through the given keyPivot and returns a
boolean that indicates whether a mapping for the given
key-value pair has been created or not.
|
boolean |
putBehind(java.lang.Object keyPivot,
java.lang.Object key,
java.lang.Object value)
Inserts the specified key-value pair right after the mapping specified through the given keyPivot and returns a
boolean that indicates whether a mapping for the given
key-value pair has been created or not.
|
java.lang.Object |
remove(java.lang.Object key)
|
int |
size()
|
java.util.Collection |
values()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode |
| Constructor Detail |
public StableHashMap()
StableHashMap.
public StableHashMap(int initialCapacity)
StableHashMap with the specified
initial capacity.
initialCapacity - the initial capacity of this instance.public StableHashMap(StableHashMap stablehashmap)
StableHashMap that is filled with
the key/value pairs from the given StableHashMap.
stablehashmap - input HashMap that contains initial key/value
pairs that are inserted into this instance upon creation.
InvalidArgumentException, - if a null map is given.| Method Detail |
public boolean isEmpty()
isEmpty in interface java.util.Mappublic int size()
size in interface java.util.Mappublic java.lang.Object get(java.lang.Object key)
get in interface java.util.Map
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mappublic void putAll(java.util.Map t)
putAll in interface java.util.Mappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mappublic void clear()
clear in interface java.util.Mappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Mappublic boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Mappublic java.util.Set keySet()
keySet in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Mappublic java.util.Collection values()
values in interface java.util.Map
public java.util.List internalEntriesBetween(java.lang.Object key0,
java.lang.Object key1)
key0 - undocumented Tensegrity Visualization Framework internal
methodkey1 - undocumented Tensegrity Visualization Framework internal
method
public java.lang.Object getFirst()
null is returned.
nullpublic java.lang.Object getLast()
null is returned.
nullpublic java.lang.Object getPredecessor(java.lang.Object key)
key. If the the map does not contain a mapping for the
specified key null is returned.
key - the key of the value whose predecessor should be returned
null if the value has no
predecessorpublic java.lang.Object getSuccessor(java.lang.Object key)
key. If the the map does not contain a mapping for the
specified key null is returned.
key - the key of the value whose successor should be returned
null if the value has no
successorpublic java.lang.Object getPredecessorKey(java.lang.Object key)
key. If the the map does not contain a mapping for the
specified key null is returned.
key - the key of the value whose predecessor key should be returned
null if the
value has no predecessorpublic java.lang.Object getSuccessorKey(java.lang.Object key)
key. If the the map does not contain a mapping for the
specified key null is returned.
key - the key of the value whose successor key should be returned
null if the
value has no successor
public boolean putBefore(java.lang.Object keyPivot,
java.lang.Object key,
java.lang.Object value)
keyPivot and returns a
boolean that indicates whether a mapping for the given
key-value pair has been created or not.
keyPivot the specified key-value pair is not inserted and
false is returned.
keyPivot - the key of the value the specified key-value pair should
be inserted right beforekey - the key of the mapping to insertvalue - the value of the mapping to insert
public boolean putBehind(java.lang.Object keyPivot,
java.lang.Object key,
java.lang.Object value)
keyPivot and returns a
boolean that indicates whether a mapping for the given
key-value pair has been created or not.
keyPivot the specified key-value pair is not inserted and
false is returned.
keyPivot - the key of the value the specified key-value pair should
be inserted right afterkey - the key of the mapping to insertvalue - the value of the mapping to insert
public boolean moveToBegin(java.lang.Object key)
key - the key that identifies the element to reorder.
public boolean moveToEnd(java.lang.Object key)
key - the key that identifies the element to reorder.
public boolean moveBefore(java.lang.Object keyPivot,
java.lang.Object key)
key right before
the object identified by the given keyPivot in the internal
order.
keyPivot - the key that identifies the pivot objectkey - the key that identifies the object to move
key
and the given keyPivot were found in the map or not
public boolean moveBehind(java.lang.Object keyPivot,
java.lang.Object key)
key right behind
the object identified by the given keyPivot in the internal
order.
keyPivot - the key that identifies the pivot objectkey - the key that identifies the object to move
key
and the given keyPivot were found in the map or notpublic boolean moveForward(java.lang.Object key)
key - the key that identifies the element to reorder.
key
was found in the map or notpublic boolean moveBackward(java.lang.Object key)
key - the key that identifies the element to reorder.
key
was found in the map or not
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||