org.omegahat.Environment.lib.Language
Class TimedEvaluation

java.lang.Object
  |
  +--org.omegahat.Environment.lib.Language.TimedEvaluation
Direct Known Subclasses:
TimedExpressionEvaluation

public class TimedEvaluation
extends java.lang.Object

Class used to time a particular computation, be in an interpreted expression or a regular Java call.

See Also:
TimedExpressionEvaluation

Field Summary
static int START
          Symbolic constant identifying the position in the array of times identifying the starting time.
static int STOP
          Symbolic constant identifying the position in the array of times identifying the finishing time.
protected  long[] times
          Array storing the starting and ending time.
 
Constructor Summary
TimedEvaluation()
           
 
Method Summary
 long duration()
          Method to compute the total amount of time taken.
 java.lang.Object eval(Evaluable expression, Evaluator evaluator)
          Evaluates the specified expression, noting the starting and stopping times in the times array.
 long getStart()
          Method to access the time the computation started.
 long getStop()
          Method to access the time the evaluation concluded.
 long start()
          Imperative indicating that the current time should be stored as the time the evaluation was complete.
 long stop()
          Imperative indicating that the current time should be stored as the time the evaluation was complete.
 long[] times()
          Accessor for the times array.
protected  long[] times(long[] t)
          Internal accessor for specifying the times array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START

public static int START
Symbolic constant identifying the position in the array of times identifying the starting time.

STOP

public static int STOP
Symbolic constant identifying the position in the array of times identifying the finishing time.

times

protected long[] times
Array storing the starting and ending time.
Constructor Detail

TimedEvaluation

public TimedEvaluation()
Method Detail

start

public long start()
Imperative indicating that the current time should be stored as the time the evaluation was complete.

stop

public long stop()
Imperative indicating that the current time should be stored as the time the evaluation was complete.

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.

getStart

public long getStart()
Method to access the time the computation started.

getStop

public long getStop()
Method to access the time the evaluation concluded.

duration

public long duration()
Method to compute the total amount of time taken.

times

public long[] times()
Accessor for the times array.

times

protected long[] times(long[] t)
Internal accessor for specifying the times array.