Class StateTransitionsRepository

java.lang.Object
io.github.jspinak.brobot.services.StateTransitionsRepository

@Component public class StateTransitionsRepository extends Object
Manages the StateTransitions repository and retrieves StateTransitions given a state name.
  • Constructor Details

  • Method Details

    • add

      public void add(StateTransitions stateTransitions)
    • populateStateTransitionsJointTable

      public void populateStateTransitionsJointTable()
      This method is called after all states have been initialized with ids. Each transition can activate multiple states. All pairs of (originating state/activated state) are added to the joint table.
    • get

      public Optional<StateTransitions> get(Long stateId)
      Returns a StateTransitions object given a state id.
      Parameters:
      stateId - the id of the state to find.
      Returns:
      an Optional containing the StateTransitions object if found, or an empty Optional if not found.
    • getAllStateIds

      public Set<Long> getAllStateIds()
      Returns a set of all StateTransitions objects in the repository with state ids.
      Returns:
      a set of state ids for all StateTransitions with ids.
    • getAllTransitions

      public List<IStateTransition> getAllTransitions()
      Returns all StateTransition objects, including ToTransitions.
      Returns:
      a list of StateTransition objects in the model.
    • getAllStateTransitionsAsCopy

      public List<StateTransitions> getAllStateTransitionsAsCopy()
    • emptyRepos

      public void emptyRepos()
    • print

      public void print()
    • getRepo

      public List<StateTransitions> getRepo()
    • getStateTransitionsJointTable

      public StateTransitionsJointTable getStateTransitionsJointTable()