com.isti.util
Class TagValueTable

java.lang.Object
  extended bycom.isti.util.TagValueTable

public class TagValueTable
extends java.lang.Object

Class TagValueTable defines a table where each entry contains a a tag string and a mutable integer value.


Nested Class Summary
static class TagValueTable.MutableLong
          Class MutableLong defines a long integer value that may be modified.
 
Field Summary
protected  FifoHashtable hashTableObj
           
 
Constructor Summary
  TagValueTable()
          Creates a tag-value table.
protected TagValueTable(FifoHashtable hashTableObj)
          Protected constructor for 'entriesListStrToTable()' method.
 
Method Summary
 java.lang.Object clone()
          Creates a shallow copy of the table.
static TagValueTable entriesListStrToTable(java.lang.String listStr)
          Creates a tag-value table from the given list string.
 long get(java.lang.String tagStr)
          Returns the value for the given tag string.
 java.lang.String getEntriesListStr()
          Returns a data list string of the entries contained in the table.
 java.lang.Long getLong(java.lang.String tagStr)
          Returns the value for the given tag string.
 TagValueTable.MutableLong getMutableLong(java.lang.String tagStr)
          Returns the value for the given tag string.
 int getNumEntries()
          Returns the number of entries in the table.
 void put(java.lang.String tagStr, long value)
          Sets the value for the given tag string.
 TagValueTable.MutableLong remove(java.lang.String tagStr)
          Removes the table entry for the given tag string.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashTableObj

protected final FifoHashtable hashTableObj
Constructor Detail

TagValueTable

public TagValueTable()
Creates a tag-value table.


TagValueTable

protected TagValueTable(FifoHashtable hashTableObj)
Protected constructor for 'entriesListStrToTable()' method.

Parameters:
hashTableObj - table object to use.
Method Detail

put

public void put(java.lang.String tagStr,
                long value)
Sets the value for the given tag string. If the tag string has a previous value then it will be overwritten.

Parameters:
tagStr - the tag string to use.
value - the value to use.

get

public long get(java.lang.String tagStr)
Returns the value for the given tag string.

Parameters:
tagStr - the tag string to use.
Returns:
The value for the tag string, or 0 if no value is set for the tag string.

getLong

public java.lang.Long getLong(java.lang.String tagStr)
Returns the value for the given tag string.

Parameters:
tagStr - the tag string to use.
Returns:
A 'Long' object containing the value for the tag string, or null if no value is set for the tag string.

getMutableLong

public TagValueTable.MutableLong getMutableLong(java.lang.String tagStr)
Returns the value for the given tag string.

Parameters:
tagStr - the tag string to use.
Returns:
A 'MutableLong' object containing the value for the tag string, or null if no value is set for the tag string.

remove

public TagValueTable.MutableLong remove(java.lang.String tagStr)
Removes the table entry for the given tag string.

Parameters:
tagStr - the tag string for the entry to be removed.
Returns:
A 'MutableLong' object containing the value for the tag string, or null if no value is set for the tag string.

getNumEntries

public int getNumEntries()
Returns the number of entries in the table.

Returns:
The number of entries in the table.

clone

public java.lang.Object clone()
Creates a shallow copy of the table. All the structure of the table itself is copied, but the keys and values are not cloned.

Returns:
A new 'TagValueTable' object cloned from the table.

getEntriesListStr

public java.lang.String getEntriesListStr()
Returns a data list string of the entries contained in the table. If the table contains no entries then an empty string is returned.

Returns:
A list string in the form: "tag"=value,...

entriesListStrToTable

public static TagValueTable entriesListStrToTable(java.lang.String listStr)
Creates a tag-value table from the given list string.

Parameters:
listStr - a list string in the form: "tag"=value,...
Returns:
A new 'TagValueTable' object, or null if the string could not be successfully parsed.