cz.cuni.amis.pogamut.udk.communication.translator.observer.support
Class ObserverListState<MESSAGE,CONTEXT extends TranslatorContext>
java.lang.Object
cz.cuni.amis.pogamut.udk.communication.translator.observer.support.AbstractObserverFSMState<InfoMessage,CONTEXT>
cz.cuni.amis.pogamut.udk.communication.translator.observer.support.ObserverListState<MESSAGE,CONTEXT>
- Type Parameters:
MESSAGE
- CONTEXT
-
- All Implemented Interfaces:
- cz.cuni.amis.fsm.IFSMState<InfoMessage,CONTEXT>
- Direct Known Subclasses:
- ItemListState, MapListState, MutatorListState, NavPointNeighboursState, PathAcceptState, PlayerListState
public abstract class ObserverListState<MESSAGE,CONTEXT extends TranslatorContext>
- extends AbstractObserverFSMState<InfoMessage,CONTEXT>
Support class that takes care of batch of messages in the form of:
START_MSG MSG MSG .... MSG END_MSG
Performs class checks over the symbols that are used to enter / leave the state.
Stores all the MSGs inside a list.
To use this state you have to subclass this abstract class, use correct super() inside the constructor of your class
and override stateLeaving() method (first by calling super.stateLeaving()) and use getList() to obtain the list
of all messages that came between START and END message.
- Author:
- Jimmy
ObserverListState
public ObserverListState(Class beginMessage,
Class<MESSAGE> message,
Class endMessage)
- Parameters:
beginMessage
- message class that should be used to enter this statemessage
- class of messages we should store inside the list (must be the same as generic type MESSAGE!)endMessage
- message class that should be used to leave this state
getList
protected List<MESSAGE> getList()
newList
protected void newList()
init
public void init(CONTEXT context)
restart
public void restart(CONTEXT context)
stateEntering
public void stateEntering(CONTEXT context,
cz.cuni.amis.fsm.IFSMState<InfoMessage,CONTEXT> fromState,
InfoMessage symbol)
stateLeaving
public void stateLeaving(CONTEXT context,
cz.cuni.amis.fsm.IFSMState<InfoMessage,CONTEXT> toState,
InfoMessage symbol)
innerStateSymbol
protected void innerStateSymbol(CONTEXT context,
InfoMessage symbol)
- Specified by:
innerStateSymbol
in class AbstractObserverFSMState<InfoMessage,CONTEXT extends TranslatorContext>
Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.