public class FSMBuilder
extends java.lang.Object
Constructor and Description |
---|
FSMBuilder()
Initializes the
FSMBuilder . |
FSMBuilder(Step[] fsmSteps)
Creates an FSMBuilder that is initialized to contain the specified
Steps.
|
Modifier and Type | Method and Description |
---|---|
void |
addStateTrans(java.lang.Object trans,
java.lang.Object targetStateID)
Adds the specified transition to the FSM state.
|
FSM |
getFSM()
Returns an
FSM for the specification that has been built
up using this FSMBuilder . |
void |
newFinalState(java.lang.Object stateID,
Step step)
Tells the builder to create a new final state in the FSM.
|
static FSM |
newFSM(Step[] steps)
Returns an FSM that is entirely based on the sequence of Steps
specified.
|
void |
newStartState(Step step,
java.lang.Object defaultTargetStateID)
Tells the builder to create a new start state in the FSM.
|
void |
newState(java.lang.Object stateID,
Step step,
java.lang.Object defaultTargetStateID)
Tells the builder to create a new non-final state in the FSM.
|
void |
newState(java.lang.Object stateID,
Step step,
java.lang.Object defaultTargetStateID,
boolean isFinalState)
Tells the builder to create a new state in the FSM.
|
void |
setDefaultTrans(java.lang.Object targetStateID)
Sets the specified target state ID as the default transition for
the current FSM state.
|
public FSMBuilder()
FSMBuilder
. The newState()
method should be called immediately after creating a new
FSMBuilder
; generally, you would want to create the
START_STATE
first.public FSMBuilder(Step[] fsmSteps)
Consider calling newFSM(Step[])
instead if you do not
need to configure the FSMBuilder beyond the initial Step array.
public static FSM newFSM(Step[] steps)
java.lang.IllegalArgumentException
- if the specified Step array
is null or has no elements.public void newStartState(Step step, java.lang.Object defaultTargetStateID)
#newState(Object, Step, boolean)
to add a start state
that is also a final state.
Subsequent calls to addStateTrans(..)
will be
relative to the newly created start state.
If the specified stateID
already exists in the FSM,
the existing state will be replaced.
defaultTargetStateID
- The stateID of the state that this state
should transition to by default when no explicit transition matches.
If this parameter is null, no default target will be set.public void newState(java.lang.Object stateID, Step step, java.lang.Object defaultTargetStateID)
addStateTrans(..)
will be
relative to this newly created state.
If the specified stateID
already exists in the FSM,
the existing state will be replaced.
defaultTargetStateID
- The stateID of the state that this state
should transition to by default when no explicit transition matches.
If this parameter is null, no default target will be set.public void newFinalState(java.lang.Object stateID, Step step)
addStateTrans(..)
will be
relative to this newly created state.
If the specified stateID
already exists in the FSM,
the existing state will be replaced.
public void newState(java.lang.Object stateID, Step step, java.lang.Object defaultTargetStateID, boolean isFinalState)
addStateTrans(..)
will be
relative to this newly created state.
If the specified stateID
already exists in the FSM,
the existing state will be replaced.
stateID
- The object that identifies the state in the FSM.step
- The Step that represents the activity of the state.defaultTargetStateID
- The stateID of the state that this state
should transition to by default when no explicit transition matches.
If this parameter is null, no default target will be set.isFinalState
- public void setDefaultTrans(java.lang.Object targetStateID)
public void addStateTrans(java.lang.Object trans, java.lang.Object targetStateID)
trans
occurs in this FSM state, the FSM will move to
the state identified by targetStateID
.public FSM getFSM() throws FSMInvalidException
FSM
for the specification that has been built
up using this FSMBuilder
. If the FSM specification is
invalid, an FSMInvalidException
is thrown.FSMInvalidException