|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectac.essex.ooechs.ecj.ecj2java.JavaWriter
public class JavaWriter
Takes an ECJ individual and outputs it as Java Code. For this class to work properly, all your GP functions must implement the functionality in the ParseableNode interface. This means either extending the ParseableGPNode adapter class (for functions and terminals) or extending the ParseableERC adapter class (for ERCs) 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
ParseableNode
Field Summary | |
---|---|
protected java.lang.String |
classExtends
If this class extends another class. |
protected java.lang.String |
classImplements
Similar to class extends - if this class implements functions defined in an interface. |
protected java.lang.String |
classModifiers
The class modifiers, default is public although you may possibly want to generate a different kind of class, abstract for example or inner class. |
protected java.lang.String |
className
The name of the class. |
protected java.lang.String |
classPackage
The package to which this class belongs, set to null if the class is package-less. |
protected java.lang.String |
comments
Comments that appear just before the class. |
Constructor Summary | |
---|---|
JavaWriter(java.lang.String className,
java.lang.String GPFunctionSignature)
|
|
JavaWriter(java.lang.String className,
java.lang.String GPFunctionSignature,
java.lang.String comments)
|
|
JavaWriter(java.lang.String className,
java.lang.String GPFunctionSignature,
java.lang.String comments,
java.lang.String classPackage)
|
Method Summary | |
---|---|
void |
addComments(java.lang.String comments)
|
void |
addFunctionSignature(java.lang.String functionSignature)
Adds another function signature, in the case that the individual consists of more than one tree. |
void |
addImport(java.lang.String className)
Adds a classname to be added to the list of import statements |
void |
addIntConstant(java.lang.String name,
int value)
|
java.lang.String |
getJavaCode(ec.gp.GPIndividual ind)
Converts the individual to a String, containing a complete class declaration that can then be saved to disk or do whatever you want with. |
void |
saveJavaCode(ec.gp.GPIndividual ind,
java.io.File directory)
Generates the java code (using getJavaCode) saves the code in a given directory. |
void |
setExtends(java.lang.String classExtends)
|
void |
setImplements(java.lang.String classImplements)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String classModifiers
protected java.lang.String comments
protected java.lang.String classPackage
protected java.lang.String className
saveJavaCode()
function.
protected java.lang.String classExtends
protected java.lang.String classImplements
Constructor Detail |
---|
public JavaWriter(java.lang.String className, java.lang.String GPFunctionSignature)
public JavaWriter(java.lang.String className, java.lang.String GPFunctionSignature, java.lang.String comments)
public JavaWriter(java.lang.String className, java.lang.String GPFunctionSignature, java.lang.String comments, java.lang.String classPackage)
Method Detail |
---|
public void addImport(java.lang.String className)
className
- public void addComments(java.lang.String comments)
public void setImplements(java.lang.String classImplements)
public void setExtends(java.lang.String classExtends)
public void addIntConstant(java.lang.String name, int value)
public void addFunctionSignature(java.lang.String functionSignature)
public java.lang.String getJavaCode(ec.gp.GPIndividual ind)
describe
method in your Problem class.
public void saveJavaCode(ec.gp.GPIndividual ind, java.io.File directory) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |