org.encog.app.generate.generators
Class AbstractGenerator
- java.lang.Object
-
- org.encog.app.generate.generators.AbstractGenerator
-
- All Implemented Interfaces:
- LanguageSpecificGenerator, ProgramGenerator
- Direct Known Subclasses:
- GenerateCS, GenerateEncogJava, GenerateEncogJavaScript
public abstract class AbstractGenerator extends java.lang.Object implements ProgramGenerator
Abstract class that forms the foundation of most code generators. This class allows for includes and code indentation.
-
-
Field Summary
Fields Modifier and Type Field and Description static intINDENT_SPACESDefault number of indent spaces.
-
Constructor Summary
Constructors Constructor and Description AbstractGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddBreak()Add a line break;voidaddInclude(java.lang.String str)Add an include.voidaddLine(java.lang.String line)Add a line of code, indent proper.voidaddToBeginning(java.lang.String str)Add to the beginning of the file.java.lang.StringgetContents()Get the contents.java.util.Set<java.lang.String>getIncludes()voidindentLine(java.lang.String line)Indent a line.voidunIndentLine(java.lang.String line)Unindent and then add this line.voidwriteContents(java.io.File targetFile)Write the contents to the specified file.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.encog.app.generate.generators.ProgramGenerator
generate
-
-
-
-
Field Detail
-
INDENT_SPACES
public static final int INDENT_SPACES
Default number of indent spaces.- See Also:
- Constant Field Values
-
-
Method Detail
-
addBreak
public void addBreak()
Add a line break;
-
addInclude
public void addInclude(java.lang.String str)
Add an include.- Parameters:
str- The include to add.
-
addLine
public void addLine(java.lang.String line)
Add a line of code, indent proper.- Parameters:
line- The line of code to add.
-
addToBeginning
public void addToBeginning(java.lang.String str)
Add to the beginning of the file. This is good for includes.- Parameters:
str- the string to insert
-
getContents
public java.lang.String getContents()
Get the contents.- Specified by:
getContentsin interfaceLanguageSpecificGenerator- Returns:
- The contents.
-
getIncludes
public java.util.Set<java.lang.String> getIncludes()
- Returns:
- The includes.
-
indentLine
public void indentLine(java.lang.String line)
Indent a line. The line after dis one will be indented.- Parameters:
line- The line to indent.
-
unIndentLine
public void unIndentLine(java.lang.String line)
Unindent and then add this line.- Parameters:
line- The line to add.
-
writeContents
public void writeContents(java.io.File targetFile)
Write the contents to the specified file.- Specified by:
writeContentsin interfaceLanguageSpecificGenerator- Parameters:
targetFile- the output file
-
-
DMelt 3.0 © DataMelt by jWork.ORG