org.omegahat.Environment.GUITools
Class OmegaListener

java.lang.Object
  |
  +--org.omegahat.Environment.GUITools.OmegaListener
Direct Known Subclasses:
FunctionListener

public abstract class OmegaListener
extends java.lang.Object

An abstract class that provides slots for storing an evaluable object (expression or Function) and an Evaluator in which it should be evaluated. This is used to implement connect the interpreted language with Java classes by allowing the former to be used as instances of the latter. Methods of the Java class are implemented by evaluating the callback object in the specified org.omegahat.Environment.Interpreter.Envaluator.


Field Summary
protected  Evaluable callback
          The object which is to be evaluated.
protected  Evaluator evaluator
          The evaluator in which the evaluation of the callback is to be performed.
 
Constructor Summary
OmegaListener()
          Default constructor for use by derived classes.
OmegaListener(Evaluable callback)
          Constructor specifying just the evaluable expression or function.
OmegaListener(Evaluable callback, Evaluator evaluator)
          Constructor taking both the callback and evaluator
 
Method Summary
 Evaluable callback()
          Accessor to the callback field.
 Evaluable callback(Evaluable cb)
          Accessor to set the callback field.
 java.lang.Object eval()
          Evaluate the callback using the specified evaluator, returning the value and trapping any exceptions, displaying them as warnings via the evaluator.
 Evaluator evaluator()
          Accessor to the evaluator field.
 Evaluator evaluator(Evaluator eval)
          Accessor to set the evaluator field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callback

protected Evaluable callback
The object which is to be evaluated.

evaluator

protected Evaluator evaluator
The evaluator in which the evaluation of the callback is to be performed.
Constructor Detail

OmegaListener

public OmegaListener(Evaluable callback)
Constructor specifying just the evaluable expression or function.

OmegaListener

public OmegaListener(Evaluable callback,
                     Evaluator evaluator)
Constructor taking both the callback and evaluator

OmegaListener

public OmegaListener()
Default constructor for use by derived classes.
Method Detail

evaluator

public Evaluator evaluator()
Accessor to the evaluator field.

evaluator

public Evaluator evaluator(Evaluator eval)
Accessor to set the evaluator field.

callback

public Evaluable callback()
Accessor to the callback field.

callback

public Evaluable callback(Evaluable cb)
Accessor to set the callback field.

eval

public java.lang.Object eval()
Evaluate the callback using the specified evaluator, returning the value and trapping any exceptions, displaying them as warnings via the evaluator.