O2Plib.misc
Class ParamHash

java.lang.Object
  extended by O2Plib.misc.ParamHash

public class ParamHash
extends java.lang.Object


Field Summary
 java.util.Hashtable curHT
          Current hash table of values read
static java.lang.String errMsg
          error code string if an error occurred, else null
 int nEntries
          # of hash table entries after call readNameValuesHashTableFromFile()
 int nStateEntries
          # of hash table entries
 
Constructor Summary
ParamHash()
          ParamHash() - Constructor
 
Method Summary
 boolean getStateValue(java.lang.String key, boolean def)
          getStateValue() - get boolean PARAM and use default if not found.
 float getStateValue(java.lang.String key, float def)
          getStateValue() - get float PARAM and use default if not found.
 int getStateValue(java.lang.String key, int def)
          getStateValue() - get int PARAM and use default if not found.
 long getStateValue(java.lang.String key, long def)
          getStateValue() - get float PARAM and use default if not found.
 short getStateValue(java.lang.String key, short def)
          getStateValue() - get short PARAM and use default if not found.
 java.lang.String getStateValue(java.lang.String key, java.lang.String def)
          getStateValue() - get PARAM and use default if not found or the value is "null" string.
 java.util.Hashtable readNameValuesHashTableFromFile(java.lang.String fileName, java.lang.String sMsg, int hashTableSize)
          readNameValuesHashTableFromFile() - read a hashtable of tab-delimited name-value pairs from a file.
 java.util.Hashtable readNameValuesHashTableFromFile(java.lang.String fileName, java.lang.String sMsg, int hashTableSize, boolean usePopupAlertsFlag)
          readNameValuesHashTableFromFile() - read a hashtable of tab-delimited name-value pairs from a file.
static java.util.Hashtable readPropFileToHashtable(java.lang.String propFile)
          readPropFileToHashtable() - read the property file to a hash table
 void setStateHashtableForGetValue(java.util.Hashtable ht)
          setStateHashtableForGetValue() - set working hash table for next getStateValue calls
 void setStateHashtableForGetValue(java.util.Hashtable ht, int nEntriesVal)
          setStateHashtableForGetValue() - set working hash table for next getStateValue calls
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

curHT

public java.util.Hashtable curHT
Current hash table of values read


nStateEntries

public int nStateEntries
# of hash table entries


nEntries

public int nEntries
# of hash table entries after call readNameValuesHashTableFromFile()


errMsg

public static java.lang.String errMsg
error code string if an error occurred, else null

Constructor Detail

ParamHash

public ParamHash()
ParamHash() - Constructor

Method Detail

readPropFileToHashtable

public static java.util.Hashtable readPropFileToHashtable(java.lang.String propFile)
readPropFileToHashtable() - read the property file to a hash table

Parameters:
stateFile - is the name of the ProtPlot state file
Returns:
hashtable if succeed else null if not found.

readNameValuesHashTableFromFile

public java.util.Hashtable readNameValuesHashTableFromFile(java.lang.String fileName,
                                                           java.lang.String sMsg,
                                                           int hashTableSize)
readNameValuesHashTableFromFile() - read a hashtable of tab-delimited name-value pairs from a file. Convert the (name\tvalue\n) data to a hashtable. Allow popup error messages.

Parameters:
fileName - is the name of the file to read
sMsg - to print when reading the file.
Returns:
hashtable else null if not found. The global variable nEntries contains the number of entries.

readNameValuesHashTableFromFile

public java.util.Hashtable readNameValuesHashTableFromFile(java.lang.String fileName,
                                                           java.lang.String sMsg,
                                                           int hashTableSize,
                                                           boolean usePopupAlertsFlag)
readNameValuesHashTableFromFile() - read a hashtable of tab-delimited name-value pairs from a file. Convert the (name\tvalue\n) data to a hashtable.

Parameters:
fileName - is the name of the file to read
sMsg - to print when reading the file.
usePopupAlertsFlag - if allow popup error messages
Returns:
hashtable else null if not found. The global variable nEntries contains the number of entries.

setStateHashtableForGetValue

public void setStateHashtableForGetValue(java.util.Hashtable ht,
                                         int nEntriesVal)
setStateHashtableForGetValue() - set working hash table for next getStateValue calls

Parameters:
ht - is hashtable to use
nEntriesVal - is the number of elements used in the hash table.

setStateHashtableForGetValue

public void setStateHashtableForGetValue(java.util.Hashtable ht)
setStateHashtableForGetValue() - set working hash table for next getStateValue calls

Parameters:
ht - is hashtable to use

getStateValue

public java.lang.String getStateValue(java.lang.String key,
                                      java.lang.String def)
getStateValue() - get PARAM and use default if not found or the value is "null" string.

Parameters:
key -
def - is the default value if not found or has value "null"
Returns:
value in hash table

getStateValue

public int getStateValue(java.lang.String key,
                         int def)
getStateValue() - get int PARAM and use default if not found.


getStateValue

public short getStateValue(java.lang.String key,
                           short def)
getStateValue() - get short PARAM and use default if not found.


getStateValue

public long getStateValue(java.lang.String key,
                          long def)
getStateValue() - get float PARAM and use default if not found.


getStateValue

public float getStateValue(java.lang.String key,
                           float def)
getStateValue() - get float PARAM and use default if not found.


getStateValue

public boolean getStateValue(java.lang.String key,
                             boolean def)
getStateValue() - get boolean PARAM and use default if not found.