data
Class StringToIntMapper

java.lang.Object
  extended by data.StringToIntMapper

public class StringToIntMapper
extends Object

Maps strings to integers. Same strings will always return the same integer values, the mapping is case-insensitive.

Author:
Jan Krumsiek

Constructor Summary
StringToIntMapper()
          Creates a new string to int mapper.
 
Method Summary
 int getIntID(String str)
          Gets the integer ID for a given string
 int getItemCount()
          Returns the number of registered strings in this mapper.
 String getStringID(int protID)
          Returns the string associated with an integer ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringToIntMapper

public StringToIntMapper()
Creates a new string to int mapper.

Method Detail

getIntID

public int getIntID(String str)
Gets the integer ID for a given string

Parameters:
str - string to be mapped
Returns:
integer ID for that string

getStringID

public String getStringID(int protID)
Returns the string associated with an integer ID.

Parameters:
protID -
Returns:
associated string or null if this ID not used yet.

getItemCount

public int getItemCount()
Returns the number of registered strings in this mapper.

Returns:
number of mapped strings