public interface StateMachine extends Processor, java.lang.AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
INITIAL_STATE_NAME
The name of temporary generated initial state.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(StateListener listener)
Add a new listener.
|
void |
addListener(TransitionListener listener)
Add a new listener.
|
void |
addPreprocessor(Preprocessor preprocessor)
Add a new preprocessor.
|
void |
addState(State state)
Add a new state.
|
void |
addTransition(Transition transition)
Add a new transition.
|
void |
close()
Finish processing of the events and free all allocated resources.
|
State |
getActiveState()
Get the currently active state.
|
java.util.Set<State> |
getActiveStates()
Get the currently active states.
|
java.util.Set<State> |
getStates()
Get all defined states.
|
java.util.Set<Transition> |
getTransitions()
Get all defined transitions.
|
boolean |
isInFinalState()
Is the active state a final state?
|
void |
setStartState(State state)
Set the start state.
|
void |
start()
Listeners of start state will be notified with non-loop transition from
temporary generated initial state and
StartEvent object. |
static final java.lang.String INITIAL_STATE_NAME
void setStartState(State state) throws FsmException
state - the stateFsmExceptionstart(),
Processor.process(Event)void addState(State state) throws FsmException
state - the stateFsmException - if something failsvoid addTransition(Transition transition) throws FsmException
transition - the transitionFsmException - if something failsvoid addPreprocessor(Preprocessor preprocessor)
preprocessor - the preprocessorProcessor.process(Event),
start(),
close()void addListener(StateListener listener)
listener - the listenervoid addListener(TransitionListener listener)
listener - the listenervoid start()
throws FsmException
StartEvent object.start in interface ProcessorFsmException - if something failsStartEvent,
INITIAL_STATE_NAMEvoid close()
ProcessorProcessor.close() should be
avoided. The behavior is not defined and may cause unpredictable
behavior, e.g. NullPointerException.close in interface java.lang.AutoCloseableclose in interface ProcessorProcessor.start()State getActiveState()
getActiveStates()java.util.Set<State> getActiveStates()
getActiveState()java.util.Set<State> getStates()
java.util.Set<Transition> getTransitions()
boolean isInFinalState()
Copyright 2012-2013 Michal Turek, AnotherFSM.