|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--gumbo.util.AbstractBimap
An abstract implementation of the Bimap interface. Intended as a lightweight proxy for a bimap's stores, with lazy build of the stores and this object's immutable views. Uses the decorator pattern to wrap an external target store or, if none, uses lazy build for an internal one.
| Nested Class Summary |
| Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
| Constructor Summary | |
AbstractBimap()
Constructs an instance, with empty lazy build stores (see newValueStore(), newKeyStore()). |
|
AbstractBimap(java.util.Map init)
Constructs an instance, with initialized stores (see newValueStore(), newKeyStore()). |
|
AbstractBimap(java.util.Map init,
java.util.Map valueMap)
Constructs an instance, with wrapped and initialized stores. |
|
| Method Summary | |
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set |
entrySet()
Gets an immutable view of the key-value entries (Map.Entry) in this bimap. |
boolean |
equals(java.lang.Object obj)
|
java.lang.Object |
get(java.lang.Object key)
|
Bimap |
getBimap()
Gets a singleton immutable view of this bimap. |
protected java.util.Map |
getKeyMapStore()
Gets this object's value-to-keys (Object to Group-Set of Object) map store. |
java.util.Set |
getKeys(java.lang.Object value)
Gets an immutable snapshot of the keys associated with a value. |
protected java.util.Map |
getValueMapStore()
Gets this object's key-to-value map store (Object to Object). |
int |
hashCode()
|
boolean |
isEmpty()
|
java.util.Set |
keySet()
Gets an immutable view of the keys (Object) in this bimap. |
protected Group |
newKeyGroup()
Called by this object when it needs to build a new key group (Object) in the value-to-keys map. |
protected java.util.Set |
newKeyGroupStore()
Called by this object when it needs to lazily build the store for a key group in the value-to-keys map. |
protected java.util.Map |
newKeyMapStore()
Called by this object when it needs to lazily build the value-to-keys map store. |
protected java.util.Map |
newValueMapStore()
Called by this object when it needs to lazily build the key-to-value map store. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map map)
|
java.lang.Object |
remove(java.lang.Object key)
|
void |
removeAllKeys(java.util.Collection keys)
Removes all the keys and their associated values. |
void |
removeAllValues(java.util.Collection values)
Removes all the values and their associated keys. |
void |
removeKey(java.lang.Object key)
Removes the key and its associated value. |
void |
removeValue(java.lang.Object value)
Removes the value and its associated keys. |
int |
size()
|
java.lang.String |
toString()
|
java.util.Collection |
values()
Gets an immutable view of the values (Object) in this bimap. |
java.util.Set |
valueSet()
Gets an immutable view of the values (Object) in this bimap as a set. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AbstractBimap()
public AbstractBimap(java.util.Map init)
init - The initial key-to-value map (Object to Object).
None if null.
public AbstractBimap(java.util.Map init,
java.util.Map valueMap)
init - The initial key-to-value map (Object to Object).
None if null.valueMap - The target key-to-value map store being wrapped.
If null, defaults to the lazy build target (see newValueStore()).
If init is non-null, any contents will be lost.| Method Detail |
protected java.util.Map newValueMapStore()
protected java.util.Map newKeyMapStore()
protected java.util.Set newKeyGroupStore()
protected final java.util.Map getValueMapStore()
java.lang.IllegalStateException - New value map store is null.protected final java.util.Map getKeyMapStore()
java.lang.IllegalStateException - New key map store is null.protected final Group newKeyGroup()
java.lang.IllegalStateException - New key group store is null.public void removeValue(java.lang.Object value)
Bimap
removeValue in interface Bimappublic void removeAllValues(java.util.Collection values)
Bimap
removeAllValues in interface Bimappublic void removeKey(java.lang.Object key)
Bimap
removeKey in interface Bimappublic void removeAllKeys(java.util.Collection keys)
Bimap
removeAllKeys in interface Bimappublic java.util.Set getKeys(java.lang.Object value)
Bimap
getKeys in interface Bimappublic java.util.Set valueSet()
Bimap
valueSet in interface Bimappublic Bimap getBimap()
Bimap
getBimap in interface Bimappublic 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.lang.Object get(java.lang.Object key)
get in interface java.util.Mappublic boolean isEmpty()
isEmpty 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 map)
putAll in interface java.util.Mappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mappublic int size()
size in interface java.util.Mappublic java.util.Set keySet()
Bimap
keySet in interface Bimappublic java.util.Set entrySet()
Bimap
entrySet in interface Bimappublic java.util.Collection values()
Bimap
values in interface Bimappublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in interface java.util.Mapequals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.MaphashCode in class java.lang.Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||