Class SimpleVariableDeclarations.VariableInitializer

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    SimpleVariableDeclarations

    public static class SimpleVariableDeclarations.VariableInitializer
    extends java.lang.Object
    implements java.io.Serializable
    A class to initialize variables that have been declared by a SimpleVariableDeclarations class and used inside a program

    Note that not all variables declared can be initialized!
    Particularly variables that have been declared but are never used inside a program can't be initialized.

    Then variable values that are expensive to compute don't have to be computed if the values are never used inside a program.
    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
      java.util.Set<java.lang.String> getVariables()
      Returns the set of variable names that can be initialized
      boolean hasVariable​(java.lang.String variable)
      Returns whether the SimpleVariableDeclarations.VariableInitializer contains the variable
      void setBoolean​(java.lang.String name, boolean value)
      Sets the value of a boolean variable
      void setDouble​(java.lang.String name, double value)
      Sets the value of a double variable
      void setString​(java.lang.String name, java.lang.String value)
      Sets the value of a string variable
      • Methods inherited from class java.lang.Object

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

      • VariableInitializer

        public VariableInitializer()
    • Method Detail

      • getVariables

        public java.util.Set<java.lang.String> getVariables()
        Returns the set of variable names that can be initialized
        Returns:
        the set of variable names that can be initialized
      • hasVariable

        public boolean hasVariable​(java.lang.String variable)
        Returns whether the SimpleVariableDeclarations.VariableInitializer contains the variable

        Parameters:
        variable - name of the variable
        Returns:
        whether the variable exists
      • setBoolean

        public void setBoolean​(java.lang.String name,
                               boolean value)
        Sets the value of a boolean variable

        Requires that the variable exists and is of boolean type.
        Parameters:
        name - name of the boolean variable
        value - the value the boolean variable will be set to
      • setDouble

        public void setDouble​(java.lang.String name,
                              double value)
        Sets the value of a double variable

        Requires that the variable exists and is of double type.
        Parameters:
        name - the name of the double variable
        value - the value the double variable will be set to
      • setString

        public void setString​(java.lang.String name,
                              java.lang.String value)
        Sets the value of a string variable

        Requires that the variable exists and is of string type.
        Parameters:
        name - the name of the string variable
        value - the value the string variable will be set to