State - A Java enumeration.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.
explicitInitialStates, initialStates, possibleTransitionsstateClass| Modifier | Constructor and Description |
|---|---|
protected |
ConditionalTransitionSystem(java.lang.Class<State> stateClass) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkCondition(State s1,
State s2)
Indicates whether the condition attached to the provided transition is satisfied.
|
protected java.util.EnumSet<State> |
computeInitialStates()
Computes the set of initial states, as defined by
TableTransitionSystem.isInitialState(State). |
protected void |
conditionChanged()
This method must be called each time that the condition attached to a transition is changed.
|
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. |
TransitionCondition<State> |
getCondition(State s1,
State s2,
boolean nullIfAbsent)
Returns the condition attached to the provided transition.
|
java.util.Set<State> |
getNextStates(State s)
Returns the set of all states to which a transition from the provided state is possible.
|
boolean |
hasCondition(State s1,
State s2)
Indicates whether a condition is attached to the provided transition.
|
TransitionCondition<State> |
impossibleTransitionCause(State s1,
State s2)
Returns the condition that fails, and hence makes the provided transition impossible.
|
boolean |
isPossibleTransition(State s1,
State s2)
Indicates whether the transition is allowed.
|
addInitialStates, addNextStates, dirtyInitialStates, getInitialStates, isInitialState, transitionExistscountNextStates, countPreviousStates, getAccessibleStates, getAccessibleStates, getFinalStates, getPreviousStates, getSelfAccessibleStates, isAccessible, isAccessible, isFinalStateprotected ConditionalTransitionSystem(java.lang.Class<State> stateClass)
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.
java.lang.AssertionError - if s2 is null.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.true if the condition attached to the transition is satisfied, or if no condition is attached to the transition.public boolean isPossibleTransition(State s1, State s2)
TransitionSystemIndicates 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.
isPossibleTransition in class TableTransitionSystem<State extends java.lang.Enum<State>>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.true if the transition is allowed.TransitionSystem.getNextStates(State)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.
java.lang.NullPointerException - if s2 is null.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.TransitionCondition that is not satisfied, which causes the provided transition to be impossible.public java.util.Set<State> getNextStates(State s)
TransitionSystemReturns the set of all states to which a transition from the provided state is possible. If no transition is possible, an empty set is returned. Do not modify the returned set; make a copy of it if needed.
getNextStates in class TableTransitionSystem<State extends java.lang.Enum<State>>s - The state whose successors are queried. If null, the initial states are returned.s is possible. The initial states if s is null.TransitionSystem.countNextStates(State),
TransitionSystem.isAccessible(State, State)protected java.util.EnumSet<State> computeInitialStates()
TableTransitionSystemComputes the set of initial states, as defined by TableTransitionSystem.isInitialState(State). This method must be called before accessing TableTransitionSystem.initialStates
if this field is null.
computeInitialStates in class TableTransitionSystem<State extends java.lang.Enum<State>>public boolean hasCondition(State s1, State s2)
Indicates whether a condition is attached to the provided transition.
java.lang.NullPointerException - if s2 is null.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.true if a condition is attached to the provided transition.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.
java.lang.NullPointerException - if s2 is null.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.null.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.
java.lang.NullPointerException - if s2 is null.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.null, or an always true condition.protected void conditionChanged()
This method must be called each time that the condition attached to a transition is changed.
© Copyright IBM Corp. 1987, 2017