org.omegahat.Environment.Interpreter
Class TracingEvaluator

java.lang.Object
  |
  +--org.omegahat.Environment.Interpreter.BasicEvaluator
        |
        +--org.omegahat.Environment.Interpreter.UtilityEvaluator
              |
              +--org.omegahat.Environment.Interpreter.UserClassEvaluator
                    |
                    +--org.omegahat.Environment.Interpreter.InteractiveEvaluator
                          |
                          +--org.omegahat.Environment.Interpreter.TracingEvaluator
All Implemented Interfaces:
DatabaseCustomer, Evaluator, InputConsumer, ManagedEvaluatorInt, PromptSource, java.lang.Runnable, java.io.Serializable

public class TracingEvaluator
extends InteractiveEvaluator

This evaluator offers the built-in ability to display a trace of the evaluation of the different top-level tasks in terms of the steps through the expression tree. As each new task is evaluated, the contents of the viewer are updated to reflect this and the sub-expressions highlighted as they are evaluated. This is a simple example of a debugger using the listener mechanism.

See Also:
Serialized Form

Field Summary
protected  ExpressionTreeWindow parserViewer
          The viewer for the expression tree that is used to display which sub-expressions have been evaluated and which is currently active.
 
Fields inherited from class org.omegahat.Environment.Interpreter.InteractiveEvaluator
continuation, continuationPrompt, interrupt, notify_listeners, pendingInput, promptExpression
 
Fields inherited from class org.omegahat.Environment.Interpreter.UserClassEvaluator
classManager
 
Fields inherited from class org.omegahat.Environment.Interpreter.BasicEvaluator
allowUnrestrictedAccess, class_lists, currentExpression, data, databases, debugger, DefaultAttachIndex, defaultDatabase, dynamicClassLoader, errorHandler, evaluationEvent, evaluationListeners, initialized, internalFunctionTables, internalPrimitiveClassNames, internalPrimitiveClassTable, lexer, localClasses, manager, options, output, parser, primitive_classes, primitiveClasses, PrimitiveClassNames, primitiveTypeNames, primitiveTypes, reversePrimitiveTypes, ShowMultipleClasses, sourceStack, stderr, stdout, SubEvaluationListeners, taskHistory, toplevelExpression, warningMessages
 
Fields inherited from interface org.omegahat.Environment.Interpreter.Evaluator
ThisVariableName
 
Constructor Summary
TracingEvaluator()
           
TracingEvaluator(Evaluator evaluator)
           
TracingEvaluator(EvaluatorManager manager)
           
 
Method Summary
 java.lang.Object evaluate(ExpressionInt expression)
          Overrides the basic evaluate() method to insert a call to update the viewer's display to reflect the new top-level task expression tree.
 boolean make()
          Initialize this evaluator, constructing and displaying the ExpressionTreeWindow to use to display the expression tree.
 ExpressionTreeWindow parserViewer()
          Return the current viewer being used to display the parse tree and its activity.
 ExpressionTreeWindow parserViewer(ExpressionTreeWindow viewer)
          Register a new viewer to use as the display component for the expression tree and activity.
 
Methods inherited from class org.omegahat.Environment.Interpreter.InteractiveEvaluator
currentExpression, deserialize, deserialize, deserialize, deserialize, deserialize, deserialize, evaluate, inputReady, inputReady, interrupt, notify_listeners, notify_listeners, notifyListeners, parserError, prompt, promptExpression, promptExpression, promptExpression, serialize, serialize, serialize, serialize
 
Methods inherited from class org.omegahat.Environment.Interpreter.UserClassEvaluator
addMethod, classManager, classManager, createInstance, createInstance, createInstance, defineClass, defineClass, defineClass, defineClass, defineClass, defineClass, DefineUserClass, DefineUserClass, DefineUserClass, findUserClass, findUserClass, parseClass, parser
 
Methods inherited from class org.omegahat.Environment.Interpreter.UtilityEvaluator
evaluator, exec, exec, findFile, getEvaluator, setProperty, setProperty
 
Methods inherited from class org.omegahat.Environment.Interpreter.BasicEvaluator
addEvaluationListener, addFunctionTable, addFunctionTable, addSourceInput, addToHistory, allowUnrestrictedAccess, allowUnrestrictedAccess, asObject, asObject, asObject, asObjectName, asPrimitiveClass, assign, assign, assign, asWriter, attach, attach, attach, attach, attach, attach, attach, classInit, classLists, classLists, classPath, classPath, commandLine, convertPrimitive, copy, copy, copyByConstructor, copyBySerialization, createClassLists, currentExpression, data, data, database, database, database, Debug, Debug, Debug, Debug, Debug, debugger, debugger, defaultDatabase, defaultDatabase, defaultDatabase, defaultErrorHandler, detach, detach, displayTask, displayTask, displayWarnings, displayWarnings, dynamicClassLoader, dynamicClassLoader, endSource, endSource, endSource, endTaskEvaluation, error, error, errorHandler, errorHandler, evaluate, evaluate, evaluationError, evaluationListeners, evaluationListeners, evaluationListeners, exists, exit, exit, expandClassName, expandedClassPathElement, find, findAsField, findClass, findClass, findClass, findClass, findFunction, findFunctionOrMethod, functionTableList, get, get, get, get, get, get, get, get, get, getBaseURL, getEvaluationEvent, getEvaluationListeners, getField, getSubEvaluationListeners, help, Import, Import, Import, init, initialize, initTaskEvaluation, internalFunctionTables, isPrimitive, isPrimitive, javaVersion, lexer, lexer, lexer, localClasses, localClasses, manager, manager, newDatabase, newDatabase, notifyListeners, objects, objects, objects, options, options, output, output, output, parse, parse, parse, parse, primitiveClass, q, q, remove, remove, remove, removeFunctionTable, run, same, searchForClass, searchPath, searchPath, searchPath, searchPath, setEvaluationEvent, setEvaluationListeners, setSubEvaluationListeners, show, show, show, source, source, source, source, source, source, source, source, source, sourceStack, stderr, stderr, stdout, stdout, taskHistory, taskHistory, toplevelExpression, toplevelExpression, useLazyEvaluation, warning, warning, warning, warnings, warnings, where, which, which
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parserViewer

protected ExpressionTreeWindow parserViewer
The viewer for the expression tree that is used to display which sub-expressions have been evaluated and which is currently active.
Constructor Detail

TracingEvaluator

public TracingEvaluator()

TracingEvaluator

public TracingEvaluator(Evaluator evaluator)

TracingEvaluator

public TracingEvaluator(EvaluatorManager manager)
Method Detail

evaluate

public java.lang.Object evaluate(ExpressionInt expression)
                          throws java.lang.Throwable
Overrides the basic evaluate() method to insert a call to update the viewer's display to reflect the new top-level task expression tree. This arranges to call the make() method the first time it is called.
Overrides:
evaluate in class BasicEvaluator

make

public boolean make()
Initialize this evaluator, constructing and displaying the ExpressionTreeWindow to use to display the expression tree.

parserViewer

public ExpressionTreeWindow parserViewer()
Return the current viewer being used to display the parse tree and its activity.

parserViewer

public ExpressionTreeWindow parserViewer(ExpressionTreeWindow viewer)
Register a new viewer to use as the display component for the expression tree and activity.