Jadex 0.96-beta1

jadex.util.collection
Class TwoWayMultiCollection

java.lang.Object
  extended by jadex.util.collection.MultiCollection
      extended by jadex.util.collection.TwoWayMultiCollection
All Implemented Interfaces:
Serializable, Cloneable, 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

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry
 
Constructor Summary
TwoWayMultiCollection()
          Create a two way map.
 
Method Summary
 void clear()
          Removes all mappings from this map.
 TwoWayMultiCollection getReverseMultiCollection()
          Get the reverse multi-collection.
 Object put(Object key, Object value)
          Associates the specified value with the specified key in this map (optional operation).
 Object remove(Object key)
          Removes the mapping for this key from this map if it is present.
 void remove(Object key, Object value)
          Remove a special object from the collection of a defined key.
 
Methods inherited from class jadex.util.collection.MultiCollection
clone, containsKey, containsValue, entrySet, equals, get, getCollection, getKeys, getKeys, getObjects, getObjects, hashCode, isEmpty, keySet, putAll, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TwoWayMultiCollection

public TwoWayMultiCollection()
Create a two way map.

Method Detail

getReverseMultiCollection

public TwoWayMultiCollection getReverseMultiCollection()
Get the reverse multi-collection.

Returns:
The reverse multi-collection.

put

public Object put(Object key,
                  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 map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.))

Specified by:
put in interface Map
Overrides:
put in 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:
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.

clear

public void clear()
Removes all mappings from this map.

Specified by:
clear in interface Map
Overrides:
clear in class MultiCollection

remove

public Object remove(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 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:
remove in interface Map
Overrides:
remove in class MultiCollection
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

public void remove(Object key,
                   Object value)
Remove a special object from the collection of a defined key.

Overrides:
remove in class MultiCollection

Jadex 0.96-beta1

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.