The Meta-Environment API

toolbus
Class State

java.lang.Object
  extended by toolbus.State

public class State
extends java.lang.Object

class State represents one state in the state diagram of a process. It consists of StateElements


Field Summary
private  boolean allAtoms
           
private  java.util.IdentityHashMap<StateElement,java.lang.Boolean> cache
           
private  java.util.List<StateElement> elements
           
private  int lastElement
           
private  int nElements
           
 
Constructor Summary
State()
           
 
Method Summary
 void activate()
           
 void addElement(StateElement a)
           
 boolean contains(StateElement a)
           
 toolbus.process.debug.ExecutionResult debugExecute()
          Executes one step in debug mode and returns the executed state element as result.
 void delElement(StateElement a)
           
 boolean execute()
          Execute one step for an element in this state.
 java.util.List<StateElement> getElementsAsList()
           
 StateElement getLastExecutedStateElement()
          Returns the last executed state element in the current state.
 java.util.List<StateElement> getUnhandledMessages()
           
 State gotoNextStateAndActivate()
           
 State gotoNextStateAndActivate(StateElement a)
           
 boolean isEnabled()
           
 void setTest(aterm.ATerm test, Environment env)
           
 int size()
           
 java.lang.String toString()
           
 State union(State b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

elements

private final java.util.List<StateElement> elements

cache

private final java.util.IdentityHashMap<StateElement,java.lang.Boolean> cache

nElements

private int nElements

lastElement

private int lastElement

allAtoms

private boolean allAtoms
Constructor Detail

State

public State()
Method Detail

addElement

public void addElement(StateElement a)

delElement

public void delElement(StateElement a)

union

public State union(State b)

getElementsAsList

public java.util.List<StateElement> getElementsAsList()

size

public int size()

setTest

public void setTest(aterm.ATerm test,
                    Environment env)
             throws ToolBusException
Throws:
ToolBusException

isEnabled

public boolean isEnabled()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

contains

public boolean contains(StateElement a)

gotoNextStateAndActivate

public State gotoNextStateAndActivate()

gotoNextStateAndActivate

public State gotoNextStateAndActivate(StateElement a)

activate

public void activate()

execute

public boolean execute()
                throws ToolBusException
Execute one step for an element in this state.

Throws:
ToolBusException

debugExecute

public toolbus.process.debug.ExecutionResult debugExecute()
                                                   throws ToolBusException
Executes one step in debug mode and returns the executed state element as result.

Returns:
The result of the execution (if contains the state element and partners); null if none was executed.
Throws:
ToolBusException - Thrown if something went wrong.

getLastExecutedStateElement

public StateElement getLastExecutedStateElement()
Returns the last executed state element in the current state. (This method is used for debugging only).

Returns:
The last executed state element in the current state.

getUnhandledMessages

public java.util.List<StateElement> getUnhandledMessages()

The Meta-Environment API