|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.expression.ExState
A class used to maintain runtime state during expression evaluation.
This may be subclassed by an application to provide implementaions of the methods resolveReference and resolveCall to handle special references to external functions and variables.
Nested Class Summary | |
protected class |
ExState.ExBreakpointContext
|
Field Summary | |
static java.lang.String |
code_id
|
Constructor Summary | |
ExState()
Construct a new expression state object. |
Method Summary | |
void |
addError(java.lang.Object msg)
Add an error message. |
void |
addResolver(java.lang.Object res)
Add a resolver. |
protected void |
beginTrace(ExNode node)
Format the beginning of a trace message for a node. |
void |
beginTrace(java.lang.String context)
Special trace method used for function calls and variable references, where we may "jump" to a new evaluation context that isn't obvious from the trace unless we wrap it in something. |
void |
breakpoint()
Called by the |
void |
breakpointEnd(com.sun.idm.debugger.common.Locatable locatable)
|
void |
breakpointEnd(com.sun.idm.debugger.common.Locatable locatable,
java.lang.Object lastValue)
|
protected void |
breakpointEndAndTrace(ExNode node,
ExValue retval)
Convenience method which calls endTrace and breakpointEnd |
void |
breakpointStart(com.sun.idm.debugger.common.Locatable locatable)
|
protected void |
breakpointStartAndTrace(ExNode node)
Convenience method which calls breakpointStart and beginTrace |
boolean |
checkBreak(java.lang.String name)
Called by statements that need to support breaking. |
void |
clearErrors()
Clear the error list. |
void |
clearGlobalBindings()
Clear the global bindings. |
void |
clearTrace()
Clears the trace buffer. |
protected ExState.ExBreakpointContext |
createBreakpointContext()
Creates a breakpoint context. |
protected void |
endTrace(ExNode node,
ExValue retval)
Format the end of a trace message for a node. |
void |
endTrace(java.lang.String context,
ExValue retval)
Special trace method for "called" contexts. |
void |
endTrace(java.lang.String context,
java.lang.Object retval)
Special trace method for "called" contexts. |
protected void |
enterScope(ExNode node,
ExNode[] arglist)
Enter a node scope. |
protected java.lang.Object |
externalCall(java.lang.String name,
java.util.List args)
|
protected java.lang.Object |
externalReference(ExReference node)
Resolve a variable reference. |
java.lang.Object |
externalRule(java.lang.String name,
java.util.Map args)
|
protected java.util.Map |
externalRuleArguments()
|
void |
free()
Releases a state object back to the pool |
static void |
freeState(ExState s)
Releases a state object back to the pool. |
void |
freeValue(ExValue s)
Return a value object back to the pool. |
protected ExNode |
getArgInitializer(ExDefvar arg,
int psn)
Locate a function argument initializer. |
protected ExValue |
getBinding(ExDefvar var)
Return the bound value of a variable. |
ExState.ExBreakpointContext |
getBreakpointContext()
Returns our BreakpointContext |
java.util.List |
getErrors()
Get the error list. |
InvokeInterceptor |
getInvokeInterceptor()
|
protected ExDefun |
getLibraryFunction(java.lang.String name)
Look up the definition of a library function. |
java.util.Locale |
getLocale()
|
java.util.Map |
getRuleArguments()
|
static ExState |
getState()
Obtains a pooled state object. |
java.lang.String |
getTrace()
Returns the current contents of the trace buffer as a String. |
java.lang.StringBuffer |
getTraceBuffer()
Returns the trace buffer. |
void |
initBindings()
Tear down all stacked scopes and return them to the pool. |
boolean |
isAllowExceptions()
Test the allow exceptions flag. |
boolean |
isConsoleTraceEnabled()
Returns true if console tracing is enabled. |
boolean |
isPrintEnabled()
Test the option that enables output from |
boolean |
isTraceEnabled()
Tests to see if tracing is enabled. |
protected void |
leaveScope(ExNode node)
Leave a node scope. |
void |
loadLibrary(ExEnvironment env)
A library loader that accepts an ExEnvironment. |
void |
loadLibrary(ExNode node)
Load a library of functions contained within the node. |
void |
loadLibrary(java.util.List objects)
Examine a list of objects, and link any ExDefuns we find. |
void |
markBreakpointStack()
|
ExValue |
newValue()
Obtain a value object from the pool. |
ExValue |
newValue(int i)
Convenience method to obtain a new value from the pool and assign it an int. |
ExValue |
newValue(java.lang.Object o)
Convenience method to obtain a new value from the pool and assign it an object. |
void |
print(java.lang.String msg)
Called by the |
static void |
println(java.lang.String msg)
|
void |
printTrace()
Flush the trace buffer to the console. |
protected ExValue |
promoteValue(ExValue src)
Return a value that can be modified and returned. |
void |
removeResolver(java.lang.Object res)
Remove a resolver. |
java.lang.Object |
resolveCall(java.lang.String name,
java.util.List args)
|
java.lang.Object |
resolveObject(java.lang.String path)
Implement this if you want to resolve |
java.lang.Object |
resolveReference(java.lang.String name)
|
java.lang.Object |
resolveRule(java.lang.String name,
java.util.Map args)
|
java.lang.Object |
resolveVariable(java.lang.String name)
This is the VariableResolver interface method. |
void |
setAllowExceptions(boolean b)
Set the exception propagation flag. |
protected void |
setBinding(ExDefvar var,
ExValue value)
Set the binding of variable. |
void |
setConsoleTraceEnable(boolean t)
Enable or disable tracing to the console. |
void |
setConsoleTraceEnable(boolean t,
boolean force)
Enable or disable tracing to the console. |
void |
setExternal(java.lang.String name,
java.lang.Object value)
|
void |
setInvokeInterceptor(InvokeInterceptor i)
|
void |
setLocale(java.util.Locale l)
Set the locale for Message rendering. |
void |
setPrimaryResolver(ExResolver re)
Set the primary resolver. |
void |
setPrintEnable(boolean b)
Enable or disable output from |
void |
setPrintStream(java.io.PrintStream ps)
Set the output stream for |
void |
setTraceEnable(boolean t)
Enable or diable evaluation tracing. |
void |
setTraceEnable(boolean t,
boolean force)
Enable or diable evaluation tracing. |
void |
signalBreak(java.lang.String name)
Signal an execution break. |
protected void |
trace(java.lang.String msg)
Append something to the trace buffer. |
void |
unwindBreakpointStack()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
Constructor Detail |
public ExState()
Method Detail |
public java.lang.Object resolveReference(java.lang.String name) throws WavesetException
WavesetException
public java.lang.Object resolveCall(java.lang.String name, java.util.List args) throws WavesetException
WavesetException
public java.lang.Object resolveRule(java.lang.String name, java.util.Map args) throws WavesetException
WavesetException
public java.lang.Object resolveObject(java.lang.String path) throws WavesetException
WavesetException
public void setExternal(java.lang.String name, java.lang.Object value) throws WavesetException
WavesetException
public java.util.Map getRuleArguments()
public static ExState getState()
public static void freeState(ExState s)
public void free()
public void setLocale(java.util.Locale l)
public java.util.Locale getLocale()
public void setPrimaryResolver(ExResolver re)
public void addResolver(java.lang.Object res)
public void removeResolver(java.lang.Object res)
public void setInvokeInterceptor(InvokeInterceptor i)
public InvokeInterceptor getInvokeInterceptor()
public java.lang.Object resolveVariable(java.lang.String name) throws WavesetException
resolveVariable
in interface VariableResolver
WavesetException
protected java.lang.Object externalReference(ExReference node) throws WavesetException
WavesetException
protected java.lang.Object externalCall(java.lang.String name, java.util.List args) throws WavesetException
WavesetException
public java.lang.Object externalRule(java.lang.String name, java.util.Map args) throws WavesetException
WavesetException
protected java.util.Map externalRuleArguments() throws WavesetException
WavesetException
public boolean isAllowExceptions()
public void setAllowExceptions(boolean b)
public void clearErrors()
public java.util.List getErrors()
public void addError(java.lang.Object msg)
public ExValue newValue()
public ExValue newValue(java.lang.Object o)
public ExValue newValue(int i)
public void freeValue(ExValue s)
protected ExValue promoteValue(ExValue src)
If the value is interned, or has a a reference count more than one, we have to copy the value.
public void initBindings()
protected void enterScope(ExNode node, ExNode[] arglist)
protected void leaveScope(ExNode node)
protected ExValue getBinding(ExDefvar var) throws WavesetException
WavesetException
public void clearGlobalBindings()
protected void setBinding(ExDefvar var, ExValue value) throws WavesetException
WavesetException
protected ExNode getArgInitializer(ExDefvar arg, int psn) throws WavesetException
WavesetException
public void setPrintEnable(boolean b)
public boolean isPrintEnabled()
public void setPrintStream(java.io.PrintStream ps)
public void setTraceEnable(boolean t)
The trace messages are accumulated in an internal StringBuffer that may be accessed with the getTrace or getTraceBuffer methods. Setting this true does not cause the trace messages to be sent to the console, they are only accumulated in the trace buffer. The host application must call getTrace to retrieve the contents of the trace buffer and display it in an appropriate way.
If Waveset.properties turns on trace, this is ignored.
public void setTraceEnable(boolean t, boolean force)
The trace messages are accumulated in an internal StringBuffer that may be accessed with the getTrace or getTraceBuffer methods. Setting this true does not cause the trace messages to be sent to the console, they are only accumulated in the trace buffer. The host application must call getTrace to retrieve the contents of the trace buffer and display it in an appropriate way.
If force is set to true, it will override whatever is specified in Waveset.properties and override whatever is specified by the block element's trace attribute.
public void setConsoleTraceEnable(boolean t)
Unlike setTraceEnable, setting this option will cause trace messages to be sent immediately to the console. They will not accumulate in the trace buffer.
If Waveset.properties turns on trace, this is ignored.
public void setConsoleTraceEnable(boolean t, boolean force)
Unlike setTraceEnable, setting this option will cause trace messages to be sent immediately to the console. They will not accumulate in the trace buffer.
If force is set to true, it will override the settings in Waveset.properties and override whatever is specified by the block element's trace attribute.
public boolean isTraceEnabled()
public boolean isConsoleTraceEnabled()
public java.lang.String getTrace()
public java.lang.StringBuffer getTraceBuffer()
This might be used by host applications that want to add things to the trace buffer.
public void clearTrace()
public void printTrace()
protected void beginTrace(ExNode node)
protected final void breakpointStartAndTrace(ExNode node)
public void beginTrace(java.lang.String context)
protected void endTrace(ExNode node, ExValue retval)
protected final void breakpointEndAndTrace(ExNode node, ExValue retval)
public void endTrace(java.lang.String context, ExValue retval)
public void endTrace(java.lang.String context, java.lang.Object retval)
protected void trace(java.lang.String msg)
public void signalBreak(java.lang.String name)
The name is optional, if specified, we will unwind until we locate an expression with the name.
public boolean checkBreak(java.lang.String name)
protected ExDefun getLibraryFunction(java.lang.String name)
Here, we look to see if a function with this name has been registered in our "link map".
public void loadLibrary(ExEnvironment env)
public void loadLibrary(ExNode node)
public void loadLibrary(java.util.List objects)
public void breakpoint()
This is a convenient place to park a debugger breakpoint, then
insert
public void print(java.lang.String msg)
public static void println(java.lang.String msg)
public final ExState.ExBreakpointContext getBreakpointContext()
public void breakpointStart(com.sun.idm.debugger.common.Locatable locatable)
public void breakpointEnd(com.sun.idm.debugger.common.Locatable locatable)
public void breakpointEnd(com.sun.idm.debugger.common.Locatable locatable, java.lang.Object lastValue)
public void markBreakpointStack()
public void unwindBreakpointStack()
protected ExState.ExBreakpointContext createBreakpointContext()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |