The Meta-Environment API

toolbus
Interface StateElement

All Known Implementing Classes:
AckEvent, Assign, Atom, Connect, Create, Delta, DisConnect, Do, DynamicProcessCall, Eval, Event, Execute, GetPerfStats, LeftBiasedAlternative, Merge, MsgAtom, NoNote, Print, ProcessCall, RecMsg, RecNote, RecPerfStats, RecRequest, RecVal, RightBiasedAlternative, ShutDown, SndKill, SndMsg, SndNote, SndResponse, Subscribe, Tau, Terminate, UnSubscribe

public interface StateElement

The interface StateElement captures all operations that can be performed on an element of a State. Recall that all proces expressions are compiled to a finite automaton consisting of States and transitions. The most typical example of a StateElement is an Atom.


Method Summary
 void activate()
          Activate the StateElement, i.e.
 boolean contains(StateElement elem)
          Check whether a StateElement contains another StateElement.
 ProcessInstance[] debugExecute()
          Executes the state element in debug mode.
 boolean execute()
          Execute this StateElement
 State getFollow()
           
 PositionInformation getPosInfo()
          Returns the position information associated to the implementing state element.
 ProcessInstance getProcess()
           
 java.util.List<aterm.ATerm> getTests()
          Returns a collection containing all tests that are associated with this state element.
 State gotoNextStateAndActivate()
           
 State gotoNextStateAndActivate(StateElement elem)
          Get the successor of the StateElement for a given other StateElement elem.
 boolean isEnabled()
          Is this StateElelement enabled for execution, i.e., are its associated tests all true? If enabled, the StateElement is ready for execution.
 void setTest(aterm.ATerm test, Environment env)
          Add a test to this state element.
 

Method Detail

contains

boolean contains(StateElement elem)
Check whether a StateElement contains another StateElement. In the simplest case of Atom this is just an identity test. In composite cases (e.g. Merge), it requires a recursive search.

Parameters:
elem - the StateElement
Returns:
true (contained in) or false (not contained in)

setTest

void setTest(aterm.ATerm test,
             Environment env)
             throws ToolBusException
Add a test to this state element. Tests implement conditionals but not delays / timeouts.

Parameters:
test -
env - to be used for executing the test
Throws:
ToolBusException

getTests

java.util.List<aterm.ATerm> getTests()
Returns a collection containing all tests that are associated with this state element.

Returns:
A collection containing all tests that are associated with this state element.

isEnabled

boolean isEnabled()
                  throws ToolBusException
Is this StateElelement enabled for execution, i.e., are its associated tests all true? If enabled, the StateElement is ready for execution.

Returns:
true (enabled) or false (not enabled).
Throws:
ToolBusException

getProcess

ProcessInstance getProcess()
Returns:
the ProcessInstance to which the StateElement belongs

activate

void activate()
Activate the StateElement, i.e. make it ready for execution. This may involve initialization and the setting of timers.


execute

boolean execute()
                throws ToolBusException
Execute this StateElement

Returns:
true if execution was completed.
Throws:
ToolBusException

debugExecute

ProcessInstance[] debugExecute()
                               throws ToolBusException
Executes the state element in debug mode.

Returns:
The collection of partners that cooperated with the execution of the state element. Null if the execution did not complete.
Throws:
ToolBusException

gotoNextStateAndActivate

State gotoNextStateAndActivate()
Returns:
the successor State of the StateElement

gotoNextStateAndActivate

State gotoNextStateAndActivate(StateElement elem)
Get the successor of the StateElement for a given other StateElement elem. This typically used for a composite StateElement to get a specific successor. TODO: Probably this method should be combined with the previous one.

Parameters:
elem -
Returns:
the successor State of the StateElement

getPosInfo

PositionInformation getPosInfo()
Returns the position information associated to the implementing state element.

Returns:
The position information associated to the implementing state element.

getFollow

State getFollow()
See Also:
ProcessExpression.getFollow()

The Meta-Environment API