/*
 *  Agent's ALLL query beliefbase 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.*;
import jTMass.core.jALLL.jTObjects.*;

public class TQuery extends TAction {

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

    @Override
    public TObject cloneObject(){
	TQuery newQuery=new TQuery((TList)PList.cloneObject());
	return(newQuery);
    }

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

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

    @Override
    public String getContent(){
	return(PList.getContent());
    }
	
    // ===== ACTION EXECUTION =====

    @Override
    public TObject execute(TAgent agent){
	super.execute(agent);
	//PList.getContent();
	if(PList.getType()==TConstants._QueryList)
            return(agent.processQuery(PList));
	else
            return(agent.processList(PList));
    }

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

    public TQuery(TList list){
        super(TConstants._QueryList);
	PList=list;
    }
	
}
