Class ActivationLifeCycle

  • Direct Known Subclasses:
    UnmodifiableActivationLifeCycle

    public class ActivationLifeCycle
    extends java.lang.Object
    A life cycle describes how the state of an activation changes in response to an event. The internal representation is a state machine with each transition labeled with an activation life-cycle event.
    • Constructor Detail

      • ActivationLifeCycle

        protected ActivationLifeCycle​(ActivationState inactiveState)
    • Method Detail

      • nextActivationState

        public ActivationState nextActivationState​(ActivationState currentState,
                                                   EventType event)
        Returns the state in the life cycle that is defined as the next state from the given current state in response to the given event. If there is no transition for the given event, the method returns null.
        Parameters:
        currentState - the current state of the activation
        event - the event that causes the state transition
        Returns:
        the next state if defined, null otherwise
      • addStateTransition

        public boolean addStateTransition​(ActivationState from,
                                          EventType event,
                                          ActivationState to)
        Extends the life cycle with a new transition that is created from the given state, labeled with the given event and leading to the given state. If the (from,event) transition already exists in the life-cycle, it is overwritten with the given to state.
        Parameters:
        from - the source state of the transition
        event - the event causing the transition
        to - the target state of the transition
        Returns:
        true, if the life-cycle changed
      • addStateTransition

        public boolean addStateTransition​(ActivationLifeCycle.Transition transition)
        Extends the life cycle with a new transition that is created from the given state, labeled with the given event and leading to the given state. If the (from,event) transition already exists in the life-cycle, it is overwritten with the given to state.
        Parameters:
        from - the source state of the transition
        event - the event causing the transition
        to - the target state of the transition
        Returns:
        true, if the life-cycle changed
        Since:
        2.0
      • containsFrom

        public boolean containsFrom​(ActivationState state)
        Check that the life-cycle contains a transition from the given state.
        Parameters:
        state -
        Returns:
        true, if there is a transition from the given state, false otherwise
      • containsTo

        public boolean containsTo​(ActivationState state)
        Check that the life-cycle contains a transition to the given state.
        Parameters:
        state -
        Returns:
        true, if there is a transition to the given state, false otherwise
      • copyOf

        public static ActivationLifeCycle copyOf​(ActivationLifeCycle lifeCycle)
        Creates a complete copy of the life-cycle
        Parameters:
        lifeCycle - the life-cycée to be copied
        Returns:
        the copy of the life-cycle
      • toString

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