All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.bdi.dfagent.DFSearchPlan Maven / Gradle / Ivy

Go to download

The Jadex applib BDI package contain ready to use functionalities for BDI agents mostly in form of modules called capabilities.

There is a newer version: 2.4
Show newest version
package jadex.bdi.dfagent;

import jadex.base.fipa.DFSearch;
import jadex.base.fipa.Done;
import jadex.base.fipa.IDFComponentDescription;
import jadex.bdi.runtime.IGoal;
import jadex.bdi.runtime.Plan;

/**
 *  The df search plan has the task to receive a message 
 *  andc reate a corresponding goal.
 */
public class DFSearchPlan extends Plan
{
	/**
	 * The body method is called on the
	 * instatiated plan instance from the scheduler.
	 */
	public void body()
	{
		DFSearch sa = (DFSearch)getParameter("action").getValue();

		IGoal sag = createGoal("df_search");
		sag.getParameter("description").setValue(sa.getComponentDescription());
		sag.getParameter("constraints").setValue(sa.getSearchConstraints());
		sag.getParameter("remote").setValue(sa.isRemote()? Boolean.TRUE: Boolean.FALSE);
		dispatchSubgoalAndWait(sag);

		sa.setResults((IDFComponentDescription[])sag.getParameterSet("result").getValues());
		getParameter("result").setValue(new Done(sa));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy