org.simantics.databoard.util
Class BijectionMap<L,R>

java.lang.Object
  extended by org.simantics.databoard.util.BijectionMap<L,R>

public class BijectionMap<L,R>
extends java.lang.Object

Bijection map is a Map that has no values or keys, only 1:1 mappings of values. These value/keys will be called with left and right side values. Each value can exist only once on a side

Author:
Toni Kalajainen

Constructor Summary
BijectionMap()
           
BijectionMap(BijectionMap<L,R> copyFrom)
           
 
Method Summary
 void addAll(BijectionMap<L,R> map)
           
 void clear()
           
 BijectionMap<L,R> clone()
           
 boolean contains(L leftValue, R rightValue)
           
 boolean containsLeft(L leftValue)
           
 boolean containsRight(R rightValue)
           
 java.util.Set<java.util.Map.Entry<L,R>> getEntries()
           
 L getLeft(R rightValue)
           
 java.util.Set<L> getLeftSet()
          Get set of left values
 java.util.Map<L,R> getLeftToRightMap()
          Get left-to-right map
 R getRight(L leftValue)
           
 java.util.Set<R> getRightSet()
          Get set of right values
 java.util.Map<R,L> getRightToLeftMap()
          Get right-to-left map
 boolean isEmpty()
           
 void map(L leftValue, R rightValue)
           
 R removeWithLeft(L leftValue)
           
 L removeWithRight(R rightValue)
           
 boolean retainAllLeft(java.util.Collection<L> values)
           
 boolean retainAllRight(java.util.Collection<R> values)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BijectionMap

public BijectionMap()

BijectionMap

public BijectionMap(BijectionMap<L,R> copyFrom)
Method Detail

addAll

public void addAll(BijectionMap<L,R> map)

retainAllLeft

public boolean retainAllLeft(java.util.Collection<L> values)

retainAllRight

public boolean retainAllRight(java.util.Collection<R> values)

getEntries

public java.util.Set<java.util.Map.Entry<L,R>> getEntries()

containsLeft

public boolean containsLeft(L leftValue)

containsRight

public boolean containsRight(R rightValue)

contains

public boolean contains(L leftValue,
                        R rightValue)

map

public void map(L leftValue,
                R rightValue)

isEmpty

public boolean isEmpty()

size

public int size()

getLeft

public L getLeft(R rightValue)

getRight

public R getRight(L leftValue)

removeWithLeft

public R removeWithLeft(L leftValue)

removeWithRight

public L removeWithRight(R rightValue)

getLeftSet

public java.util.Set<L> getLeftSet()
Get set of left values

Returns:
read-only set

getRightSet

public java.util.Set<R> getRightSet()
Get set of right values

Returns:
read-only set

getLeftToRightMap

public java.util.Map<L,R> getLeftToRightMap()
Get left-to-right map

Returns:
read only map

getRightToLeftMap

public java.util.Map<R,L> getRightToLeftMap()
Get right-to-left map

Returns:
read only map

clear

public void clear()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public BijectionMap<L,R> clone()
Overrides:
clone in class java.lang.Object