jadex.bdi.planlib.df.DFRemoteSearchPlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applib-bdi Show documentation
Show all versions of jadex-applib-bdi Show documentation
The Jadex applib BDI package contain
ready to use functionalities for
BDI agents mostly in form of modules
called capabilities.
package jadex.bdi.planlib.df;
import jadex.base.fipa.DFSearch;
import jadex.base.fipa.Done;
import jadex.base.fipa.IDFComponentDescription;
import jadex.base.fipa.SFipa;
import jadex.bdi.runtime.IGoal;
import jadex.bdi.runtime.Plan;
import jadex.bridge.ISearchConstraints;
/**
* Search at a remote DF.
*/
public class DFRemoteSearchPlan extends Plan
{
/**
* The body method is called on the
* instatiated plan instance from the scheduler.
*/
public void body()
{
DFSearch se = new DFSearch();
se.setComponentDescription((IDFComponentDescription)getParameter("description").getValue());
se.setSearchConstraints((ISearchConstraints)getParameter("constraints").getValue());
se.setRemote(getParameter("remote").getValue()!=null?
((Boolean)getParameter("remote").getValue()).booleanValue(): false);
IGoal req = createGoal("rp_initiate");
req.getParameter("receiver").setValue(getParameter("df").getValue());
req.getParameter("action").setValue(se);
req.getParameter("ontology").setValue(SFipa.COMPONENT_MANAGEMENT_ONTOLOGY_NAME);
dispatchSubgoalAndWait(req);
getParameterSet("result").addValues(((DFSearch)((Done)req.getParameter("result").getValue()).getAction()).getResults());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy