|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectec.gp.GPNode
ac.essex.ooechs.ecj.ecj2java.nodes.ParseableGPNode
public abstract class ParseableGPNode
An abstract class which allows us to save a node and run it again at a later time. It is able to interface the GP node class with the parseableNode class. The only code that your GP code needs to make is to add the "getJavaCode()" function to your class and implement this abstract class.
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
| Field Summary | |
|---|---|
(package private) int |
numChildren
The amount of children this node is SUPPOSED to have |
(package private) java.lang.String |
text
The name of this node - text is used by the GPNode's toString function |
(package private) int |
type
The type of node - Terminal, Function or ERC - used by the JavaWriter |
(package private) java.lang.String |
variableName
|
| 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 | |
|---|---|
ParseableGPNode(java.lang.String text,
int numChildren)
Initialises the GP node and sets the type as a function. |
|
ParseableGPNode(java.lang.String text,
int numChildren,
int type)
|
|
| Method Summary | |
|---|---|
void |
checkConstraints(ec.EvolutionState state,
int tree,
ec.gp.GPIndividual typicalIndividual,
ec.util.Parameter individualBase)
|
int |
countChildren()
Returns how many children this node has |
ParseableNode |
getChild(int index)
Gets the child of this node at a given index. |
java.lang.String |
getEndJavaCode()
|
abstract java.lang.String |
getJavaCode()
Returns a string representation of the java statement represented by this node. |
java.lang.String |
getLineComment()
There may be a line comment associated with this piece of code. |
abstract int |
getObjectType()
The kind of object this is, eg int, double, etc. |
int |
getType()
Returns what kind of node this is. |
java.lang.String |
getValue()
|
java.lang.String |
getVariableName()
When the java writer uses this node, it may use a variable name to describe it. |
void |
setType(int type)
Set the node type |
void |
setVariableName(java.lang.String name)
Attaches a variable name to this node, used by JavaWriter |
java.lang.String |
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, eval, makeCTree, makeLatexTree, nodeEquals, nodeEquivalentTo, nodeHashCode, nodeInPosition, numNodes, numNodes, parentType, printNode, printNode, printNodeForHumans, printRootedTree, printRootedTree, printRootedTreeForHumans, protoClone, protoCloneSimple, readNode, readNode, readRootedTree, readRootedTree, replaceWith, resetNode, rootedTreeEquals, rootedTreeHashCode, rootParent, setup, swapCompatibleWith, toStringForError, toStringForHumans, writeNode, writeRootedTree |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
int numChildren
int type
java.lang.String text
java.lang.String variableName
| Constructor Detail |
|---|
public ParseableGPNode(java.lang.String text,
int numChildren)
text - numChildren -
public ParseableGPNode(java.lang.String text,
int numChildren,
int type)
| Method Detail |
|---|
public void checkConstraints(ec.EvolutionState state,
int tree,
ec.gp.GPIndividual typicalIndividual,
ec.util.Parameter individualBase)
checkConstraints in class ec.gp.GPNodepublic abstract java.lang.String getJavaCode()
getJavaCode in interface ParseableNodepublic java.lang.String getEndJavaCode()
public java.lang.String toString()
toString in class ec.gp.GPNodepublic ParseableNode getChild(int index)
ParseableNode
getChild in interface ParseableNodepublic int countChildren()
ParseableNode
countChildren in interface ParseableNodepublic java.lang.String getVariableName()
getVariableName in interface ParseableNodepublic void setVariableName(java.lang.String name)
setVariableName in interface ParseableNodepublic int getType()
ParseableNode
getType in interface ParseableNodepublic void setType(int type)
ParseableNode
setType in interface ParseableNodepublic java.lang.String getValue()
public abstract int getObjectType()
ParseableNode
getObjectType in interface ParseableNodepublic java.lang.String getLineComment()
ParseableNode
getLineComment in interface ParseableNode
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||