org.encog.ml.prg

## Class EncogProgramVariables

- java.lang.Object
- - org.encog.ml.prg.EncogProgramVariables

- All Implemented Interfaces:
    Serializable

      public class EncogProgramVariables
      extends Object
      implements Serializable

  This class stores the actual variable values for an Encog Program. The definitions for the variables are stored in the context.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EncogProgramVariables()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `defineVariable(VariableMapping mapping)` Define the specified variable mapping.
    `ExpressionValue` | `getVariable(int i)` Get a variable value by index.
    `ExpressionValue` | `getVariable(String name)` Get a variable value by name.
    `int` | `getVariableIndex(String varName)` Get a variable index by name.
    `String` | `getVariableName(int idx)` Get a variable name by index.
    `void` | `setVariable(int index, double value)` Set a variable floating point value by index.
    `void` | `setVariable(String name, double d)` Set a floating point variable value by name.
    `void` | `setVariable(String name, ExpressionValue value)` Set a variable value by name.
    `int` | `size()`
    `boolean` | `variableExists(String name)` Determine if the specified variable name exists.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EncogProgramVariables

          public EncogProgramVariables()

  - ### Method Detail

    - #### defineVariable

          public void defineVariable(VariableMapping mapping)

      Define the specified variable mapping. This is to be used by the context to setup the variable definitions. Do not call it directly. You will have unexpected results if you have a variable defined in this class, but not in the context.
      Parameters:
        `mapping` - The variable mapping.

    - #### getVariable

          public ExpressionValue getVariable(int i)

      Get a variable value by index.
      Parameters:
        `i` - The index of the variable we are using.
      Returns:
        The variable at the specified index.

    - #### getVariable

          public ExpressionValue getVariable(String name)

      Get a variable value by name.
      Parameters:
        `name` - The name of the variable we are using.
      Returns:
        The variable at the specified index.

    - #### getVariableIndex

          public int getVariableIndex(String varName)

      Get a variable index by name.
      Parameters:
        `varName` - The variable name.
      Returns:
        The index of the specified variable.

    - #### getVariableName

          public String getVariableName(int idx)

      Get a variable name by index.
      Parameters:
        `idx` - The variable index.
      Returns:
        The variable name.

    - #### setVariable

          public void setVariable(int index,
                         double value)

      Set a variable floating point value by index.
      Parameters:
        `index` - The index.
        `value` - The value.

    - #### setVariable

          public void setVariable(String name,
                         double d)

      Set a floating point variable value by name.
      Parameters:
        `name` - The name.
        `d` - The value.

    - #### setVariable

          public void setVariable(String name,
                         ExpressionValue value)

      Set a variable value by name.
      Parameters:
        `name` - The variable name.
        `value` - The value.

    - #### size

          public int size()

      Returns:
        Get the number of variables defined.

    - #### variableExists

          public boolean variableExists(String name)

      Determine if the specified variable name exists.
      Parameters:
        `name` - The name of the variable.
      Returns:
        True if the name already exists.

Copyright © 2014. All Rights Reserved.