edu.cmu.sphinx.util
Class StatisticsVariable

java.lang.Object
  extended byedu.cmu.sphinx.util.StatisticsVariable

public class StatisticsVariable
extends java.lang.Object

Represents a named value. A StatisticsVariable may be used to track data in a fashion that will allow the data to be viewed or dumped at any time. Statistics are kept in a pool and are grouped in contexts. Statistics can be dumped as a whole or by context.


Field Summary
 double value
          the value of this StatisticsVariable.
 
Method Summary
 void dump()
          Dumps this StatisticsVariable.
static void dumpAll()
          Dump all of the StatisticsVariable in the given context
 java.lang.String getName()
          Retrieves the name of this StatisticsVariable
static StatisticsVariable getStatisticsVariable(java.lang.String statName)
          Gets the StatisticsVariable with the given name from the given context.
static StatisticsVariable getStatisticsVariable(java.lang.String instanceName, java.lang.String statName)
          Gets the StatisticsVariable with the given name for the given instance and context.
 double getValue()
          Retrieves the value for this StatisticsVariable
 boolean isEnabled()
          Determines if this StatisticsVariable is enabled
static void main(java.lang.String[] args)
          Some simple tests for the StatisticsVariable
 void reset()
          Resets this StatisticsVariable.
static void resetAll()
          Resets all of the StatisticsVariables in the given context
 void setEnabled(boolean enabled)
          Sets the enabled state of this StatisticsVariable
 void setValue(double value)
          Sets the value for this StatisticsVariable
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

public double value
the value of this StatisticsVariable. It can be manipulated directly by the application.

Method Detail

getStatisticsVariable

public static StatisticsVariable getStatisticsVariable(java.lang.String statName)
Gets the StatisticsVariable with the given name from the given context. If the statistic does not currently exist, it is created. If the context does not currently exist, it is created.

Parameters:
statName - the name of the StatisticsVariable
Returns:
the StatisticsVariable with the given name and context

getStatisticsVariable

public static StatisticsVariable getStatisticsVariable(java.lang.String instanceName,
                                                       java.lang.String statName)
Gets the StatisticsVariable with the given name for the given instance and context. This is a convenience function.

Parameters:
instanceName - the instance name of creator
statName - the name of the StatisticsVariable

dumpAll

public static void dumpAll()
Dump all of the StatisticsVariable in the given context


resetAll

public static void resetAll()
Resets all of the StatisticsVariables in the given context


getName

public java.lang.String getName()
Retrieves the name of this StatisticsVariable

Returns:
the name of this StatisticsVariable

getValue

public double getValue()
Retrieves the value for this StatisticsVariable

Returns:
the current value for this StatisticsVariable

setValue

public void setValue(double value)
Sets the value for this StatisticsVariable

Parameters:
value - the new value

reset

public void reset()
Resets this StatisticsVariable. The value is set to zero.


dump

public void dump()
Dumps this StatisticsVariable.


isEnabled

public boolean isEnabled()
Determines if this StatisticsVariable is enabled

Returns:
true if enabled

setEnabled

public void setEnabled(boolean enabled)
Sets the enabled state of this StatisticsVariable

Parameters:
enabled - the new enabled state

main

public static void main(java.lang.String[] args)
Some simple tests for the StatisticsVariable