cnrg.itx.datax
Class Stats

java.lang.Object
  |
  +--cnrg.itx.datax.Stats

public class Stats
extends java.lang.Object

Class to represent statistics. The Statistics are in the form of a pair and can be set & looked up this way.


Constructor Summary
Stats()
          Default constructor for the statistics object.
 
Method Summary
 void addStat(java.lang.String key, java.lang.Object value)
          Add a new stat.
 void clearStats()
          Removes all stats from the database.
 java.lang.Object getStat(java.lang.String key)
          Finds the value of a stat.
 Stats merge(Stats s)
          Takes a stats object and merges it with the current object.
 java.util.Enumeration statKeys()
          Returns an enumeration (of strings) of the various stat names that are in the Stats object.
 java.lang.String toString()
          Method to get a string form of the statistics.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Stats

public Stats()
Default constructor for the statistics object.
Method Detail

addStat

public void addStat(java.lang.String key,
                    java.lang.Object value)
Add a new stat. if the string name is already in use, it will overwrite the old value.
Parameters:
key - lookup name
value - The key's value

getStat

public java.lang.Object getStat(java.lang.String key)
Finds the value of a stat.
Parameters:
key - The loookup name
Returns:
The result of the lookup. null if the key is not a valid key.

statKeys

public java.util.Enumeration statKeys()
Returns an enumeration (of strings) of the various stat names that are in the Stats object.
Returns:
Enumeration of the Strings in the keys.

clearStats

public void clearStats()
Removes all stats from the database.

merge

public Stats merge(Stats s)
Takes a stats object and merges it with the current object. Note: The current object is changed by adding the pairs of the second object.

Parameters:
s - Stats object to merge with.
Returns:
The new stats object.

toString

public java.lang.String toString()
Method to get a string form of the statistics.
Returns:
String the string version of the statistics
Overrides:
toString in class java.lang.Object