se.ericsson.eto.norarc.javaframe
Class CompositeState

java.lang.Object
  extended byse.ericsson.eto.norarc.javaframe.State
      extended byse.ericsson.eto.norarc.javaframe.CompositeState
All Implemented Interfaces:
java.io.Serializable

public abstract class CompositeState
extends State

CompositeState is a State with inner States. A CompositeState has 1 or more entry and exit ports that connects the CompositeState to its environment. The ports are identified by an entry index or an exit index (int). A CompositeState may have a default entry port (not identified by an index).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class se.ericsson.eto.norarc.javaframe.State
enclosingState, stateName
 
Constructor Summary
CompositeState()
          CompositeState constructor with default name.
CompositeState(java.lang.String sn)
          CompositeState constructor with user supplied name.
 
Method Summary
 void enterState(int enterNo, StateMachine curfsm)
          Enter this CompositeState through a given entry port.
 void enterState(StateMachine curfsm)
          Enter this CompositeState through the default entry port.
protected abstract  boolean execTrans(Message sig, State st, StateMachine curfsm)
          Execute transition (if defined) for Message sig and State st.
protected  void exitState(int exitNo, StateMachine curfsm)
          Leave this CompositeState through a given exit port.
protected  void outofInnerCompositeState(CompositeState cs, int exNo, StateMachine curfsm)
          Executes linking code when an inner CompositeState leaves through a given exit port.
protected  void performExit(StateMachine curfsm)
          Execute exit() from currentState up to (but not including) this CompositeState.
protected  void sameState(StateMachine curfsm)
          Remain in the same State of the StateMachine.
protected  void save(Message sig, StateMachine curfsm)
          The received Message is not to be consumed and handled in this State and the Message is saved in order to be handled later in another State.
 
Methods inherited from class se.ericsson.eto.norarc.javaframe.State
entry, exit, output, stateName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeState

public CompositeState(java.lang.String sn)
CompositeState constructor with user supplied name.

Parameters:
sn - The name of this CompositeState.

CompositeState

public CompositeState()
CompositeState constructor with default name.

Method Detail

exitState

protected final void exitState(int exitNo,
                               StateMachine curfsm)
Leave this CompositeState through a given exit port. The method is to be used within the methods execTrans() or outofInnerCompositeState().

Parameters:
exitNo - Index of the exit port.
curfsm - The current StateMachine.

performExit

protected final void performExit(StateMachine curfsm)
Execute exit() from currentState up to (but not including) this CompositeState. The method is to be used within the method execTrans().

Parameters:
curfsm - The current StateMachine.

sameState

protected final void sameState(StateMachine curfsm)
Remain in the same State of the StateMachine. The method is to be used within the method execTrans(). Notice that entry() of this State will not be executed. That means performExit() should neither have been called.

Parameters:
curfsm - The current StateMachine.

save

protected final void save(Message sig,
                          StateMachine curfsm)
The received Message is not to be consumed and handled in this State and the Message is saved in order to be handled later in another State. The method is to be used within the method execTrans().

Parameters:
sig - The Message that will be saved (assumed to be != null).
curfsm - The StateMachine that conceptually performs this operation (assumed to be != null).

enterState

public void enterState(int enterNo,
                       StateMachine curfsm)
Enter this CompositeState through a given entry port. enterState links the given entry port with an inner State based on the value of the entry index. It may also contain optional user transition code. Note: enterState has two versions
- with entry port index
- without entry port index (entry through the default entry port).
For each CompositeState class at least one of the enterState methods has to be redefined. NB: enterState is called from user transition code.

Parameters:
enterNo - Index of the entry port.
curfsm - The current StateMachine.

enterState

public void enterState(StateMachine curfsm)
Enter this CompositeState through the default entry port. enterState links the default entry port with an inner State. It may also contain optional user transition code. NB: enterState is called from user transition code.

Overrides:
enterState in class State
Parameters:
curfsm - The current StateMachine.

execTrans

protected abstract boolean execTrans(Message sig,
                                     State st,
                                     StateMachine curfsm)
Execute transition (if defined) for Message sig and State st. For each CompositeState class execTrans has to be defined. It defines the transitions (and saves) handled by its inner States (not included those inside inner CompositeStates). NB: execTrans is not called from user code.

Parameters:
sig - The consumed Message.
st - The State to search for defined transition.
curfsm - The performing StateMachine.
Returns:
If a transition has been executed (or save), then return true.

outofInnerCompositeState

protected void outofInnerCompositeState(CompositeState cs,
                                        int exNo,
                                        StateMachine curfsm)
Executes linking code when an inner CompositeState leaves through a given exit port. For each CompositeState class with inner CompositeStates the operation outofInnerCompositeState has to be defined. It will link the given exit port with an inner singular State, the entry port of an inner CompositeState, or an exit port of this CompositeState. NB: outofInnerCompositeState is not called from user code.

Parameters:
cs - The inner CompositeState that is leaving.
exNo - Index of the exit port of the inner CompositeState.
curfsm - The current StateMachine.