org.apache.uima.internal.util
Class StringToIntMap

java.lang.Object
  extended by org.apache.uima.internal.util.StringToIntMap

public class StringToIntMap
extends java.lang.Object

Straightforward, many-to-one map from Strings to ints, based on a Java HashMap.


Constructor Summary
StringToIntMap()
          Constructor.
 
Method Summary
 boolean containsKey(java.lang.String key)
          Check if the the argument string is defined as a key in this map.
 int get(java.lang.String key)
          Get the value for the key.
 int put(java.lang.String key, int value)
          Add a key-value pair to the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringToIntMap

public StringToIntMap()
Constructor.

See Also:
Object.Object()
Method Detail

containsKey

public boolean containsKey(java.lang.String key)
Check if the the argument string is defined as a key in this map.

Parameters:
key - The string to be looked up.
Returns:
true if a value is defined for this string; false else.
See Also:
Map.containsKey(java.lang.Object)

get

public int get(java.lang.String key)
Get the value for the key.

Parameters:
key - The string to be looked up.
Returns:
The int value for key, or 0 if key is not a key in the map. Use containsKey() to find out if key is actually defined in the map.

put

public int put(java.lang.String key,
               int value)
Add a key-value pair to the map.

Parameters:
key - The string key.
value - The int value.
Returns:
The previous value of key, if it was set. 0 else.


Copyright © 2011. All Rights Reserved.