Package jadex.collection
Class TwoWayMultiCollection
java.lang.Object
jadex.collection.MultiCollection
jadex.collection.TwoWayMultiCollection
- All Implemented Interfaces:
Serializable,Cloneable,Map
The two-way multi-collection allows fast reverse lookup,
by containing a second multi-collection,
which reversely maps values to keys.
- See Also:
-
Nested Class Summary
-
Field Summary
FieldsFields inherited from class jadex.collection.MultiCollection
map, type -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a two way map.protectedinternal constrcutor for connecting two two-way multi-collection. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectInternal put method, which doesn't affect the reverse collection.protected void_clear()Internal clear method, which doesn't affect the reverse collection.protected ObjectInternal remove method, which doesn't affect the reverse collection.protected voidInternal remove method, which doesn't affect the reverse collection.Associates the specified value with the specified key in this map (optional operation).voidclear()Removes all mappings from this map.Get the reverse multi-collection.Removes the mapping for this key from this map if it is present.voidremoveObject(Object key, Object value) Remove a special object from the collection of a defined key.Methods inherited from class jadex.collection.MultiCollection
add, addAll, clone, containsKey, containsValue, createCollection, entrySet, equals, get, getCollection, getKeys, getKeys, getObject, getObjects, getObjects, hashCode, isEmpty, keySet, put, putAll, size, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
reverse
The reverse multi-collection.
-
-
Constructor Details
-
TwoWayMultiCollection
public TwoWayMultiCollection()Create a two way map. -
TwoWayMultiCollection
internal constrcutor for connecting two two-way multi-collection.
-
-
Method Details
-
getReverseMultiCollection
Get the reverse multi-collection.- Returns:
- The reverse multi-collection.
-
add
Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for this key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only ifm.containsKey(k)would return true.))- Overrides:
addin classMultiCollection- Parameters:
key- key with which the specified value is to be associated.value- value to be associated with the specified key.- Returns:
- The collection associated to the key.
- Throws:
UnsupportedOperationException- if the put operation is not supported by this map.ClassCastException- if the class of the specified key or value prevents it from being stored in this map.IllegalArgumentException- if some aspect of this key or value prevents it from being stored in this map.NullPointerException- this map does not permit null keys or values, and the specified key or value is null.
-
_add
Internal put method, which doesn't affect the reverse collection. -
clear
public void clear()Removes all mappings from this map.- Specified by:
clearin interfaceMap- Overrides:
clearin classMultiCollection
-
_clear
protected void _clear()Internal clear method, which doesn't affect the reverse collection. -
remove
Removes the mapping for this key from this map if it is present. More formally, if this map contains a mapping from key k to value v such that(key==null ? k==null : key.equals(k)), that mapping is removed. (The map can contain at most one such mapping.)Returns the value to which the map previously associated the key, or null if the map contained no mapping for this key. (A null return can also indicate that the map previously associated null with the specified key if the implementation supports null values.) The map will not contain a mapping for the specified key once the call returns.
- Specified by:
removein interfaceMap- Overrides:
removein classMultiCollection- Parameters:
key- key whose mapping is to be removed from the map.- Returns:
- collection associated with specified key, or null if there was no mapping for key.
- Throws:
ClassCastException- if the key is of an inappropriate type for this map (optional).NullPointerException- if the key is null and this map does not not permit null keys (optional).
-
_remove
Internal remove method, which doesn't affect the reverse collection. -
removeObject
Remove a special object from the collection of a defined key.- Overrides:
removeObjectin classMultiCollection
-
_remove
Internal remove method, which doesn't affect the reverse collection.
-