Class StatsHelper

  • All Implemented Interfaces:
    java.io.Serializable, VariableDeclarations

    public class StatsHelper
    extends java.lang.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:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Node getVariable​(java.lang.String name)
      Tries to fetch a Stats field
      boolean hasVariable​(java.lang.String name)
      Returns whether the variable is declared
      void setStats​(Stats stats)
      Sets the corresponding Stats object
      boolean used()
      Whether Stats fields are accessed in the program
      boolean used​(java.lang.String name)
      Returns whether the Stats field is used in the program
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StatsHelper

        public StatsHelper()
        Construct a StatsHelper
    • Method Detail

      • 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​(java.lang.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​(java.lang.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​(java.lang.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