com.novell.util
Class StringCache

java.lang.Object
  extended bycom.novell.util.StringCache

public class StringCache
extends Object

A class to cache strings and equate them with unique integers to allow fast comparisons for equality, etc.


Constructor Summary
StringCache()
          Construct a StringCache with default Map implementation and default string cache initial size
StringCache(int cacheSize)
          Construct a StringCache with default Map implementation and passed string cache initial size
StringCache(Map mapImpl, int cacheSize)
          Construct a StringCache with passed Map implementation and passed default string cache initial size
 
Method Summary
 int getNumber(String str)
          Get the unique number given a string
 String getString(int number)
          Get the string that corresponds to a number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringCache

public StringCache()
Construct a StringCache with default Map implementation and default string cache initial size


StringCache

public StringCache(int cacheSize)
Construct a StringCache with default Map implementation and passed string cache initial size

Parameters:
cacheSize - The initial cache size for the String cache

StringCache

public StringCache(Map mapImpl,
                   int cacheSize)
Construct a StringCache with passed Map implementation and passed default string cache initial size

Parameters:
mapImpl - An Object that implements the Map interface, used to map Strings to integers.
cacheSize - The initial cache size for the String cache
Method Detail

getNumber

public int getNumber(String str)
Get the unique number given a string

Parameters:
str - The string for which to get the number
Returns:
The number that corresponds to the string

getString

public String getString(int number)
Get the string that corresponds to a number

Parameters:
number - The number for which to get the uri string
Returns:
The uri string corresponding to the passed number, or null if no uri has been associated with the number