/*
 *  Agent's ALLL switching active register action class
 *
 *  2004 - 2011 Frantisek Zboril jr.
 *  Faculty of Information Technology
 *  zborilf@fit.vutbr.cz
 *  http://www.fit.vutbr.cz/~zborilf
 *
 * (C) Brno University of Technology
 * Freeware licence VUT v Brně
 * https://wis.fit.vutbr.cz/FIT/db/dir.php/dr/VZ2007/externiInformace/softwareNaWebu/Priloha2_rozh23.pdf

 */

package jTMass.core.jAMass.jActions;

import jTMass.core.jAMass.TAgent;
import jTMass.core.jALLL.jTObjects.TConstants;
import jTMass.core.jALLL.jTObjects.TObject;

public class TRegisterSwitch extends TAction{
	
    public int PRegisterNumber;

    // ===== CLONING =====

    @Override
    public TObject cloneObject(){
	TRegisterSwitch registerSwitch=new TRegisterSwitch(PRegisterNumber);
	return(registerSwitch);
    }

    // ===== STRING CONTENT READERS =====

    @Override
    public String getActionName(){
        return("REG SWITCH");
    }

    @Override
    public String getParamsS(){
        return(String.valueOf(PRegisterNumber));
    }

    @Override
    public String getContent(){
        return("#"+PRegisterNumber);
    }
	
    // ===== ACTION EXECUTION =====

    @Override
    public TObject execute(TAgent agent) {
    	agent.switchRegister(PRegisterNumber);
	return(agent.getRegister());
    }

    // ===== CONSTRUCTOR =====
	
    public TRegisterSwitch(int registerNumber) {
	super(TConstants._RegisterSwitch);
	PRegisterNumber=registerNumber;
    }

}
