public class State
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
State.Type
The type of the states.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List<StateListener> |
listeners
The listeners.
|
private java.lang.String |
name
The name of the state.
|
private State.Type |
type
The type of the state.
|
Constructor and Description |
---|
State(java.lang.String name)
Create the object.
|
State(java.lang.String name,
State.Type type)
Create the object.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(StateListener listener)
Add a new listener.
|
boolean |
equals(java.lang.Object object)
Compare the objects using internal fields.
|
java.lang.String |
getName()
Get name of the state.
|
State.Type |
getType()
Get type of the state.
|
int |
hashCode()
Get the hash code.
|
boolean |
isFinalState()
Chect the state is final.
|
(package private) void |
notifyEnter(boolean loopTransition,
State previous,
Event event,
State current)
The state was entered, notify listeners.
|
(package private) void |
notifyExit(boolean loopTransition,
State current,
Event event,
State next)
The state was exited, notify listeners.
|
java.lang.String |
toString()
The string representation of the object.
|
private final java.lang.String name
private final State.Type type
private final java.util.List<StateListener> listeners
public State(java.lang.String name)
name
- the name of the statepublic State(java.lang.String name, State.Type type)
name
- the name of the statetype
- the type of the statepublic void addListener(StateListener listener)
listener
- the listenervoid notifyEnter(boolean loopTransition, State previous, Event event, State current)
loopTransition
- this transition is a loop transitionprevious
- the previous stateevent
- the eventcurrent
- the current statevoid notifyExit(boolean loopTransition, State current, Event event, State next)
loopTransition
- this transition is a loop transitioncurrent
- the current stateevent
- the eventnext
- the next statepublic java.lang.String getName()
public State.Type getType()
public boolean isFinalState()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- the objectProcessor.process(Event)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2013 Michal Turek, AnotherFSM.