Package util
Class TransitionTable
java.lang.Object
util.TransitionTable
- All Implemented Interfaces:
Configuration
The transition table is implemented by a hash map of hash maps.
It defines the behavior of the DFSA and is one of the five-tuple
expected by the FSM constructor.
- Author:
- Krish Pillai
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface common.Configuration
Configuration.Direction -
Field Summary
Fields inherited from interface common.Configuration
AUDIO_DIR, DEFAULT_FRAME_RATE, DRAWABLE_DIR, GAMELOGGER, setViewCallChain -
Constructor Summary
ConstructorsConstructorDescriptionTransitionTable(State[] states, String[] actions, State[][] transitions) Each entry of this associative array is an associative array indexed by actions. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the specified state is defined for this FSMEvaluates the delta function delta(q, a), where 'q' is the current state and 'a' is the actionState[]Returns an array containing the final states for this FSM.Gets the initial state of this transition table.booleanChecks if the action is valid and defined for this DFSA.
-
Constructor Details
-
TransitionTable
Each entry of this associative array is an associative array indexed by actions. This enables the delta function for a specific state and action to be obtained in constant time. Each row is indexed by state, in the order defined by the state array. And each column is indexed by the action, in the order defined in the actions array.- Parameters:
states- Array of statesactions- Array of actionstransitions- The transition table- See Also:
-
-
Method Details
-
contains
Checks if the specified state is defined for this FSM- Parameters:
s- The state entry in the transition table- Returns:
- boolean indicating presence
-
getInitialState
Gets the initial state of this transition table. There can be only one initial state.- Returns:
- the initial state
-
getFinalStates
Returns an array containing the final states for this FSM. The DFSA can have multiple final states.- Returns:
- the final state
- See Also:
-
delta
Evaluates the delta function delta(q, a), where 'q' is the current state and 'a' is the action- Parameters:
q- The current statea- The input to the FSM- Returns:
- state The next state according to the transition table
- See Also:
-
hasAction
Checks if the action is valid and defined for this DFSA.- Parameters:
action- The action in question- Returns:
- true or false
-