VarDouble (JEvolution)
Date: 2013-03-21

evSOLve.JEvolution.gp.nodes

## Class VarDouble

- java.lang.Object
- - evSOLve.JEvolution.gp.ProgramNode
  - - evSOLve.JEvolution.gp.nodes.VarDouble

- All Implemented Interfaces:
    java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

      public class VarDouble
      extends ProgramNode

- - ### Field Summary

    - ### Fields inherited from class evSOLve.JEvolution.gp.ProgramNode

      `children, parent, TYPE_BOOLEAN, TYPE_DOUBLE, TYPE_INT, TYPE_UNDEFINED, values`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VarDouble()` Constructs the variable.
    `VarDouble(Element n)` Creates the variable via XML.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `eval()` Returns the value of the variable.
    `int` | `getResultType()` Returns the result type Double.
    `java.lang.String` | `getSignature()` Returns the string signature of the node.
    `void` | `mutate()` Is randomize().
    `void` | `randomize()` Assigns a random variable index, e.
    `java.lang.String` | `toString()` Returns the string representation of the node.
    `Element` | `toXml(Element parent)` Saves the variable to XML.

    - ### Methods inherited from class evSOLve.JEvolution.gp.ProgramNode

      `addValue, children, clearValues, clone, create, equals, getAllowsChildren, getChildAt, getChildCount, getIndex, getLevel, getOperandType, getParent, hashCode, insert, isLeaf, remove, remove, removeFromParent, setParent, setUserObject`

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

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### VarDouble

          public VarDouble()

      Constructs the variable.

    - #### VarDouble

          public VarDouble(Element n)

      Creates the variable via XML.
      Parameters:
        `n` - an XML node element

  - ### Method Detail

    - #### getResultType

          public int getResultType()

      Returns the result type Double.
      Specified by:
        `getResultType` in class `ProgramNode`
      Returns:
        TYPE_DOUBLE

    - #### eval

          public java.lang.Object eval()

      Returns the value of the variable. Node mutation is done here, as it has to be deferred, because the number of variables is only known, when the program tree is evaluated.
      Specified by:
        `eval` in class `ProgramNode`
      Returns:
        the value as Double

    - #### randomize

          public void randomize()

      Assigns a random variable index, e. g., 'x' becomes 'y'.
      Overrides:
        `randomize` in class `ProgramNode`

    - #### mutate

          public void mutate()

      Is randomize().
      Overrides:
        `mutate` in class `ProgramNode`

    - #### toXml

          public Element toXml(Element parent)

      Saves the variable to XML.
      Overrides:
        `toXml` in class `ProgramNode`
      Parameters:
        `parent` - the JDOM parent element
      Returns:
        the Node element

    - #### getSignature

          public java.lang.String getSignature()

      Returns the string signature of the node.
      Specified by:
        `getSignature` in class `ProgramNode`
      Returns:
        the node's signature

    - #### toString

          public java.lang.String toString()

      Returns the string representation of the node.
      Specified by:
        `toString` in class `ProgramNode`
      Returns:
        the node's string representation