java.lang.Object
org.praxislive.script.AbstractSingleCallFrame
- All Implemented Interfaces:
StackFrame
An abstract
StackFrame for commands that need to make a stack frame
that makes a single call and processes its response.
Subclasses should implement
createCall(org.praxislive.script.Env, java.util.List) to create the
call when required. Subclasses may additionally override
processResult(java.util.List) if the need to alter the return values
from the call.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.praxislive.script.StackFrame
StackFrame.State -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSingleCallFrame(Namespace namespace, List<Value> args) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CallcreateCall(Env env, List<Value> args) Create the Call.final Namespacefinal StackFrame.StategetState()Get the current state of this StackFrame.final voidpostResponse(Call response) Used by the script executor to post the result of a Call.final voidpostResponse(StackFrame.State state, List<Value> args) Used by the script executor to post the result of a child StackFrame returned byStackFrame.process(org.praxislive.script.Env).final StackFrameProcess the StackFrame.processResult(List<Value> result) Process the result from the call on a successful response.result()Access the result of this StackFrame.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.praxislive.script.StackFrame
andThen, andThenMap, onError
-
Constructor Details
-
AbstractSingleCallFrame
-
-
Method Details
-
getState
Description copied from interface:StackFrameGet the current state of this StackFrame.- Specified by:
getStatein interfaceStackFrame- Returns:
- current state
-
getNamespace
-
process
Description copied from interface:StackFrameProcess the StackFrame. After processing, the StackFrame should have made one or more Calls, returned a child StackFrame, or moved out of the Incomplete state.Process may be called multiple times if the state is still incomplete after this method returns and a response has been posted.
- Specified by:
processin interfaceStackFrame- Parameters:
env- processing environment- Returns:
- child StackFrame or null
-
postResponse
Description copied from interface:StackFrameUsed by the script executor to post the result of a Call. The StackFrame should validate the match ID of the response call against any pending calls before processing the call state or arguments.If the state is still incomplete after a response is posted,
StackFrame.process(org.praxislive.script.Env)will be called again.- Specified by:
postResponsein interfaceStackFrame- Parameters:
response- response call
-
postResponse
Description copied from interface:StackFrameUsed by the script executor to post the result of a child StackFrame returned byStackFrame.process(org.praxislive.script.Env).If the state is still incomplete after a response is posted,
StackFrame.process(org.praxislive.script.Env)will be called again.- Specified by:
postResponsein interfaceStackFrame- Parameters:
state- the completion state of the child stack frameargs- the result of the child stack frame
-
result
Description copied from interface:StackFrameAccess the result of this StackFrame.- Specified by:
resultin interfaceStackFrame- Returns:
- result
-
createCall
Create the Call. The call must useEnv.getAddress()as the from address, and require a response.- Parameters:
env- environment for address, time, etc.args- command arguments- Returns:
- call
- Throws:
Exception- on error
-
processResult
Process the result from the call on a successful response. Unless this method is overridden the result of the stack frame will be the result of the call.- Parameters:
result- successful result from call- Returns:
- processed result
-