Class State

    • Field Detail

      • id

        private final java.lang.String id
        The state ID
      • parent

        private final State parent
        The parent state
      • transitions

        private java.util.List<Transition> transitions
        The list of transitions for this state
      • onEntries

        private java.util.List<SelfTransition> onEntries
        The list of entry transitions on a state
      • onExits

        private java.util.List<SelfTransition> onExits
        The list of exit transition from a state
    • Constructor Detail

      • State

        public State​(java.lang.String id)
        Creates a new State with the specified id.
        Parameters:
        id - the unique id of this State.
      • State

        public State​(java.lang.String id,
                     State parent)
        Creates a new State with the specified id and parent.
        Parameters:
        id - the unique id of this State.
        parent - the parent State.
    • Method Detail

      • getId

        public java.lang.String getId()
        Returns:
        the id of this State.
      • getParent

        public State getParent()
        Returns:
        the parent or null if this State has no parent.
      • getTransitions

        public java.util.List<Transition> getTransitions()
        Returns:
        an unmodifiable List of Transitions going out from this State.
      • getOnEntrySelfTransitions

        public java.util.List<SelfTransition> getOnEntrySelfTransitions()
        Returns:
        an unmodifiable List of entry SelfTransitions
      • getOnExitSelfTransitions

        public java.util.List<SelfTransition> getOnExitSelfTransitions()
        Returns:
        an unmodifiable List of exit SelfTransitions
      • updateTransitions

        private void updateTransitions()
      • addTransition

        public State addTransition​(Transition transition,
                                   int weight)
        Adds an outgoing Transition to this State with the specified weight. The higher the weight the less important a Transition is. If two Transitions match the same Event the Transition with the lower weight will be executed.
        Parameters:
        transition - the Transition to add.
        weight - The weight of this transition
        Returns:
        this State.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object