com.go.tea.compiler
Class CompilationUnit

java.lang.Object
  |
  +--com.go.tea.compiler.CompilationUnit
All Implemented Interfaces:
ErrorListener, java.util.EventListener
Direct Known Subclasses:
FileCompiler.Unit, RemoteCompiler.Unit

public abstract class CompilationUnit
extends java.lang.Object
implements ErrorListener

Version:
21 , 01/02/06
Author:
Brian S O'Neill

Constructor Summary
CompilationUnit(java.lang.String name, Compiler compiler)
           
 
Method Summary
 void compileError(ErrorEvent e)
          Called when there is an error when compiling this CompilationUnit.
 Compiler getCompiler()
           
 int getErrorCount()
          Returns the number of errors generated while compiling this CompilationUnit.
 java.lang.String[] getImportedPackages()
          Current implementation returns only the same packages as the compiler.
 java.lang.String getName()
           
abstract  java.io.OutputStream getOutputStream()
           
 Template getParseTree()
           
abstract  java.io.Reader getReader()
           
 java.lang.String getShortName()
           
abstract  java.lang.String getSourceFileName()
           
 java.lang.String getTargetPackage()
          Return the package name that this CompilationUnit should be compiled into.
 void setParseTree(Template tree)
           
 boolean shouldCompile()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompilationUnit

public CompilationUnit(java.lang.String name,
                       Compiler compiler)
Method Detail

getName

public java.lang.String getName()

getShortName

public java.lang.String getShortName()

getCompiler

public Compiler getCompiler()

compileError

public void compileError(ErrorEvent e)
Called when there is an error when compiling this CompilationUnit.
Specified by:
compileError in interface ErrorListener

getErrorCount

public int getErrorCount()
Returns the number of errors generated while compiling this CompilationUnit.

getParseTree

public Template getParseTree()

setParseTree

public void setParseTree(Template tree)

getImportedPackages

public final java.lang.String[] getImportedPackages()
Current implementation returns only the same packages as the compiler.
See Also:
Compiler.getImportedPackages()

getTargetPackage

public java.lang.String getTargetPackage()
Return the package name that this CompilationUnit should be compiled into. Default implementation returns null, or no package.

getSourceFileName

public abstract java.lang.String getSourceFileName()

getReader

public abstract java.io.Reader getReader()
                                  throws java.io.IOException
Returns:
A new source file reader.

shouldCompile

public boolean shouldCompile()
                      throws java.io.IOException
Returns:
true if the CompilationUnit should be compiled. Default is true.

getOutputStream

public abstract java.io.OutputStream getOutputStream()
                                              throws java.io.IOException
Returns:
An OutputStream to write compiled code to. Returning null is disables code generation for this CompilationUnit.