nopasaran.parsers.state_machine_parser.StateMachineParser¶
- class nopasaran.parsers.state_machine_parser.StateMachineParser(state_json)¶
Bases:
objectParser class for state machines.
This class provides methods to parse state machine definitions.
- __init__(state_json)¶
Initialize the StateMachineParser.
- Args:
state_json (dict): The JSON representation of the state machine.
Methods
__init__(state_json)Initialize the StateMachineParser.
get_conditions(possible_state)Get the conditions for a possible state transition.
get_entry_actions(state)Get the entry actions for a state.
get_exit_actions(state)Get the exit actions for a state.
get_id()Get the ID of the state machine.
Get the initial state of the state machine.
get_next_state_name(possible_state)Get the name of the next state for a possible state transition.
get_next_states_on_event(state, event)Get the next states on an event for a state.
Get the list of states in the state machine.
get_transition_actions(next_state)Get the transition actions for a next state.
- get_conditions(possible_state)¶
Get the conditions for a possible state transition.
- Args:
possible_state (dict): The possible state transition.
- Returns:
dict or None: The conditions for the possible state transition, or None if no conditions are defined.
- get_entry_actions(state)¶
Get the entry actions for a state.
- Args:
state (str): The state for which to get the entry actions.
- Returns:
list or None: The list of entry actions, or None if no entry actions are defined.
- get_exit_actions(state)¶
Get the exit actions for a state.
- Args:
state (str): The state for which to get the exit actions.
- Returns:
list or None: The list of exit actions, or None if no exit actions are defined.
- get_id()¶
Get the ID of the state machine.
- Returns:
str: The ID of the state machine.
- get_initial_state()¶
Get the initial state of the state machine.
- Returns:
str: The initial state of the state machine.
- get_next_state_name(possible_state)¶
Get the name of the next state for a possible state transition.
- Args:
possible_state (dict): The possible state transition.
- Returns:
str or None: The name of the next state, or None if no next state is defined.
- get_next_states_on_event(state, event)¶
Get the next states on an event for a state.
- Args:
state (str): The state for which to get the next states. event (str): The event for which to get the next states.
- Returns:
list or None: The list of next states, or None if no next states are defined for the event.
- get_states()¶
Get the list of states in the state machine.
- Returns:
list: The list of states in the state machine.
- get_transition_actions(next_state)¶
Get the transition actions for a next state.
- Args:
next_state (dict): The next state.
- Returns:
list or None: The list of transition actions, or None if no transition actions are defined.