ilog.rules.teamserver.model.states

Class ConditionalTransitionSystem<State extends java.lang.Enum<State>>

  • Type Parameters:
    State - A Java enumeration.
    Direct Known Subclasses:
    SingleConditionTransitionSystem, TableConditionalTransitionSystem


    public abstract class ConditionalTransitionSystem<State extends java.lang.Enum<State>>
    extends TableTransitionSystem<State>

    Declares a state transition system where the definition of the list of possible transitions is twofold. Firstly, the list of possible successor states is explicitly given for each state. Secondly, a condition can be attached to transitions. A transition is allowed if it declared as possible, and if the attached condition is satisfied.

    Conditions are implemented by subclasses of TransitionCondition.

    • Constructor Detail

      • ConditionalTransitionSystem

        protected ConditionalTransitionSystem(java.lang.Class<State> stateClass)
    • Method Detail

      • checkCondition

        protected boolean checkCondition(State s1,
                             State s2)

        Indicates whether the condition attached to the provided transition is satisfied. If no condition is attached to the transition, it is considered satisfied.

        Note: This method only checks the condition, not the table of possible successors. The condition may be satisfied even if the transition is not made allowed by the table of possible successors.

        Throws:
        java.lang.AssertionError - if s2 is null.
        Parameters:
        s1 - The start state of the transition, or null to check whether s2 is an allowed initial state.
        s2 - Then end state of the transition. Cannot be null.
        Returns:
        true if the condition attached to the transition is satisfied, or if no condition is attached to the transition.
      • isPossibleTransition

        public boolean isPossibleTransition(State s1,
                                   State s2)
        Description copied from class: TransitionSystem

        Indicates whether the transition is allowed. By extension, a possible transition from a null state means that the end state of the transition is an initial state.

        Note: If s1 is null, then this method must return true iff isInitialState(s2) returns true.

        Overrides:
        isPossibleTransition in class TableTransitionSystem<State extends java.lang.Enum<State>>
        Parameters:
        s1 - The start state of the transition, or null to check whether s2 is an initial state.
        s2 - Then end state of the transition. Cannot be null.
        Returns:
        true if the transition is allowed.
        See Also:
        TransitionSystem.getNextStates(State)
      • impossibleTransitionCause

        public TransitionCondition<State> impossibleTransitionCause(State s1,
                                                           State s2)

        Returns the condition that fails, and hence makes the provided transition impossible.

        Note: This method assumes that the provided transition is indeed impossible. It does not test it. Unspecified result is returned if this method is called on a possible transition.

        Throws:
        java.lang.NullPointerException - if s2 is null.
        Parameters:
        s1 - The start state of the transition, or null when checking whether s2 is an allowed initial state.
        s2 - The end state of the transition. Cannot be null.
        Returns:
        an instance of TransitionCondition that is not satisfied, which causes the provided transition to be impossible.
      • hasCondition

        public boolean hasCondition(State s1,
                           State s2)

        Indicates whether a condition is attached to the provided transition.

        Throws:
        java.lang.NullPointerException - if s2 is null.
        Parameters:
        s1 - The start state of the transition, or null when checking whether s2 is an allowed initial state.
        s2 - Then end state of the transition. Cannot be null.
        Returns:
        true if a condition is attached to the provided transition.
      • getCondition

        public abstract TransitionCondition<State> getCondition(State s1,
                                              State s2)

        Returns the condition attached to the provided transition, or null if no condition is attached to the provided transition.

        Throws:
        java.lang.NullPointerException - if s2 is null.
        Parameters:
        s1 - The start state of the transition, or null when checking whether s2 is allowed as an initial state.
        s2 - Then end state of the transition. Cannot be null.
        Returns:
        the condition attached to the provided transition, or null.
      • getCondition

        public TransitionCondition<State> getCondition(State s1,
                                              State s2,
                                              boolean nullIfAbsent)

        Returns the condition attached to the provided transition. If no condition is attached to the provided transition, either null or an always true condition is returned, depending on the last argument.

        Throws:
        java.lang.NullPointerException - if s2 is null.
        Parameters:
        s1 - The start state of the transition, or null when checking whether s2 is an allowed initial state.
        s2 - Then end state of the transition. Cannot be null.
        nullIfAbsent - If true, null is returned if no condition is attached to the provided transition; otherwise, a condition that is always satisfied is returned.
        Returns:
        the condition attached to the provided transition, null, or an always true condition.
      • conditionChanged

        protected void conditionChanged()

        This method must be called each time that the condition attached to a transition is changed.

© Copyright IBM Corp. 1987, 2017