org.squirrelframework.foundation.fsm.impl
Class StateMachineDataImpl<T extends StateMachine<T,S,E,C>,S,E,C>

java.lang.Object
  extended by org.squirrelframework.foundation.fsm.impl.StateMachineDataImpl<T,S,E,C>
All Implemented Interfaces:
Serializable, StateMachineData<T,S,E,C>, StateMachineData.Reader<T,S,E,C>, StateMachineData.Writer<T,S,E,C>

public class StateMachineDataImpl<T extends StateMachine<T,S,E,C>,S,E,C>
extends Object
implements StateMachineData<T,S,E,C>, StateMachineData.Reader<T,S,E,C>, StateMachineData.Writer<T,S,E,C>

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.squirrelframework.foundation.fsm.StateMachineData
StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>, StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>
 
Constructor Summary
StateMachineDataImpl()
           
StateMachineDataImpl(Map<S,ImmutableState<T,S,E,C>> states)
           
 
Method Summary
 Collection<S> activeParentStates()
           
 ImmutableState<T,S,E,C> currentRawState()
           
 S currentState()
           
 void currentState(S currentStateId)
          Write current state of state machine data to provided state id
 void dump(StateMachineData.Reader<T,S,E,C> src)
          Dump source state machine data (expect transient data, such as states) into current state machine data
 String identifier()
           
 void identifier(String id)
           
 void initalState(S initialStateId)
          Write initial state of state machine data to provided state id
 ImmutableState<T,S,E,C> initialRawState()
           
 S initialState()
           
 void lastActiveChildStateFor(S parentStateId, S childStateId)
          Set last active child state of parent state
 S lastActiveChildStateOf(S parentStateId)
           
 ImmutableState<T,S,E,C> lastRawState()
           
 S lastState()
           
 void lastState(S lastStateId)
          Write last state of state machine data to provided state id
 StateMachineData.Reader<? extends StateMachine<?,S,E,C>,S,E,C> linkedStateDataOf(S linkedState)
           
 void linkedStateDataOn(S linkedState, StateMachineData.Reader<? extends StateMachine<?,S,E,C>,S,E,C> linkStateData)
          Write linked state data on specified linked state
 Collection<S> linkedStates()
           
 Map<S,ImmutableState<T,S,E,C>> orginalStates()
           
 Collection<S> parallelStates()
           
 ImmutableState<T,S,E,C> rawStateFrom(S stateId)
           
 Collection<ImmutableState<T,S,E,C>> rawStates()
           
 StateMachineData.Reader<T,S,E,C> read()
           
 void removeSubState(S parentStateId, S subStateId)
          Remove provide sub state under provided parent state
 void removeSubStatesOn(S parentStateId)
          Remove all sub states under provider parent state
 Collection<S> states()
           
 void subStateFor(S parentStateId, S subStateId)
          Write provided sub state for provided parent state
 List<S> subStatesOn(S parentStateId)
           
 Class<C> typeOfContext()
           
 void typeOfContext(Class<C> contextClass)
          Write type of context
 Class<E> typeOfEvent()
           
 void typeOfEvent(Class<E> eventClass)
          Write type of event
 Class<S> typeOfState()
           
 void typeOfState(Class<S> stateClass)
          Write type of state
 Class<? extends T> typeOfStateMachine()
           
 void typeOfStateMachine(Class<? extends T> stateMachineType)
          Write type of state machine
 StateMachineData.Writer<T,S,E,C> write()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateMachineDataImpl

public StateMachineDataImpl(Map<S,ImmutableState<T,S,E,C>> states)

StateMachineDataImpl

public StateMachineDataImpl()
Method Detail

orginalStates

public Map<S,ImmutableState<T,S,E,C>> orginalStates()
Specified by:
orginalStates in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>

dump

public void dump(StateMachineData.Reader<T,S,E,C> src)
Description copied from interface: StateMachineData
Dump source state machine data (expect transient data, such as states) into current state machine data

Specified by:
dump in interface StateMachineData<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
src - source state machine data

read

public StateMachineData.Reader<T,S,E,C> read()
Specified by:
read in interface StateMachineData<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
state machine data reader

write

public StateMachineData.Writer<T,S,E,C> write()
Specified by:
write in interface StateMachineData<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
state machine data writer

currentState

public void currentState(S currentStateId)
Description copied from interface: StateMachineData.Writer
Write current state of state machine data to provided state id

Specified by:
currentState in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

lastState

public void lastState(S lastStateId)
Description copied from interface: StateMachineData.Writer
Write last state of state machine data to provided state id

Specified by:
lastState in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

initalState

public void initalState(S initialStateId)
Description copied from interface: StateMachineData.Writer
Write initial state of state machine data to provided state id

