public abstract class AbstractState extends Object implements State
Constructor and Description |
---|
AbstractState(FiniteStateMachine fsm) |
Modifier and Type | Method and Description |
---|---|
protected void |
bufferize(byte b)
Stores the byte to the internal buffer to have a chance of getting the
data by a chunk latter.
|
protected byte[] |
getBuffer()
Returns the data collected so far.
|
FiniteStateMachine |
getFiniteStateMashine()
Returns the
FiniteStateMachine instance the state belongs to. |
protected void |
publish(Event event)
Publishes the event to the FSM.
|
protected void |
transitTo(Class<? extends State> stateClass)
Transfers the FSM to the state of specified class.
|
protected void |
transitTo(State state)
Transfers the FSM to the specified state.
|
public AbstractState(FiniteStateMachine fsm)
public FiniteStateMachine getFiniteStateMashine()
State
FiniteStateMachine
instance the state belongs to.getFiniteStateMashine
in interface State
protected void transitTo(Class<? extends State> stateClass)
FiniteStateMachine
instance as a parameter. The IllegalArgumentException
is thrown
otherwise.stateClass
- the state classprotected void transitTo(State state)
state
- the stateprotected void publish(Event event)
event
- the eventprotected void bufferize(byte b)
b
- the byteprotected byte[] getBuffer()
Copyright © 2017. All rights reserved.