Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.maloi.evolvo.expressiontree
Class Variable  view Variable download Variable.java

java.lang.Object
  extended byorg.maloi.evolvo.expressiontree.ExpressionTree
      extended byorg.maloi.evolvo.expressiontree.Variable
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Variable
extends ExpressionTree
implements java.lang.Cloneable, java.io.Serializable

Terminal node for expressionTree that stores a variable.


Field Summary
(package private)  java.lang.String name
          The variable's name.
(package private)  int reg
           
(package private)  Value v
          The variable's value.
 
Fields inherited from class org.maloi.evolvo.expressiontree.ExpressionTree
cacheable, cachedValue, operator, params, vp
 
Constructor Summary
Variable()
           
Variable(double p, java.lang.String n)
          Class constructor, sets the value (from a double) and name for this variable.
Variable(Value p, java.lang.String n)
          Class constructor, sets the value (from an value object) and name for this variable.
 
Method Summary
 void buildMachine(org.maloi.evolvo.expressiontree.vm.Machine myMachine)
           
 ExpressionTree getClone()
          Convenience method to retrieve a clone of expressionTree as type expressionTree.
 org.maloi.evolvo.expressiontree.vm.Machine getMachine()
          Builds a simple stack machine to evaluate this expression.
 int getNumParams()
          Returns the number of parameters this node expects.
 ExpressionTree[] getParams()
          Returns the parameters this node is holding.
private  void setName(java.lang.String n)
           
 void setParams(ExpressionTree[] dummy)
          Set this node's parameters.
 void setVariable(double p)
          Sets the variables value from a double.
 java.lang.String toString()
          Returns the variable's name as a String.
 
Methods inherited from class org.maloi.evolvo.expressiontree.ExpressionTree
getName, getOperator, getParamLength, setOperator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

v

Value v
The variable's value.


name

java.lang.String name
The variable's name.


reg

int reg
Constructor Detail

Variable

public Variable(double p,
                java.lang.String n)
Class constructor, sets the value (from a double) and name for this variable.


Variable

public Variable(Value p,
                java.lang.String n)
Class constructor, sets the value (from an value object) and name for this variable.


Variable

public Variable()
Method Detail

getClone

public ExpressionTree getClone()
Description copied from class: ExpressionTree
Convenience method to retrieve a clone of expressionTree as type expressionTree.

Overrides:
getClone in class ExpressionTree

toString

public java.lang.String toString()
Returns the variable's name as a String.

Overrides:
toString in class ExpressionTree

setVariable

public void setVariable(double p)
Sets the variables value from a double.


getNumParams

public int getNumParams()
Returns the number of parameters this node expects.

Overrides:
getNumParams in class ExpressionTree

getParams

public ExpressionTree[] getParams()
Returns the parameters this node is holding.

Overrides:
getParams in class ExpressionTree

setParams

public void setParams(ExpressionTree[] dummy)
Description copied from class: ExpressionTree
Set this node's parameters. Note: Currently does not check that p[] has the correct number of elements. If p[] has too many elements, the extras are simply thrown out. If, however, there are too few, the results are unpredicatable. This behavior should be modified in future versions to be more robust.

Overrides:
setParams in class ExpressionTree

getMachine

public org.maloi.evolvo.expressiontree.vm.Machine getMachine()
Builds a simple stack machine to evaluate this expression. Simply creates a new machine and passes it on to the buildMachine(machine) method.

Overrides:
getMachine in class ExpressionTree

buildMachine

public void buildMachine(org.maloi.evolvo.expressiontree.vm.Machine myMachine)
Overrides:
buildMachine in class ExpressionTree

setName

private void setName(java.lang.String n)