/*
 *  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.jALLL.jTObjects.TConstants;
import jTMass.core.jALLL.jTObjects.TObject;
import jTMass.core.jAMass.TAgent;

/**
 *
 * @author zborilf
 */
public class TInternalActions extends TAction{

    public final static int _IA_FREEZE_INPUTS=1;
    public final static int _IA_OPEN_INPUTS=2;

    int PInternalAction;

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

    @Override
    public TObject cloneObject(){
    	TInternalActions newInternal=new TInternalActions(PInternalAction);
    	return(newInternal);
    }

    // ===== READERS =====

    @Override
    public String getContent(){
        switch(PInternalAction){
            case _IA_FREEZE_INPUTS:
                return("$FI");
            case _IA_OPEN_INPUTS:
                return("$OI");
        };
        return("~$?~");
    }

    @Override
    public String getActionName(){
        return("INTERNAL ACTION");
    }

    // ===== ACTION EXECUTION =====

    @Override
    public TObject execute(TAgent agent){
        switch(PInternalAction){
            case _IA_FREEZE_INPUTS:
                agent.setAgentState(TAgent._Agent_Deaf);
                break;
            case _IA_OPEN_INPUTS:
                agent.setAgentState(TAgent._Agent_Ready);
        }
        return(null);
    }

    // ===== CONSTRUCTOR =====

    public TInternalActions(int internalAction){
        super(TConstants._InternalActions);
        PInternalAction=internalAction;
    }

}
