calypso.util
Class IDMap

java.lang.Object
  |
  +--calypso.util.IDMap

public class IDMap
extends java.lang.Object

An identifier mapper. This provides a 1-1 map between strings and integers where the strings are unique within the map.


Constructor Summary
IDMap()
           
 
Method Summary
 java.lang.String idToString(int aID)
          Given an id, return the string it maps to.
 int stringBufToID(StringBuf aStrBuf)
          Given a StringBuf, find an id for it.
 java.lang.String stringBufToString(StringBuf aStrBuf)
           
 int stringToID(java.lang.String aStr)
          Given a string, find an id for it.
 java.lang.String stringToString(java.lang.String aStr)
          If the argument string is already present in the map return the original string object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDMap

public IDMap()
Method Detail

stringToID

public int stringToID(java.lang.String aStr)
Given a string, find an id for it. If the string is already present return the old id. Otherwise allocate a new one.

stringBufToID

public int stringBufToID(StringBuf aStrBuf)
Given a StringBuf, find an id for it. If the string is already present return the old id. Otherwise allocate a new one.

stringBufToString

public java.lang.String stringBufToString(StringBuf aStrBuf)

stringToString

public java.lang.String stringToString(java.lang.String aStr)
If the argument string is already present in the map return the original string object. Otherwise, allocate a new id and return the argument string.

idToString

public java.lang.String idToString(int aID)
Given an id, return the string it maps to.