edu.rice.cs.drjava.model.compiler
Interface CompilerModel

All Known Implementing Classes:
DefaultCompilerModel

public interface CompilerModel

Interface for all compiler functionality in the model. The compilation process itself can be monitored through the CompilerListener interface. The four primary uses of this interface will be to manage listeners, to trigger compilation of (a) document(s), to handle the results, and to manage available compilers.

Version:
$Id: CompilerModel.java 4691 2008-12-02 23:33:27Z dlsmith $

Field Summary
static String[] EXTENSIONS
          Legal source file name extensions
 
Method Summary
 void addCompiler(CompilerInterface compiler)
          Add a compiler to the active list
 void addListener(CompilerListener listener)
          Add a CompilerListener to the model.
 void compile(List<OpenDefinitionsDocument> docs)
          Compiles the specified documents which must be saved first.
 void compile(OpenDefinitionsDocument doc)
          Compiles a single document which must be saved first.
 void compileAll()
          Compiles all documents, which requires that the documents be saved first.
 void compileProject()
          Compiles all documents in the project source tree, which requires that the documents be saved first.
 CompilerInterface getActiveCompiler()
          Gets the compiler that is the "active" compiler.
 Iterable<CompilerInterface> getAvailableCompilers()
          Returns all registered compilers that are actually available.
 CompilerErrorModel getCompilerErrorModel()
          Gets the CompilerErrorModel representing the last compile.
 Object getCompilerLock()
          Returns the lock used to prevent simultaneous compilation and JUnit testing
 int getNumErrors()
          Gets the total number of current errors.
 void removeAllListeners()
          Removes all CompilerListeners from this model.
 void removeListener(CompilerListener listener)
          Remove a CompilerListener from the model.
 void resetCompilerErrors()
          Resets the compiler error state to have no errors.
 void setActiveCompiler(CompilerInterface compiler)
          Sets which compiler is the "active" compiler.
 

Field Detail

EXTENSIONS

static final String[] EXTENSIONS
Legal source file name extensions

Method Detail

getCompilerLock

Object getCompilerLock()
Returns the lock used to prevent simultaneous compilation and JUnit testing


addListener

void addListener(CompilerListener listener)
Add a CompilerListener to the model.

Parameters:
listener - a listener that reacts to compiler events

removeListener

void removeListener(CompilerListener listener)
Remove a CompilerListener from the model. If the listener is not currently listening to this model, this method has no effect.

Parameters:
listener - a listener that reacts to compiler events

removeAllListeners

void removeAllListeners()
Removes all CompilerListeners from this model.


compileAll

void compileAll()
                throws IOException
Compiles all documents, which requires that the documents be saved first.

Throws:
IOException - if a filesystem-related problem prevents compilation

compileProject

void compileProject()
                    throws IOException
Compiles all documents in the project source tree, which requires that the documents be saved first.

Throws:
IOException - if a filesystem-related problem prevents compilation

compile

void compile(List<OpenDefinitionsDocument> docs)
             throws IOException
Compiles the specified documents which must be saved first.

Parameters:
docs - the documents to be compiled
Throws:
IOException - if a filesystem-related problem prevents compilation

compile

void compile(OpenDefinitionsDocument doc)
             throws IOException
Compiles a single document which must be saved first.

Parameters:
doc - the document to be compiled
Throws:
IOException - if a filesystem-related problem prevents compilation

getCompilerErrorModel

CompilerErrorModel getCompilerErrorModel()
Gets the CompilerErrorModel representing the last compile.


getNumErrors

int getNumErrors()
Gets the total number of current errors.


resetCompilerErrors

void resetCompilerErrors()
Resets the compiler error state to have no errors.


getAvailableCompilers

Iterable<CompilerInterface> getAvailableCompilers()
Returns all registered compilers that are actually available. If there are none, the result is NoCompilerAvailable.ONLY.


getActiveCompiler

CompilerInterface getActiveCompiler()
Gets the compiler that is the "active" compiler.

See Also:
setActiveCompiler(edu.rice.cs.drjava.model.compiler.CompilerInterface)

setActiveCompiler

void setActiveCompiler(CompilerInterface compiler)
Sets which compiler is the "active" compiler.

Parameters:
compiler - Compiler to set active.
Throws:
IllegalArgumentException - If the compiler is not in the list of available compilers
See Also:
getActiveCompiler()

addCompiler

void addCompiler(CompilerInterface compiler)
Add a compiler to the active list