ac.essex.ooechs.ecj.ecj2java.example.terminals
Class Number

java.lang.Object
  extended by ec.gp.GPNode
      extended by ec.gp.ERC
          extended by ac.essex.ooechs.ecj.ecj2java.nodes.ParseableERC
              extended by ac.essex.ooechs.ecj.ecj2java.example.terminals.Number
All Implemented Interfaces:
ParseableNode, ec.gp.GPNodeParent, ec.Prototype, ec.Setup, java.io.Serializable, java.lang.Cloneable

public class Number
extends ParseableERC

This is a simple ERC class that returns a number in the range -5 to 5. It is an extension of the parseableERC class which demands it implement two methods - setNumber() and name(), the former to choose which random numbers it wants, and the second to provide it with a unique name for ECJ to use.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version, provided that any use properly credits the author. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at http://www.gnu.org

Version:
1.0
Author:
Olly Oechsle, University of Essex, Date: 06-Sep-2006
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ac.essex.ooechs.ecj.ecj2java.nodes.ParseableERC
type, value
 
Fields inherited from class ec.gp.ERC
ERC_PREFIX
 
Fields inherited from class ec.gp.GPNode
argposition, children, constraints, GPNODEPRINTTAB, MAXPRINTBYTES, NODESEARCH_ALL, NODESEARCH_CUSTOM, NODESEARCH_NONTERMINALS, NODESEARCH_TERMINALS, P_NODE, P_NODECONSTRAINTS, parent, REPLACEMENT_CHAR, SITUATION_MUTATION, SITUATION_NEWIND
 
Fields inherited from interface ac.essex.ooechs.ecj.ecj2java.nodes.ParseableNode
BOOLEAN, DOUBLE, ERC, FUNCTION, INT, RETURN, VOID
 
Constructor Summary
Number()
           
 
Method Summary
 int getObjectType()
          The kind of object this is, eg int, double, etc.
 java.lang.String name()
          The name of the class that ECK uses.
 double setNumber(ec.EvolutionState state, int thread)
          Set the value of the ERC here
 
Methods inherited from class ac.essex.ooechs.ecj.ecj2java.nodes.ParseableERC
countChildren, decode, encode, eval, getChild, getJavaCode, getLineComment, getType, getValue, getVariableName, mutateERC, nodeEquals, nodeHashCode, readNode, resetNode, setType, setValue, setVariableName, toStringForHumans, writeNode
 
Methods inherited from class ec.gp.ERC
checkConstraints, readNode, toString
 
Methods inherited from class ec.gp.GPNode
atDepth, cloneReplacing, cloneReplacing, cloneReplacing, cloneReplacingAtomic, cloneReplacingAtomic, cloneReplacingAtomicSimple, cloneReplacingAtomicSimple, cloneReplacingNoSubclone, cloneReplacingNoSubcloneSimple, cloneReplacingSimple, cloneReplacingSimple, cloneReplacingSimple, constraints, contains, defaultBase, depth, errorInfo, makeCTree, makeLatexTree, nodeEquivalentTo, nodeInPosition, numNodes, numNodes, parentType, printNode, printNode, printNodeForHumans, printRootedTree, printRootedTree, printRootedTreeForHumans, protoClone, protoCloneSimple, readRootedTree, readRootedTree, replaceWith, rootedTreeEquals, rootedTreeHashCode, rootParent, setup, swapCompatibleWith, toStringForError, writeRootedTree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Number

public Number()
Method Detail

setNumber

public double setNumber(ec.EvolutionState state,
                        int thread)
Description copied from class: ParseableERC
Set the value of the ERC here

Specified by:
setNumber in class ParseableERC

getObjectType

public int getObjectType()
Description copied from interface: ParseableNode
The kind of object this is, eg int, double, etc.


name

public java.lang.String name()
Description copied from class: ParseableERC
The name of the class that ECK uses.

Specified by:
name in class ParseableERC