Specified by:
initalState in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

lastActiveChildStateFor

public void lastActiveChildStateFor(S parentStateId,
                                    S childStateId)
Description copied from interface: StateMachineData.Writer
Set last active child state of parent state

Specified by:
lastActiveChildStateFor in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
parentStateId - id of parent state
childStateId - id of child state

subStateFor

public void subStateFor(S parentStateId,
                        S subStateId)
Description copied from interface: StateMachineData.Writer
Write provided sub state for provided parent state

Specified by:
subStateFor in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

removeSubState

public void removeSubState(S parentStateId,
                           S subStateId)
Description copied from interface: StateMachineData.Writer
Remove provide sub state under provided parent state

Specified by:
removeSubState in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

removeSubStatesOn

public void removeSubStatesOn(S parentStateId)
Description copied from interface: StateMachineData.Writer
Remove all sub states under provider parent state

Specified by:
removeSubStatesOn in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

identifier

public void identifier(String id)
Specified by:
identifier in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

identifier

public String identifier()
Specified by:
identifier in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
state machine identifier

currentState

public S currentState()
Specified by:
currentState in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
current state id of state machine

lastState

public S lastState()
Specified by:
lastState in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
last active state id of state machine

initialState

public S initialState()
Specified by:
initialState in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
id of state machine initial state

lastActiveChildStateOf

public S lastActiveChildStateOf(S parentStateId)
Specified by:
lastActiveChildStateOf in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
parentStateId - id of parent state
Returns:
last active child state of the parent state

activeParentStates

public Collection<S> activeParentStates()
Specified by:
activeParentStates in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
all the active parent states

subStatesOn

public List<S> subStatesOn(S parentStateId)
Specified by:
subStatesOn in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
sub state of parallel state

currentRawState

public ImmutableState<T,S,E,C> currentRawState()
Specified by:
currentRawState in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
current raw state of state machine

lastRawState

public ImmutableState<T,S,E,C> lastRawState()
Specified by:
lastRawState in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
last active raw state of state machine

rawStateFrom

public ImmutableState<T,S,E,C> rawStateFrom(S stateId)
Specified by:
rawStateFrom in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
stateId - the identify of state
Returns:
raw state of the same state identify

initialRawState

public ImmutableState<T,S,E,C> initialRawState()
Specified by:
initialRawState in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
initial raw state of state machine

typeOfStateMachine

public Class<? extends T> typeOfStateMachine()
Specified by:
typeOfStateMachine in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
type of state machine

typeOfState

public Class<S> typeOfState()
Specified by:
typeOfState in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
type of state

typeOfEvent

public Class<E> typeOfEvent()
Specified by:
typeOfEvent in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
type of event

typeOfContext

public Class<C> typeOfContext()
Specified by:
typeOfContext in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
type of context

typeOfStateMachine

public void typeOfStateMachine(Class<? extends T> stateMachineType)
Description copied from interface: StateMachineData.Writer
Write type of state machine

Specified by:
typeOfStateMachine in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

typeOfState

public void typeOfState(Class<S> stateClass)
Description copied from interface: StateMachineData.Writer
Write type of state

Specified by:
typeOfState in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

typeOfEvent

public void typeOfEvent(Class<E> eventClass)
Description copied from interface: StateMachineData.Writer
Write type of event

Specified by:
typeOfEvent in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

typeOfContext

public void typeOfContext(Class<C> contextClass)
Description copied from interface: StateMachineData.Writer
Write type of context

Specified by:
typeOfContext in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>

rawStates

public Collection<ImmutableState<T,S,E,C>> rawStates()
Specified by:
rawStates in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
all the raw states defined in the state machine

states

public Collection<S> states()
Specified by:
states in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
all the states defined in the state machine

parallelStates

public Collection<S> parallelStates()
Specified by:
parallelStates in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
all the parallel states

linkedStates

public Collection<S> linkedStates()
Specified by:
linkedStates in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>
Returns:
all linked states

linkedStateDataOf

public StateMachineData.Reader<? extends StateMachine<?,S,E,C>,S,E,C> linkedStateDataOf(S linkedState)
Specified by:
linkedStateDataOf in interface StateMachineData.Reader<T extends StateMachine<T,S,E,C>,S,E,C>

linkedStateDataOn

public void linkedStateDataOn(S linkedState,
                              StateMachineData.Reader<? extends StateMachine<?,S,E,C>,S,E,C> linkStateData)
Description copied from interface: StateMachineData.Writer
Write linked state data on specified linked state

Specified by:
linkedStateDataOn in interface StateMachineData.Writer<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
linkedState - specified linked state
linkStateData - linked state data


Copyright © 2013-2014. All Rights Reserved.