org.hypergraphdb.util
Class TwoWayMap<X,Y>

java.lang.Object
  extended by org.hypergraphdb.util.TwoWayMap<X,Y>
Type Parameters:
X -
Y -

public class TwoWayMap<X,Y>
extends java.lang.Object

A bi-directional map X <-> Y. For lack of better terms (yes, we considered "domain" and "range") the map is between a set of Xs and a set of Ys.

Note that this class is not thread-safe.

Author:
Borislav Iordanov

Constructor Summary
TwoWayMap()
           
 
Method Summary
 void add(X x, Y y)
           
 void clear()
           
 boolean containsX(X x)
           
 boolean containsY(Y y)
           
 X getX(Y y)
           
 Y getY(X x)
           
 boolean isEmtpy()
           
 Y removeX(X x)
           
 X removeY(Y y)
           
 java.util.Iterator<X> xiterator()
           
 java.util.Iterator<Pair<X,Y>> xyiterator()
           
 java.util.Iterator<Y> yiterator()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwoWayMap

public TwoWayMap()
Method Detail

add

public void add(X x,
                Y y)

xiterator

public java.util.Iterator<X> xiterator()

yiterator

public java.util.Iterator<Y> yiterator()

xyiterator

public java.util.Iterator<Pair<X,Y>> xyiterator()

removeX

public Y removeX(X x)

removeY

public X removeY(Y y)

getY

public Y getY(X x)

getX

public X getX(Y y)

containsX

public boolean containsX(X x)

containsY

public boolean containsY(Y y)

isEmtpy

public boolean isEmtpy()

clear

public void clear()