fipaos.tool.configurator
Class TwoWayMapping

java.lang.Object
  |
  +--fipaos.tool.configurator.TwoWayMapping

public class TwoWayMapping
extends java.lang.Object

TwoWayMapping is a convenience class that allows bidirectional lookup between unique pairs of values. It is essentially a hashtable that can be searched using either keys or values. The semantics for this class only hold if no object exists as both a key and a value (unless they are a unique pair).


Constructor Summary
TwoWayMapping()
          Constructs a new TwoWayMapping
 
Method Summary
 java.lang.Object get(java.lang.Object key)
          Attempts to retrieve the "other half" of a pair that is mapped to the supplied object.
 void put(java.lang.Object first, java.lang.Object second)
          Puts a pair of objects into the TwoWayMapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwoWayMapping

public TwoWayMapping()
Constructs a new TwoWayMapping
Method Detail

put

public void put(java.lang.Object first,
                java.lang.Object second)
Puts a pair of objects into the TwoWayMapping. The order of the objects should not matter.
Parameters:
first. - The first object in the pair.
second. - The second object in the pair.

get

public java.lang.Object get(java.lang.Object key)
Attempts to retrieve the "other half" of a pair that is mapped to the supplied object.
Parameters:
key. - One half of a pair.
Returns:
The matching object if one is found, null if not.