public class SCInstance extends Object implements Serializable
SCInstance
performs book-keeping functions for
a particular execution of a state chart represented by a
SCXML
object.Modifier | Constructor and Description |
---|---|
protected |
SCInstance(SCXMLIOProcessor internalIOProcessor,
Evaluator evaluator,
ErrorReporter errorReporter)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
cloneDatamodel(Datamodel datamodel,
Context ctx,
Evaluator evaluator,
ErrorReporter errorReporter)
Clone data model.
|
protected void |
detach()
Detach this state machine instance to allow external serialization.
|
Context |
getContext(EnterableState state)
Get the context for an EnterableState or create one if not created before.
|
Status |
getCurrentStatus() |
protected Evaluator |
getEvaluator() |
Context |
getGlobalContext() |
Set<EnterableState> |
getLastConfiguration(History history)
Get the last configuration for this history.
|
Context |
getRootContext()
Get the root context.
|
StateConfiguration |
getStateConfiguration() |
SCXML |
getStateMachine() |
Context |
getSystemContext()
Get the unwrapped (modifiable) system context.
|
protected void |
initialize()
(re)Initializes the state machine instance, clearing all variable contexts, histories and current status,
and clones the SCXML root datamodel into the root context.
|
boolean |
isRunning() |
boolean |
isSingleContext() |
void |
resetConfiguration(History history)
Resets the history state.
|
protected void |
setErrorReporter(ErrorReporter errorReporter)
Set or re-attach the error reporter
|
protected void |
setEvaluator(Evaluator evaluator,
boolean reAttach)
Set or re-attach the evaluator
If not re-attaching and this state machine instance has been initialized before,
it will be initialized again, destroying all existing state!
|
protected void |
setInternalIOProcessor(SCXMLIOProcessor internalIOProcessor)
Sets the I/O Processor for the internal event queue
|
void |
setLastConfiguration(History history,
Set<EnterableState> lc)
Set the last configuration for this history.
|
protected void |
setRootContext(Context context)
Set or replace the root context.
|
protected void |
setRunning(boolean running)
Sets the running status of the state machine
|
void |
setSingleContext(boolean singleContext) |
protected void |
setStateMachine(SCXML stateMachine)
Sets the state machine for this instance.
|
protected SCInstance(SCXMLIOProcessor internalIOProcessor, Evaluator evaluator, ErrorReporter errorReporter)
internalIOProcessor
- The I/O Processor for the internal event queueevaluator
- The evaluatorerrorReporter
- The error reporterprotected void initialize() throws ModelException
ModelException
- if the state machine hasn't been setup for this instanceprotected void detach()
This clears the internal I/O processor, evaluator and errorReporter members.
protected void setInternalIOProcessor(SCXMLIOProcessor internalIOProcessor)
internalIOProcessor
- the I/O Processorprotected void setEvaluator(Evaluator evaluator, boolean reAttach) throws ModelException
If not re-attaching and this state machine instance has been initialized before, it will be initialized again, destroying all existing state!
evaluator
- The evaluator for this state machine instance.ModelException
protected Evaluator getEvaluator()
protected void setErrorReporter(ErrorReporter errorReporter) throws ModelException
errorReporter
- The error reporter for this state machine instance.ModelException
- if an attempt is made to set a null value for the error reporterpublic SCXML getStateMachine()
protected void setStateMachine(SCXML stateMachine) throws ModelException
If this state machine instance has been initialized before, it will be initialized again, destroying all existing state!
stateMachine
- The state machine for this instanceModelException
- if an attempt is made to set a null value for the state machinepublic void setSingleContext(boolean singleContext) throws ModelException
ModelException
public boolean isSingleContext()
protected void cloneDatamodel(Datamodel datamodel, Context ctx, Evaluator evaluator, ErrorReporter errorReporter)
ctx
- The context to clone to.datamodel
- The datamodel to clone.evaluator
- The expression evaluator.errorReporter
- The error reporterpublic StateConfiguration getStateConfiguration()
public Status getCurrentStatus()
public boolean isRunning()
protected void setRunning(boolean running) throws IllegalStateException
running
- flag indicating the running status of the state machineIllegalStateException
- Exception thrown if trying to set the state machine running when in a Final statepublic Context getRootContext()
protected void setRootContext(Context context)
context
- The new root context.public Context getSystemContext()
public Context getGlobalContext()
public Context getContext(EnterableState state)
state
- The EnterableState.public Set<EnterableState> getLastConfiguration(History history)
history
- The history.public void setLastConfiguration(History history, Set<EnterableState> lc)
history
- The history.lc
- The lastConfiguration to set.public void resetConfiguration(History history)
Note: used for testing purposes only
history
- The history.Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.