package simulator.interfaces.html;

import models.algebra.Expression;
import models.algebra.Term;
import models.dataConstraintModel.JsonTerm;
import models.dataConstraintModel.ResourcePath;
import models.dataFlowModel.DataTransferChannel;
import simulator.Resource;
import simulator.Simulator;
import simulator.interfaces.NativeSender;

public class HtmlScreenSender extends NativeSender{

	public HtmlScreenSender(Simulator simulator, DataTransferChannel channel, ResourcePath resourcePath,
			Resource resource) {
		super(simulator, channel, resourcePath, resource);
	}

	public void changeScreen(JsonTerm screen) {
		System.out.println(screen);
		Expression eventMessage = channel.getOutputChannelMembers().iterator().next().getStateTransition().getMessageExpression();
		Term termMessage = (Term) eventMessage.clone();
		termMessage.setChild(0, screen);
		sendToModel(termMessage);
 	}
	
}
