/home/ooechs/Ecj2Java/src/ac/essex/ooechs/ecj/ecj2java/nodes/ParseableNode.java
|
package ac.essex.ooechs.ecj.ecj2java.nodes;
/**
* <p>
* Basic Interface that allows the JavaWriter to turn GP nodes into
* Java Code. It allows the JavaWriter to assign names to each function
* (for variable declaration) and allows it to access the GP node's children.
* </p>
*
* <p/>
* 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
* </p>
*
* @see ac.essex.ooechs.ecj.ecj2java.nodes.ParseableERC
* @see ac.essex.ooechs.ecj.ecj2java.nodes.ParseableGPNode
*
* @author Olly Oechsle, University of Essex, Date: 05-Sep-2006
* @version 1.0
*/
public interface ParseableNode {
// There are two basic node types in ECJ, Functions and ERCs.
// A terminal is a function without any children.
public static final int FUNCTION = 1;
public static final int ERC = 2;
public static final int VOID = 3;
public static final int RETURN = 4;
public static final int BOOLEAN = 5;
public static final int DOUBLE = 6;
public static final int INT = 7;
/**
* When the java writer uses this node, it may use a variable name to refer to it.
*/
public String getVariableName();
/**
* Attaches a variable name to this node, (performed automatically by JavaWriter).
*/
public void setVariableName(String name);
/**
* Gets the child of this node at a given index.
*/
public ParseableNode getChild(int index);
/**
* Returns how many children this node has
*/
public int countChildren();
/**
* Returns what kind of node this is.
*/
public int getType();
/**
* Set the node type
*/
public void setType(int type);
/**
* The kind of object this is, eg int, double, etc.
*/
public int getObjectType();
/**
* There may be a line comment associated with this piece of code.
*/
public String getLineComment();
/**
* Writes out the java for this node
*/
public abstract String getJavaCode();
}