org.encog.app.generate.generators
Class AbstractGenerator

java.lang.Object
  extended by org.encog.app.generate.generators.AbstractGenerator
All Implemented Interfaces:
LanguageSpecificGenerator, ProgramGenerator
Direct Known Subclasses:
GenerateCS, GenerateEncogJava, GenerateEncogJavaScript

public abstract class AbstractGenerator
extends Object
implements ProgramGenerator

Abstract class that forms the foundation of most code generators. This class allows for includes and code indentation.


Field Summary
static int INDENT_SPACES
          Default number of indent spaces.
 
Constructor Summary
AbstractGenerator()
           
 
Method Summary
 void addBreak()
          Add a line break;
 void addInclude(String str)
          Add an include.
 void addLine(String line)
          Add a line of code, indent proper.
 void addToBeginning(String str)
          Add to the beginning of the file.
 String getContents()
          Get the contents.
 Set<String> getIncludes()
           
 void indentLine(String line)
          Indent a line.
 void unIndentLine(String line)
          Unindent and then add this line.
 void writeContents(File targetFile)
          Write the contents to the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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
Constructor Detail

AbstractGenerator

public AbstractGenerator()
Method Detail

addBreak

public void addBreak()
Add a line break;


addInclude

public void addInclude(String str)
Add an include.

Parameters:
str - The include to add.

addLine

public void addLine(String line)
Add a line of code, indent proper.

Parameters:
line - The line of code to add.

addToBeginning

public void addToBeginning(String str)
Add to the beginning of the file. This is good for includes.

Parameters:
str -

getContents

public String getContents()
Get the contents.

Specified by:
getContents in interface LanguageSpecificGenerator
Returns:
The contents.

getIncludes

public Set<String> getIncludes()
Returns:
The includes.

indentLine

public void indentLine(String line)
Indent a line. The line after dis one will be indented.

Parameters:
line - The line to indent.

unIndentLine

public void unIndentLine(String line)
Unindent and then add this line.

Parameters:
line - The line to add.

writeContents

public void writeContents(File targetFile)
Write the contents to the specified file.

Specified by:
writeContents in interface LanguageSpecificGenerator


Copyright © 2014. All Rights Reserved.