org.omegahat.Environment.Interpreter
Class EvaluatorManager

java.lang.Object
  |
  +--org.omegahat.Environment.Interpreter.EvaluatorManager
Direct Known Subclasses:
ConverterManager

public class EvaluatorManager
extends java.lang.Object

This class is intended to manage multiple evaluators in the cases where they are

The idea is to centralize the communication between the different evaluators, potentially using TaskQueue objects, so that synchronization is structured. See also TaskManagement It provides methods for


Field Summary
protected  java.lang.String[] commandLineArgs
          The command line arguments passed to the object, usually when it is created and come from the omegahat script.
static java.lang.String EvaluatorClassName
           
protected  java.util.Vector evaluators
          The ordered collection of Evaluator objects which are under the "management" of this object.
protected  java.util.Hashtable evaluatorThreads
           
protected  FileLocatorInt fileLocator
           
 java.lang.String FinalScriptProperty
           
 java.lang.String OmegaScriptSearchPath
           
protected  Options options
           
 
Constructor Summary
EvaluatorManager()
          Create an instance of this class, registering in the "global" variable accessible from System.Globals#manager()
EvaluatorManager(ManagedEvaluatorInt evaluator)
          Create a manager object to manage the specified object, usually an Evaluator, registering this as the manager for that object and also storing this in the global variable System.Globals#manager().
EvaluatorManager(Options opts)
          Create a manager with the specified collection of Options controlling the different characteristics of the manager and also the Evaluator objects that are created by this manager.
EvaluatorManager(java.lang.String[] args)
          Create an instance of this class, caching the command line arguments parameterizing its options, etc.
 
Method Summary
 ManagedEvaluatorInt addEvaluator(ManagedEvaluatorInt obj)
           
 java.lang.String[] commandLine()
          Return the current values for the command line arguments stored in this object.
 java.lang.String[] commandLine(java.lang.String[] args)
          Set the command line arguments parameterizing the behaviour of this object.
 Evaluator createEvaluator(Evaluator src)
           
 Evaluator evaluator()
          Obtain the default evaluator, creating one if there is none already registered with this manager.
 Evaluator evaluator(boolean force)
          Return the default evaluator managed by this object and "available" to other objects when they require an Evaluator to evaluate some expressions, etc.
 Evaluator evaluator(Evaluator src)
           
 Evaluator evaluator(java.lang.String className)
          Create a new evaluator of the specified class, identfied by a completely qualified class name, in contrast to the usual class lookup rules of the evaluator.
 Evaluator evaluator(java.lang.String className, Evaluator parent)
           
 Evaluator evaluator(java.lang.Thread thread)
           
 java.util.Vector evaluators()
          Return the reference to the list of Evaluator (or specifically, ManagedEvaluatorInt) objects being managed by this object.
 java.util.Hashtable evaluatorThreads()
           
 void exit(Evaluator src)
           
 void exit(Evaluator src, int val)
           
 void exit(int val)
           
 FileLocatorInt fileLocator()
           
 FileLocatorInt fileLocator(FileLocatorInt locator)
           
 java.lang.Object findFile(java.lang.String str)
           
 int manager(Evaluator ev)
           
 Options options()
           
 Options options(Options opts)
           
 boolean q(Evaluator src)
           
 boolean q(Evaluator src, boolean force)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EvaluatorClassName

public static java.lang.String EvaluatorClassName

FinalScriptProperty

public java.lang.String FinalScriptProperty

OmegaScriptSearchPath

public final java.lang.String OmegaScriptSearchPath

commandLineArgs

protected java.lang.String[] commandLineArgs
The command line arguments passed to the object, usually when it is created and come from the omegahat script.

evaluators

protected java.util.Vector evaluators
The ordered collection of Evaluator objects which are under the "management" of this object.

evaluatorThreads

protected java.util.Hashtable evaluatorThreads

options

protected Options options

fileLocator

protected FileLocatorInt fileLocator
Constructor Detail

EvaluatorManager

public EvaluatorManager()
Create an instance of this class, registering in the "global" variable accessible from System.Globals#manager()

EvaluatorManager

public EvaluatorManager(java.lang.String[] args)
Create an instance of this class, caching the command line arguments parameterizing its options, etc. and also register this object with the System.Globals#manager()

EvaluatorManager

public EvaluatorManager(ManagedEvaluatorInt evaluator)
Create a manager object to manage the specified object, usually an Evaluator, registering this as the manager for that object and also storing this in the global variable System.Globals#manager(). This is called to create a manager after an Evaluator has been created.

EvaluatorManager

public EvaluatorManager(Options opts)
Create a manager with the specified collection of Options controlling the different characteristics of the manager and also the Evaluator objects that are created by this manager.
Method Detail

commandLine

public java.lang.String[] commandLine()
Return the current values for the command line arguments stored in this object. These are usually fixed when the object is created (or not at all).

commandLine

public java.lang.String[] commandLine(java.lang.String[] args)
Set the command line arguments parameterizing the behaviour of this object. This is usually called from the constructor EvaluatorManager(String[])

evaluators

public java.util.Vector evaluators()
Return the reference to the list of Evaluator (or specifically, ManagedEvaluatorInt) objects being managed by this object.

evaluatorThreads

public java.util.Hashtable evaluatorThreads()

evaluator

public Evaluator evaluator(boolean force)
                    throws java.lang.ClassNotFoundException
Return the default evaluator managed by this object and "available" to other objects when they require an Evaluator to evaluate some expressions, etc. If no evaluator has been registered with this manager, this method can optionally instantiate one.
Parameters:
force - if true, this creates a new evaluator if there is none available. It does so using the evaluator(Evaluator) method.

evaluator

public Evaluator evaluator()
                    throws java.lang.ClassNotFoundException
Obtain the default evaluator, creating one if there is none already registered with this manager.

evaluator

public Evaluator evaluator(java.lang.String className)
                    throws java.lang.ClassNotFoundException,
                           java.lang.Throwable
Create a new evaluator of the specified class, identfied by a completely qualified class name, in contrast to the usual class lookup rules of the evaluator. This is because we have no Evaluator. See evaluator(java.lang.String,Evaluator).
Parameters:
className - the fully qualified name of the specific class to instantiate which implements Evaluator

evaluator

public Evaluator evaluator(java.lang.String className,
                           Evaluator parent)
                    throws java.lang.ClassNotFoundException,
                           java.lang.Throwable

evaluator

public Evaluator evaluator(Evaluator src)
                    throws java.lang.ClassNotFoundException

createEvaluator

public Evaluator createEvaluator(Evaluator src)

addEvaluator

public ManagedEvaluatorInt addEvaluator(ManagedEvaluatorInt obj)

q

public boolean q(Evaluator src)

q

public boolean q(Evaluator src,
                 boolean force)

manager

public int manager(Evaluator ev)

evaluator

public Evaluator evaluator(java.lang.Thread thread)

exit

public void exit(Evaluator src)

exit

public void exit(int val)

exit

public void exit(Evaluator src,
                 int val)

options

public Options options()

options

public Options options(Options opts)

findFile

public java.lang.Object findFile(java.lang.String str)

fileLocator

public FileLocatorInt fileLocator()

fileLocator

public FileLocatorInt fileLocator(FileLocatorInt locator)