org.encog.ml.prg
Class EncogProgramVariables
- java.lang.Object
-
- org.encog.ml.prg.EncogProgramVariables
-
- All Implemented Interfaces:
- java.io.Serializable
public class EncogProgramVariables extends java.lang.Object implements java.io.SerializableThis 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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddefineVariable(VariableMapping mapping)Define the specified variable mapping.ExpressionValuegetVariable(int i)Get a variable value by index.ExpressionValuegetVariable(java.lang.String name)Get a variable value by name.intgetVariableIndex(java.lang.String varName)Get a variable index by name.java.lang.StringgetVariableName(int idx)Get a variable name by index.voidsetVariable(int index, double value)Set a variable floating point value by index.voidsetVariable(java.lang.String name, double d)Set a floating point variable value by name.voidsetVariable(java.lang.String name, ExpressionValue value)Set a variable value by name.intsize()booleanvariableExists(java.lang.String name)Determine if the specified variable name exists.
-
-
-
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(java.lang.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(java.lang.String varName)
Get a variable index by name.- Parameters:
varName- The variable name.- Returns:
- The index of the specified variable.
-
getVariableName
public java.lang.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(java.lang.String name, double d)Set a floating point variable value by name.- Parameters:
name- The name.d- The value.
-
setVariable
public void setVariable(java.lang.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(java.lang.String name)
Determine if the specified variable name exists.- Parameters:
name- The name of the variable.- Returns:
- True if the name already exists.
-
-
DMelt 3.0 © DataMelt by jWork.ORG