/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.cuni.amis.pogamut.ut2004.communication.translator.bot;

/**
 *
 * @author ik
 */

import cz.cuni.amis.fsm.FSMState;
import cz.cuni.amis.fsm.FSMTransition;
import cz.cuni.amis.fsm.IFSMState;
import cz.cuni.amis.pogamut.base.communication.messages.InfoMessage;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.MutatorListEnd;
import cz.cuni.amis.pogamut.ut2004.communication.translator.TranslatorContext;
import cz.cuni.amis.pogamut.ut2004.communication.translator.bot.support.BotListState;
import cz.cuni.amis.pogamut.ut2004.communication.translator.events.ListObtained;


/**

 * @author ik, jimmy
 */
@FSMState(map={
				@FSMTransition(
					state=HandshakeControllerState.class,
					symbol={MutatorListEnd.class},
					transition={})
				}
)
public class ListState<T> extends BotListState<T, TranslatorContext>{

	public ListState(Class beginMessage, Class<T> message, Class endMessage) {
		super(beginMessage, message, endMessage);
	}

	@Override
	public void stateEntering(TranslatorContext context, IFSMState<InfoMessage, TranslatorContext> fromState, InfoMessage symbol) {
		super.restart(context);
		super.stateEntering(context, fromState, symbol);
	}

	@Override
	public void stateLeaving(TranslatorContext context, IFSMState<InfoMessage, TranslatorContext> toState, InfoMessage symbol) {
		super.stateLeaving(context, toState, symbol);
		context.getEventQueue().pushEvent(new ListObtained<T>(getList()));
		newList();
	}


}
