com.isti.quakewatch.util
Class DomainTypeInfoTable

java.lang.Object
  extended by com.isti.quakewatch.util.DomainTypeInfoTable

public class DomainTypeInfoTable
extends java.lang.Object

Class DomainTypeInfoTable manages a table of information records, each containing a message-number value associated with an event domain and type name.


Field Summary
protected  FifoHashtable hashtableObj
           
protected static char TABLE_KEY_SEPCHAR
           
protected static java.lang.String TABLEKEY_SPECIAL_CHARS
           
 
Constructor Summary
DomainTypeInfoTable()
           
 
Method Summary
static java.lang.String buildTableKeyStr(java.lang.String domainStr, java.lang.String typeStr)
          Creates a table-key string containing the given domain and type name strings.
 void clear()
          Clears the table.
 DomainTypeInfoRec getInfoRecObj(java.lang.String domainStr, java.lang.String typeStr)
          Returns the information-record object associated with the given event domain and type names.
 long getMessageNumberValue(java.lang.String domainStr, java.lang.String typeStr)
          Returns the current message-number value associated with the given event domain and type names.
 java.lang.Object getThreadSyncObj()
          Returns the thread-synchronization object for the table.
 void setMessageNumberValue(java.lang.String domainStr, java.lang.String typeStr, long msgNum)
          Sets the current message-number value associated with the given event domain and type names.
 java.util.Collection values()
          Returns a read-only collection view of the 'DomainTypeInfoRec' objects contained in this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashtableObj

protected final FifoHashtable hashtableObj

TABLE_KEY_SEPCHAR

protected static final char TABLE_KEY_SEPCHAR
See Also:
Constant Field Values

TABLEKEY_SPECIAL_CHARS

protected static final java.lang.String TABLEKEY_SPECIAL_CHARS
See Also:
Constant Field Values
Constructor Detail

DomainTypeInfoTable

public DomainTypeInfoTable()
Method Detail

setMessageNumberValue

public void setMessageNumberValue(java.lang.String domainStr,
                                  java.lang.String typeStr,
                                  long msgNum)
Sets the current message-number value associated with the given event domain and type names.

Parameters:
domainStr - the domain name to use.
typeStr - the type name to use.
msgNum - the mesage-number value to use.

getInfoRecObj

public DomainTypeInfoRec getInfoRecObj(java.lang.String domainStr,
                                       java.lang.String typeStr)
Returns the information-record object associated with the given event domain and type names. If a matching record does not exist in the table then a new one (with its message-number value set to zero) is created, added to the table and returned.

Parameters:
domainStr - the domain name to use.
typeStr - the type name to use.
Returns:
The 'DomainTypeInfoRec' object from the table associated with the given event domain and type names.

getMessageNumberValue

public long getMessageNumberValue(java.lang.String domainStr,
                                  java.lang.String typeStr)
Returns the current message-number value associated with the given event domain and type names.

Parameters:
domainStr - the domain name to use.
typeStr - the type name to use.
Returns:
The current message-number value associated with the given event domain and type names, or 0 if no entry matching the given event domain and type names exists in the table.

values

public java.util.Collection values()
Returns a read-only collection view of the 'DomainTypeInfoRec' objects contained in this table. The collection does not support any add or remove operations. The 'values().iterator()' method may be used to iterate over the values in this table (as long as the table is not modified between iterations).

Returns:
A collection view of the 'DomainTypeInfoRec' objects contained in this table

clear

public void clear()
Clears the table.


getThreadSyncObj

public java.lang.Object getThreadSyncObj()
Returns the thread-synchronization object for the table.

Returns:
The thread-synchronization object for the table.

buildTableKeyStr

public static java.lang.String buildTableKeyStr(java.lang.String domainStr,
                                                java.lang.String typeStr)
Creates a table-key string containing the given domain and type name strings. Instances of ':' and other special characters in the given strings will be "quoted" by inserting a backslash ('\') in front of them.

Parameters:
domainStr - the domain name to use.
typeStr - the type name to use.
Returns:
A new table-key string.