|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gumbo.util.AbstractBimap | +--gumbo.util.AbstractGroupBimap
An abstract implementation of the GroupBimap interface. Intended as a lightweight proxy for a bimap's stores, with lazy build of the stores and this object's immutable views. Because of the need to match value group type, wrapping and external target, as in a Bimap, is not supported. TODO: Group store must be a List for now until Bimap and GroupBimap can be made fully compliant with Map.
Nested Class Summary |
Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
Constructor Summary | |
AbstractGroupBimap()
Constructs an instance, with empty lazy build stores (see newValueStore(), newKeyStore()). |
|
AbstractGroupBimap(java.util.Map init)
Constructs an instance, with initialized stores. |
Method Summary | |
void |
addAll(java.util.Collection keys,
int index,
java.util.Collection values)
Adds all the values to the groups associated with all the keys. |
void |
addAll(java.util.Map map)
Adds all the entries in the map to this one. |
void |
addAllKeys(java.util.Collection keys,
int index,
java.lang.Object value)
Adds a value to the groups associated with all the keys. |
void |
addAllValues(java.lang.Object key,
int index,
java.util.Collection values)
Adds all the values to the group associated with a key. |
void |
addValue(java.lang.Object key,
int index,
java.lang.Object value)
Adds a value to the group associated with a key. |
java.util.Set |
entrySet()
Gets an immutable view of the key-value entries (Map.Entry) in this bimap. |
java.lang.Object |
get(java.lang.Object key)
If the value group storage is a list, gets the value at the head of the list associated with the key. |
GroupBimap |
getGroupBimap()
Gets a singleton immutable view of this group bimap. |
Group |
getValues(java.lang.Object key)
Gets an immutable snapshot of the values (Object) associated with a key. |
protected Group |
newValueGroup()
Called by this object when it needs to build a new value group (Object) in the key-to-value map. |
protected java.util.Collection |
newValueGroupStore()
Called by this object when it needs to lazily build the store for a value group in the key-to-values map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
If the value group storage is a list, adds the value to the head of the list associated with the key. |
void |
putAll(java.util.Map map)
If the value group storage is a list, adds a map value to the head of the list associated with a key. |
java.lang.Object |
remove(java.lang.Object key)
Removes the values associated with a key. |
void |
removeAll(java.util.Collection keys,
java.util.Collection values)
Removes all the values from the groups associated with all the keys. |
void |
removeAllKeys(java.util.Collection keys)
Removes all the keys and their associated values. |
void |
removeAllKeys(java.util.Collection keys,
java.lang.Object value)
Removes a value from the groups associated with all the keys. |
void |
removeAllValues(java.util.Collection values)
Removes all the values and their associated keys. |
void |
removeAllValues(java.lang.Object key,
java.util.Collection values)
Removes all the values from the group associated with a key. |
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. |
void |
removeValue(java.lang.Object key,
java.lang.Object value)
Removes a value from the group associated with a key. |
java.util.Collection |
values()
If the value group storage is a list, gets the values at the head of the lists associated with the keys. |
Methods inherited from class gumbo.util.AbstractBimap |
clear, containsKey, containsValue, equals, getBimap, getKeyMapStore, getKeys, getValueMapStore, hashCode, isEmpty, keySet, newKeyGroup, newKeyGroupStore, newKeyMapStore, newValueMapStore, size, toString, valueSet |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gumbo.util.Bimap |
getBimap, getKeys, keySet, valueSet |
Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, equals, hashCode, isEmpty, size |
Constructor Detail |
public AbstractGroupBimap()
public AbstractGroupBimap(java.util.Map init)
init
- The initial map (Object to Object) or group bimap
(Object to Group of Object). See addAll(Map). None if null.Method Detail |
protected java.util.Collection newValueGroupStore()
protected final Group newValueGroup()
java.lang.IllegalStateException
- New value group store is null.public void addAll(java.util.Collection keys, int index, java.util.Collection values)
GroupBimap
addAll
in interface GroupBimap
public void addAll(java.util.Map map)
GroupBimap
addAll
in interface GroupBimap
public void addAllKeys(java.util.Collection keys, int index, java.lang.Object value)
GroupBimap
addAllKeys
in interface GroupBimap
public void addAllValues(java.lang.Object key, int index, java.util.Collection values)
GroupBimap
addAllValues
in interface GroupBimap
public void addValue(java.lang.Object key, int index, java.lang.Object value)
GroupBimap
addValue
in interface GroupBimap
key
- Value group key. Never null.index
- List index. If not backed by a list, < 0. If backed
by a list, <= group size, with < 0 being the end of the list.value
- Value to be added. Ignored if null.public Group getValues(java.lang.Object key)
GroupBimap
getValues
in interface GroupBimap
public void removeAll(java.util.Collection keys, java.util.Collection values)
GroupBimap
removeAll
in interface GroupBimap
public void removeAllKeys(java.util.Collection keys, java.lang.Object value)
GroupBimap
removeAllKeys
in interface GroupBimap
public void removeAllValues(java.lang.Object key, java.util.Collection values)
GroupBimap
removeAllValues
in interface GroupBimap
public void removeValue(java.lang.Object key, java.lang.Object value)
GroupBimap
removeValue
in interface GroupBimap
key
- Value group key. Never null.value
- Value to be removed. Ignored if null or missing.public GroupBimap getGroupBimap()
GroupBimap
getGroupBimap
in interface GroupBimap
public void removeAllKeys(java.util.Collection keys)
Bimap
removeAllKeys
in interface Bimap
removeAllKeys
in class AbstractBimap
public void removeAllValues(java.util.Collection values)
Bimap
removeAllValues
in interface Bimap
removeAllValues
in class AbstractBimap
public void removeKey(java.lang.Object key)
Bimap
removeKey
in interface Bimap
removeKey
in class AbstractBimap
public void removeValue(java.lang.Object value)
Bimap
removeValue
in interface Bimap
removeValue
in class AbstractBimap
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
GroupBimap
put
in interface GroupBimap
put
in class AbstractBimap
public void putAll(java.util.Map map)
GroupBimap
putAll
in interface GroupBimap
putAll
in class AbstractBimap
public java.lang.Object get(java.lang.Object key)
GroupBimap
get
in interface GroupBimap
get
in class AbstractBimap
public java.lang.Object remove(java.lang.Object key)
GroupBimap
remove
in interface GroupBimap
remove
in class AbstractBimap
public java.util.Collection values()
GroupBimap
values
in interface GroupBimap
values
in class AbstractBimap
public java.util.Set entrySet()
Bimap
entrySet
in interface GroupBimap
entrySet
in class AbstractBimap
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |