Class StatsHelper

java.lang.Object
weka.core.expressionlanguage.weka.StatsHelper
All Implemented Interfaces:
Serializable, VariableDeclarations

public class StatsHelper extends Object implements VariableDeclarations
A helper class to expose a Stats object to a program

Exposes the following variables that correspond to Stats' fields:
  • MAX
  • MIN
  • MEAN
  • SD
  • COUNT
  • SUM
  • SUMSQUARED
Version:
$Revision: 1000 $
Author:
Benjamin Weber ( benweber at student dot ethz dot ch )
See Also:
  • Constructor Details

    • StatsHelper

      public StatsHelper()
      Construct a StatsHelper
  • Method Details

    • setStats

      public void setStats(Stats stats)
      Sets the corresponding Stats object
      Parameters:
      stats - the Stats object whose fields should be exposed
    • used

      public boolean used()
      Whether Stats fields are accessed in the program

      This is only meaningful after compilation.
      Returns:
      Whether Stats fields are accessed in the program
    • used

      public boolean used(String name)
      Returns whether the Stats field is used in the program

      Must be one of the exposed variables.

      This is only meaningful after compilation.
      Parameters:
      name - The name of the variable of the Stats field
      Returns:
      whether the Stats field is used in the program
    • hasVariable

      public boolean hasVariable(String name)
      Returns whether the variable is declared
      Specified by:
      hasVariable in interface VariableDeclarations
      Parameters:
      name - name of the variable
      Returns:
      whether the variable has been declared
    • getVariable

      public Node getVariable(String name)
      Tries to fetch a Stats field

      The same invariant of VariableDeclaration applies here too.
      Specified by:
      getVariable in interface VariableDeclarations
      Parameters:
      name - name of the variable
      Returns:
      node representing the Stats field