public static class FSMBehavior.State
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
FSMBehavior |
fsm
Parent FSM.
|
java.util.logging.Logger |
log
Logger for the behavior to log messages to.
|
Constructor and Description |
---|
State(java.lang.Object name)
Creates a named state.
|
State(java.lang.Object name,
java.lang.Runnable runnable)
Creates a named state.
|
Modifier and Type | Method and Description |
---|---|
void |
action()
This method is repeatedly called when the state is active.
|
void |
block()
Blocks the behavior.
|
void |
block(long millis)
Blocks the behavior.
|
java.lang.Object |
getName()
Gets the name of the FSM state.
|
boolean |
isBlocked()
Checks if the behavior is blocked.
|
void |
onEnter()
This method is called when the state is entered.
|
void |
onEvent(java.lang.Object event,
java.lang.Object eventInfo)
This method is called when an event is triggered.
|
void |
onExit()
This method is called when the state is exited.
|
void |
restart()
Restarts the behavior.
|
void |
setNextState(java.lang.Object name)
Changes the FSM state to the specified state.
|
void |
terminate()
Terminates the FSM.
|
java.lang.String |
toString()
Returns a string representation of the state.
|
public FSMBehavior fsm
public java.util.logging.Logger log
public State(java.lang.Object name)
name
- name of the state.public State(java.lang.Object name, java.lang.Runnable runnable)
name
- name of the state.runnable
- Runnable to run.public void action()
public void onEnter()
public void onExit()
public void onEvent(java.lang.Object event, java.lang.Object eventInfo)
event
- an object naming the event.eventInfo
- an object providing extra information on the event.public java.lang.Object getName()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public void setNextState(java.lang.Object name)
name
- name of the state to change to.public void terminate()
public void block()
Behavior.block()
public void block(long millis)
Behavior.block(long)
public void restart()
Behavior.restart()
public boolean isBlocked()
Behavior.isBlocked()