uchicago.src.sim.parameter.rpl
Class RPLCompiler

java.lang.Object
  extended by uchicago.src.sim.parameter.rpl.RPLCompiler

public class RPLCompiler
extends java.lang.Object

Compiler for RPL format parameter files. The compiler works in two steps, preProcess and compile. The final output is the top-level "main" parameter of which all other parameters are children. This main RPLParameter is used by RPLParameterSetter to set actual model parameters.

Version:
$Revision: 1.9 $ $Date: 2004/10/19 18:12:55 $

Constructor Summary
RPLCompiler(java.lang.String file)
          Creates a RPLCompiler for compiling the specified file.
 
Method Summary
 void compile(SimModel model)
          Performs the actual compilation turning the rpl format file into RPLParameters.
 CompilerException createCompilerException(java.lang.String message, int lineNumber)
           
 CompilerException createCompilerException(java.lang.String message, int lineNumber, java.lang.Exception e)
           
 java.util.Set getConstNames()
          Gets the set of constant parameter names defined during compilation.
 RPLParameter getMain()
          Gets the "main" RPLParameter produced by this compiler.
 java.util.Set getParamNames()
          Gets the set of parameter names defined during compilation.
 void preProcess()
          Performs an initial first passs compilation on the file specified on the constructor.
 void setModel(SimModel model)
          Sets the model associated with this RPLCompiler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RPLCompiler

public RPLCompiler(java.lang.String file)
Creates a RPLCompiler for compiling the specified file.

Parameters:
file - the name of the file to compile
Method Detail

preProcess

public void preProcess()
                throws java.io.IOException
Performs an initial first passs compilation on the file specified on the constructor.

Throws:
java.io.IOException - when encountering a problem with the file specified in the constructor.

compile

public void compile(SimModel model)
             throws java.io.IOException
Performs the actual compilation turning the rpl format file into RPLParameters. If preProcess has not been called before this is called, then preProcess will be called here. A reference to a model is necessary here as the rpl format permits references to a model's static fields.

Parameters:
model - the model for which this compiler is compiling parameters
Throws:
java.io.IOException - when encountering a problem with the file specified in the constructor.

setModel

public void setModel(SimModel model)
Sets the model associated with this RPLCompiler.

Parameters:
model - the model associated with this RPLCompiler.

getMain

public RPLParameter getMain()
Gets the "main" RPLParameter produced by this compiler. This will be null until compile has been called.

Returns:

getParamNames

public java.util.Set getParamNames()
Gets the set of parameter names defined during compilation.

Returns:

getConstNames

public java.util.Set getConstNames()
Gets the set of constant parameter names defined during compilation.

Returns:

createCompilerException

public CompilerException createCompilerException(java.lang.String message,
                                                 int lineNumber)

createCompilerException

public CompilerException createCompilerException(java.lang.String message,
                                                 int lineNumber,
                                                 java.lang.Exception e)