public class Transition
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private State |
destination
The destination state.
|
private Event |
event
The event.
|
private java.util.List<TransitionListener> |
listeners
The listeners.
|
private State |
source
The source state.
|
private static java.lang.String |
TR
The delimiter for string representation.
|
| Constructor and Description |
|---|
Transition(State state,
Event event)
Create the object.
|
Transition(State source,
Event event,
State destination)
Create the object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(TransitionListener listener)
Add a new listener.
|
boolean |
equals(java.lang.Object object)
Compare the objects using internal fields.
|
(package private) static java.lang.String |
format(Event matchedEvent,
Event eventToProcess)
Helper method to format transition parameters to the string
representation.
|
(package private) static java.lang.String |
format(State source,
Event event)
Helper method to format transition parameters to the string
representation.
|
(package private) static java.lang.String |
format(State source,
Event matchedEvent,
Event eventToProcess)
Helper method to format transition parameters to the string
representation.
|
(package private) static java.lang.String |
format(State source,
Event matchedEvent,
Event eventToProcess,
State destination)
Helper method to format transition parameters to the string
representation.
|
(package private) static java.lang.String |
format(State source,
Event event,
State destination)
Helper method to format transition parameters to the string
representation.
|
State |
getDestination()
Get the transition destination state.
|
Event |
getEvent()
Get the transition event.
|
State |
getSource()
Get the source state.
|
int |
hashCode()
Get the hash code.
|
(package private) void |
notifyTransition(State source,
Event event,
State destination)
The transition was processed, notify listeners.
|
java.lang.String |
toString()
The string representation of the object.
|
private static final java.lang.String TR
private final State source
private final Event event
private final State destination
private final java.util.List<TransitionListener> listeners
public Transition(State source, Event event, State destination)
source - the source stateevent - the eventdestination - the destination statepublic Transition(State state, Event event)
+---+ | S |------+ +---+ | ^ | A loop transition, 'S' is both source and destination state. | | +--------+
state - the source and destination stateevent - the eventpublic State getSource()
public Event getEvent()
public State getDestination()
public void addListener(TransitionListener listener)
listener - the listenervoid notifyTransition(State source, Event event, State destination)
source - the source stateevent - the eventdestination - the destination statepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object object)
equals in class java.lang.Objectobject - the objectProcessor.process(Event)public java.lang.String toString()
toString in class java.lang.Objectstatic java.lang.String format(State source, Event event, State destination)
source - the source stateevent - the input eventdestination - the destination statestatic java.lang.String format(State source, Event matchedEvent, Event eventToProcess, State destination)
source - the source statematchedEvent - the input event that matchedeventToProcess - the event that will be processeddestination - the destination statestatic java.lang.String format(State source, Event event)
source - the source stateevent - the input eventstatic java.lang.String format(State source, Event matchedEvent, Event eventToProcess)
source - the source statematchedEvent - the input event that matchedeventToProcess - the event that will be processedCopyright 2013 Michal Turek, AnotherFSM.