com.realtime.crossfire.jxclient.util
Class DoubleMapping

java.lang.Object
  extended by com.realtime.crossfire.jxclient.util.DoubleMapping

public class DoubleMapping
extends java.lang.Object

Maintains a bidirectional mapping from a set of integers to the same range of integers.


Field Summary
private  Mapping backward
          The backward mappings.
private  Mapping forward
          The forward mappings.
 
Constructor Summary
DoubleMapping()
           
 
Method Summary
 void clear()
          Removes all mappings.
 int getDst(int src)
          Returns a mapping.
 int getSrc(int dst)
          Returns a mapping.
 void insert(int src, int dst)
          Adds a mapping.
 void remove(int src)
          Removes a mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backward

@NotNull
private final Mapping backward
The backward mappings. Maps destination index to source index.


forward

@NotNull
private final Mapping forward
The forward mappings. Maps source index to destination index.

Constructor Detail

DoubleMapping

public DoubleMapping()
Method Detail

clear

public void clear()
Removes all mappings.


getDst

public int getDst(int src)
Returns a mapping.

Parameters:
src - the source index
Returns:
the destination index

getSrc

public int getSrc(int dst)
Returns a mapping.

Parameters:
dst - the destination index
Returns:
the source index

insert

public void insert(int src,
                   int dst)
Adds a mapping.

Parameters:
src - the source index
dst - the destination index

remove

public void remove(int src)
Removes a mapping.

Parameters:
src - the source index