Package jadex.commons.collection
Class TwoWayMultiCollection
- java.lang.Object
- 
- jadex.commons.collection.MultiCollection
- 
- jadex.commons.collection.TwoWayMultiCollection
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable,- java.util.Map
 
 public class TwoWayMultiCollection extends MultiCollection The two-way multi-collection allows fast reverse lookup, by containing a second multi-collection, which reversely maps values to keys.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected TwoWayMultiCollectionreverseThe reverse multi-collection.- 
Fields inherited from class jadex.commons.collection.MultiCollectionmap, type
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description TwoWayMultiCollection()Create a two way map.protectedTwoWayMultiCollection(TwoWayMultiCollection reverse)internal constrcutor for connecting two two-way multi-collection.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object_add(java.lang.Object key, java.lang.Object value)Internal put method, which doesn't affect the reverse collection.protected void_clear()Internal clear method, which doesn't affect the reverse collection.protected java.lang.Object_remove(java.lang.Object key)Internal remove method, which doesn't affect the reverse collection.protected void_remove(java.lang.Object key, java.lang.Object value)Internal remove method, which doesn't affect the reverse collection.java.util.Collection<java.lang.Object>add(java.lang.Object key, java.lang.Object value)Associates the specified value with the specified key in this map (optional operation).voidclear()Removes all mappings from this map.TwoWayMultiCollectiongetReverseMultiCollection()Get the reverse multi-collection.java.util.Collection<java.lang.Object>remove(java.lang.Object key)Removes the mapping for this key from this map if it is present.voidremoveObject(java.lang.Object key, java.lang.Object value)Remove a special object from the collection of a defined key.- 
Methods inherited from class jadex.commons.collection.MultiCollectionadd, addAll, clone, containsKey, containsValue, createCollection, entrySet, equals, get, getCollection, getKeys, getKeys, getObject, getObjects, getObjects, hashCode, isEmpty, keySet, put, putAll, size, toString, values
 
- 
 
- 
- 
- 
Field Detail- 
reverseprotected TwoWayMultiCollection reverse The reverse multi-collection.
 
- 
 - 
Constructor Detail- 
TwoWayMultiCollectionpublic TwoWayMultiCollection() Create a two way map.
 - 
TwoWayMultiCollectionprotected TwoWayMultiCollection(TwoWayMultiCollection reverse) internal constrcutor for connecting two two-way multi-collection.
 
- 
 - 
Method Detail- 
getReverseMultiCollectionpublic TwoWayMultiCollection getReverseMultiCollection() Get the reverse multi-collection.- Returns:
- The reverse multi-collection.
 
 - 
addpublic java.util.Collection<java.lang.Object> add(java.lang.Object key, java.lang.Object value)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 mapm.containsKey(k)would return- Overrides:
- addin class- MultiCollection
- 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:
- java.lang.UnsupportedOperationException- if the- java.lang.ClassCastException- if the class of the specified key or value prevents it from being stored in this map.- java.lang.IllegalArgumentException- if some aspect of this key or value prevents it from being stored in this map.- java.lang.NullPointerException- this map does not permit
 - 
_addprotected java.lang.Object _add(java.lang.Object key, java.lang.Object value)Internal put method, which doesn't affect the reverse collection.
 - 
clearpublic void clear() Removes all mappings from this map.- Specified by:
- clearin interface- java.util.Map
- Overrides:
- clearin class- MultiCollection
 
 - 
_clearprotected void _clear() Internal clear method, which doesn't affect the reverse collection.
 - 
removepublic java.util.Collection<java.lang.Object> remove(java.lang.Object key) Removes the mapping for this key from this map if it is present. More formally, if this map contains a mapping from key (key==null ? k==null : key.equals(k)), that mapping is removed. (The map can contain at most one such mapping.)- Specified by:
- removein interface- java.util.Map
- Overrides:
- removein class- MultiCollection
- Parameters:
- key- key whose mapping is to be removed from the map.
- Returns:
- collection associated with specified key, or 
- Throws:
java.lang.ClassCastException- if the key is of an inappropriate type for this map (optional).java.lang.NullPointerException- if the key is
 - 
_removeprotected java.lang.Object _remove(java.lang.Object key) Internal remove method, which doesn't affect the reverse collection.
 - 
removeObjectpublic void removeObject(java.lang.Object key, java.lang.Object value)Remove a special object from the collection of a defined key.- Overrides:
- removeObjectin class- MultiCollection
 
 - 
_removeprotected void _remove(java.lang.Object key, java.lang.Object value)Internal remove method, which doesn't affect the reverse collection.
 
 
 
- 
 
-