|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--org.omegahat.Environment.Interpreter.BasicEvaluator
|
+--org.omegahat.Environment.Interpreter.UtilityEvaluator
|
+--org.omegahat.Environment.Interpreter.UserClassEvaluator
|
+--org.omegahat.Environment.Interpreter.InteractiveEvaluator
This is the default evaluator used for an interactive
Omegahat session, providing functionality for serializing objects,
returning prompt strings, and handling input as an
InputConsumer.
This object is registered with an
InputSupplier
and is notified when new input is available.
| Field Summary | |
protected boolean |
continuation
Flag indicating whether we are in continued input mode. |
protected java.lang.String |
continuationPrompt
The prompt to be used when in continuation mode. |
boolean |
interrupt
|
protected boolean |
notify_listeners
Flag indicating whether we want to notify listeners of different evaluation events, specifically not when we are evaluating the prompt expressions. |
protected java.lang.StringBuffer |
pendingInput
Contents of the current pending input that is cached across input events in the case of incomplete input. |
protected Evaluable |
promptExpression
The normal prompt as an expression which is evaluated each time allowing it to increment the task number, etc. |
| 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 | |
InteractiveEvaluator()
|
|
InteractiveEvaluator(Evaluator parent)
|
|
InteractiveEvaluator(EvaluatorManager manager)
|
|
InteractiveEvaluator(Options opts)
|
|
| Method Summary | |
ExpressionInt |
currentExpression(ExpressionInt e)
Sets the currently active sub-expression being evaluated at this moment. |
java.lang.Object |
deserialize(java.io.File file)
|
java.lang.Object |
deserialize(java.io.File file,
boolean zip)
|
java.lang.Object |
deserialize(java.io.InputStream stream)
|
java.lang.Object |
deserialize(java.io.ObjectInputStream stream)
|
java.lang.Object |
deserialize(java.lang.String file)
|
java.lang.Object |
deserialize(java.lang.String file,
boolean zip)
|
java.lang.Object |
evaluate(java.lang.Object expr,
java.lang.String input)
Added so that the interrupt is automatically reset at this point. |
boolean |
inputReady(InputSupplier src)
The alternative method used to signal input available from an InputSupplier. |
boolean |
inputReady(java.lang.String text)
This is the method from InputConsumer
which is called when the
InputConsumer has new input
for it to process. |
boolean |
interrupt()
Allow others to interrupt the current computation, asynchronously. |
boolean |
notify_listeners()
Queries the status of whether we are notifying evaluation listeners of events. |
boolean |
notify_listeners(boolean val)
Set the flag controlling whether evaluation listeners are to be notified of events. |
int |
notifyListeners(ExpressionInt e,
boolean task)
Control the notification of listeners by intercepting notification when we are evaluating the prompt. |
void |
parserError(java.lang.Exception ex)
Handle parser errors by determining whether it is an incomplete expression or an actual syntax error. |
java.lang.String |
prompt()
Return an appropriate value for the prompt, based on whether there is unfinished input or not and potentially evaluating the prompt string as an evaluable expression. |
Evaluable |
promptExpression()
Return the current normal prompt expression. |
Evaluable |
promptExpression(Evaluable expr)
Set the normal prompt expression that is evaluated each time a new non-continuation prompt is needed. |
Evaluable |
promptExpression(java.lang.String str)
Specify the normal prompt expression in textual form, rather than as a pre-parsed expression. |
java.io.ObjectOutputStream |
serialize(java.lang.Object obj,
java.io.File file)
Serialize the given object to the specified file. |
java.io.ObjectOutputStream |
serialize(java.lang.Object obj,
java.io.ObjectOutputStream stream)
Version of the serialization that actually writes the serialized data from the object to the stream. |
java.io.ObjectOutputStream |
serialize(java.lang.Object obj,
java.io.OutputStream stream)
Write a serialized version of the given object on the output stream. |
java.io.ObjectOutputStream |
serialize(java.lang.Object obj,
java.lang.String file)
Write a serialized version of the specified object to the given file. |
| 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean notify_listeners
protected boolean continuation
protected java.lang.String continuationPrompt
protected java.lang.StringBuffer pendingInput
protected Evaluable promptExpression
public boolean interrupt
| Constructor Detail |
public InteractiveEvaluator()
public InteractiveEvaluator(Options opts)
public InteractiveEvaluator(Evaluator parent)
public InteractiveEvaluator(EvaluatorManager manager)
| Method Detail |
public boolean inputReady(java.lang.String text)
InputConsumer
which is called when the
InputConsumer has new input
for it to process. This attempts to parse and evaluate the
expression provided in the text, having it appended it to any
outstanding input caused by incomplete expressions in previous
notifications.inputReady in interface InputConsumerpublic boolean inputReady(InputSupplier src)
InputSupplier. This extracts the input from the supplier
and passes it to the inputReady() method.inputReady in interface InputConsumerpublic java.lang.String prompt()
Options object associated with this evaluator.prompt in interface PromptSourcepublic boolean notify_listeners()
public boolean notify_listeners(boolean val)
public int notifyListeners(ExpressionInt e,
boolean task)
notifyListeners in class BasicEvaluatororg.omegahat.Environment.Interpreter.BasicEvaluatortask - indicates whether this is a top-level
expression or a sub-expression within a top-level task.public Evaluable promptExpression()
public Evaluable promptExpression(Evaluable expr)
public Evaluable promptExpression(java.lang.String str)
public void parserError(java.lang.Exception ex)
public java.io.ObjectOutputStream serialize(java.lang.Object obj,
java.lang.String file)
throws java.io.IOException
obj - object to be serialized.file - name of file to which the output should be serialized.
public java.io.ObjectOutputStream serialize(java.lang.Object obj,
java.io.File file)
throws java.io.IOException
public ExpressionInt currentExpression(ExpressionInt e)
BasicEvaluatoreval() methodcurrentExpression in class BasicEvaluator
public java.lang.Object evaluate(java.lang.Object expr,
java.lang.String input)
throws java.lang.Throwable
evaluate in class BasicEvaluator
public java.io.ObjectOutputStream serialize(java.lang.Object obj,
java.io.OutputStream stream)
throws java.io.IOException
public java.io.ObjectOutputStream serialize(java.lang.Object obj,
java.io.ObjectOutputStream stream)
throws java.io.IOException
public boolean interrupt()
public java.lang.Object deserialize(java.lang.String file)
throws java.lang.ClassNotFoundException,
java.io.StreamCorruptedException,
java.io.IOException,
java.io.OptionalDataException
public java.lang.Object deserialize(java.lang.String file,
boolean zip)
throws java.lang.ClassNotFoundException,
java.io.StreamCorruptedException,
java.io.IOException,
java.io.OptionalDataException
public java.lang.Object deserialize(java.io.File file)
throws java.lang.ClassNotFoundException,
java.io.StreamCorruptedException,
java.io.IOException,
java.io.OptionalDataException
public java.lang.Object deserialize(java.io.File file,
boolean zip)
throws java.lang.ClassNotFoundException,
java.io.StreamCorruptedException,
java.io.IOException,
java.io.OptionalDataException
public java.lang.Object deserialize(java.io.InputStream stream)
throws java.lang.ClassNotFoundException,
java.io.StreamCorruptedException,
java.io.IOException,
java.io.OptionalDataException
public java.lang.Object deserialize(java.io.ObjectInputStream stream)
throws java.lang.ClassNotFoundException,
java.io.IOException,
java.io.OptionalDataException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||