|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectclassifier.gp.GProgram
Abstract class that stands over the 2 kind of possible nodes and their real implementation; moreover it brings some common methods to operate over trees
| Constructor Summary | |
GProgram()
|
|
| Method Summary | |
protected abstract java.lang.Object |
clone()
clone the current object |
(package private) abstract int |
countNodes()
count all the nodes under this object |
(package private) abstract int |
countNodes(Condition cond)
count the nodes of the desidered kind |
abstract char[] |
eval(char[] string)
|
abstract double |
eval(double i)
|
abstract long |
eval(long x)
|
abstract java.lang.Object |
eval(java.lang.Object x)
Evaluate the program under the node passing an object |
abstract java.lang.String |
getName()
To get the name of the function of the node or the type of the terminal |
protected static Joint |
getSubtree(GProgram tree,
int index,
Condition cond)
To have the Joint structure containg the information to break the tree in the desidered point |
java.lang.String |
indent(int level)
utility function to make a correct indentation |
protected static int |
maxDepthOfTree(GProgram tree)
To know the maximum depth of a tree |
abstract java.lang.String |
toString(int level)
Prints the content of the tree from the level indicated |
protected static TreeJoint |
Walk(GProgram tree,
int[] count,
Condition cond,
Function parent,
int childIndex)
Method to explore the tree looking for the desidered subtree |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public GProgram()
| Method Detail |
public abstract java.lang.String toString(int level)
level - the level of the tree from which to start
public abstract java.lang.String getName()
public abstract java.lang.Object eval(java.lang.Object x)
x - the object to evaluale (eg. classify)
public abstract long eval(long x)
public abstract double eval(double i)
public abstract char[] eval(char[] string)
abstract int countNodes()
abstract int countNodes(Condition cond)
cond - the desidered kind of nodes to be counted (eg. function or terminal)
protected abstract java.lang.Object clone()
public java.lang.String indent(int level)
level - how many level to indent
protected static Joint getSubtree(GProgram tree,
int index,
Condition cond)
tree - the program to breakindex - the number of the node where to breakcond - the kind of node to break (eg. function or terminal)
protected static TreeJoint Walk(GProgram tree,
int[] count,
Condition cond,
Function parent,
int childIndex)
tree - the program to breakcount - the number of the node where to breakcond - the kind of node to break (eg. function or terminal)parent - to set the parent attribute in the TreeJoint structurechildIndex - to set the childIndex attribute in the TreeJoint structure
TreeJointprotected static int maxDepthOfTree(GProgram tree)
tree - the tree to analize
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||