/** GPNode.java * J Scott Cameron *This interface defines what methods are necessary for *a Node in a function tree */ import GPPair; public abstract interface GPNode { /*returns the value for the function tree rooted at this node*/ public abstract Double value() throws NoSuchMethodException; /*returns the number of children nodes this node has*/ public abstract int childCount(); /*returns the appropriate child node*/ public abstract GPNode getChild(int i); /*sets the appropriate child node*/ public abstract void setChild(int i,GPNode gpn); /* returns the size of the tree rooted at this node */ public abstract int count(); /* returns the node at position i within the tree */ public abstract GPNode find(int i); /* returns the number of this node within the tree * it is the root of */ public abstract int nodeNumber(); /* sets the node with position number*/ public abstract void setDescendant(int number,GPNode gpn); /* returns the function rooted at this node */ public abstract String toString(); /* sets the function at this node */ public abstract void setFunction(GPPair gpp); /* returns the type of this node */ public abstract int getType(); /* returns a new copy of this node */ public abstract GPNode copy(); /* Four types of nodes, used with "getType()" */ public static final int TERMINAL = 0; public static final int VARIABLE = 1; public static final int BINARY = 2; public static final int UNARY = 3; }