public enum State extends Enum<State>
The state transition diagram is as follows:
+--[a]--> W --[b]--> Y --[e]---+
| ^ |
Initial-+ | |
| | +--> (Z)-----[g]---> Terminal
+--[c]--> X --[b]----+ |
| |
+--------[d]---------+
| Enum Constant and Description |
|---|
Initial
The initial state from which all state sequences start.
|
InvalidTransition
Special state returned by the State.transition(...) function when attempting
an illegal state transition.
|
Terminal
The terminal state in the state machine.
|
W
State 'W'.
|
X
State 'X'.
|
Y
State 'Y'.
|
Z
State 'Z'.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isTerminal()
Checks if this state is a terminal state.
|
EventType |
randomInvalidTransition(Random rnd)
Returns an event type that, if applied as a transition on this state, will result
in an illegal state transition.
|
EventTypeAndState |
randomTransition(Random rnd)
Picks a random transition, based on the probabilities of the outgoing transitions
of this state.
|
State |
transition(EventType evt)
Gets the state after transitioning from this state based on the given event.
|
static State |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static State[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final State Terminal
public static final State InvalidTransition
public static final State Z
public static final State Y
public static final State X
public static final State W
public static final State Initial
public static State[] values()
for (State c : State.values()) System.out.println(c);
public static State valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic boolean isTerminal()
public State transition(EventType evt)
evt - The event that defined the transition.public EventTypeAndState randomTransition(Random rnd)
rnd - The random number generator to use.public EventType randomInvalidTransition(Random rnd)
rnd - The random number generator to use.Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.