org.omegahat.Environment.lib.Language
Class TimedExpressionEvaluation

java.lang.Object
  |
  +--org.omegahat.Environment.lib.Language.TimedEvaluation
        |
        +--org.omegahat.Environment.lib.Language.TimedExpressionEvaluation

public class TimedExpressionEvaluation
extends TimedEvaluation

This extension of TimedEvaluation is used to time the evaluation of a specific expression and to store the result of the evaluation along with the starting and stopping times for the evaluation.


Field Summary
protected  Evaluable expression
          The expression associated with the evaluation time.
protected  java.lang.Object value
          The result of the evaluation.
 
Fields inherited from class org.omegahat.Environment.lib.Language.TimedEvaluation
START, STOP, times
 
Constructor Summary
TimedExpressionEvaluation(Evaluable expression, Evaluator evaluator)
          Time the evaluation of the specified expression using the given evaluator.
TimedExpressionEvaluation(Evaluable expression, Evaluator evaluator, boolean eval)
          Prepare to evaluate the expression using the specified evaluator, storing the expression for future reference so we can recall to which evaluation the times refer
 
Method Summary
 java.lang.Object eval(Evaluable expression)
          Evaluation of the specified expression using the default evaluator obtained from the Globals class.
 java.lang.Object eval(Evaluable expression, Evaluator evaluator)
          Evaluates the specified expression, noting the starting and stopping times in the times array.
 java.lang.Object eval(Evaluator evaluator)
          Evaluation of the previously stored expression but using a potentially different evaluator, allowing us to roughly contrast different evaluation contexts and models.
 Evaluable expression()
          Accessor to expression.
 Evaluable expression(Evaluable e)
          Accessor to set the expression.
 java.lang.Object value()
           
 java.lang.Object value(java.lang.Object o)
           
 
Methods inherited from class org.omegahat.Environment.lib.Language.TimedEvaluation
duration, getStart, getStop, start, stop, times, times
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expression

protected Evaluable expression
The expression associated with the evaluation time.

value

protected java.lang.Object value
The result of the evaluation.
Constructor Detail

TimedExpressionEvaluation

public TimedExpressionEvaluation(Evaluable expression,
                                 Evaluator evaluator)
                          throws java.lang.Throwable
Time the evaluation of the specified expression using the given evaluator.

TimedExpressionEvaluation

public TimedExpressionEvaluation(Evaluable expression,
                                 Evaluator evaluator,
                                 boolean eval)
                          throws java.lang.Throwable
Prepare to evaluate the expression using the specified evaluator, storing the expression for future reference so we can recall to which evaluation the times refer
Parameters:
eval - flag indicating whether we should perform the timed evaluation immediately or defer it
Method Detail

eval

public java.lang.Object eval(Evaluable expression,
                             Evaluator evaluator)
                      throws java.lang.Throwable
Evaluates the specified expression, noting the starting and stopping times in the times array. Even if an exception is throw, the time is still valid, the value however will not be set.
Overrides:
eval in class TimedEvaluation

eval

public java.lang.Object eval(Evaluable expression)
                      throws java.lang.Throwable
Evaluation of the specified expression using the default evaluator obtained from the Globals class.

eval

public java.lang.Object eval(Evaluator evaluator)
                      throws java.lang.Throwable
Evaluation of the previously stored expression but using a potentially different evaluator, allowing us to roughly contrast different evaluation contexts and models.

expression

public Evaluable expression()
Accessor to expression.

expression

public Evaluable expression(Evaluable e)
Accessor to set the expression.

value

public java.lang.Object value()

value

public java.lang.Object value(java.lang.Object o)