geneticWedge.gp
Class Constant

java.lang.Object
  extended by geneticWedge.gp.Component
      extended by geneticWedge.gp.Terminal
          extended by geneticWedge.gp.Constant

public class Constant
extends Terminal

Constant is a type of terminal within a GP subtree. It always outputs the same value.


Constructor Summary
Constant(double val)
          The constructor sets the value of a Constant.
 
Method Summary
 boolean equals(Constant comparison)
          Returns true if this Constant has the same numerical value as the comparison object.
 double getValue()
          Returns the value output by this Constant object.
 java.lang.String toString()
          A Component must have a toString() method that allows an Individual to construct a String representation of its components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Constant

public Constant(double val)
The constructor sets the value of a Constant. It cannot be changed once it has been set.

Method Detail

getValue

public double getValue()
Returns the value output by this Constant object.

Overrides:
getValue in class Terminal

toString

public java.lang.String toString()
Description copied from class: Component
A Component must have a toString() method that allows an Individual to construct a String representation of its components.

Specified by:
toString in class Component

equals

public boolean equals(Constant comparison)
Returns true if this Constant has the same numerical value as the comparison object.