View Javadoc

1   package cz.cuni.amis.pogamut.udk.communication.translator.bot.state;
2   
3   import cz.cuni.amis.fsm.FSMState;
4   import cz.cuni.amis.fsm.FSMTransition;
5   import cz.cuni.amis.fsm.IFSMState;
6   import cz.cuni.amis.pogamut.base.communication.messages.InfoMessage;
7   import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.NavPointNeighbourLink;
8   import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.NavPointNeighbourLinkEnd;
9   import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.NavPointNeighbourLinkStart;
10  import cz.cuni.amis.pogamut.udk.communication.translator.TranslatorContext;
11  import cz.cuni.amis.pogamut.udk.communication.translator.bot.support.BotListState;
12  
13  /**
14   * Takes care of the navpoint neighbour list. It stores them inside a List object and when END message comes it 
15   * stores them inside the context via context.setNeighbours() for the NavPointListState that will use
16   * context.getNeighbours() to obtain them.
17   * 
18   * @author Jimmy
19   */
20  @FSMState(map={
21  				@FSMTransition(
22  					state=NavPointListState.class, 
23  					symbol={NavPointNeighbourLinkEnd.class}, 
24  					transition={}
25  				)
26  			}
27  )
28  public class NavPointNeighboursState extends BotListState<NavPointNeighbourLink, TranslatorContext> {
29  
30  	public NavPointNeighboursState() {
31  		super(NavPointNeighbourLinkStart.class, NavPointNeighbourLink.class, NavPointNeighbourLinkEnd.class);
32  	}
33  	
34  	@Override
35  	public void stateLeaving(TranslatorContext translatorContext,
36  			IFSMState<InfoMessage, TranslatorContext> toState, InfoMessage symbol) {
37  		translatorContext.setNeighbours(getList());
38  		newList();
39  	}
40  
41  }