jadex.bdi.examples.cleanerworld_classic.cleaner.RemoteDropWasteActionPlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-bdi Show documentation
Show all versions of jadex-applications-bdi Show documentation
The Jadex BDI applications package contain
several example applications, benchmarks and
testcases using BDI agents.
package jadex.bdi.examples.cleanerworld_classic.cleaner;
import jadex.bdi.examples.cleanerworld_classic.RequestDropWaste;
import jadex.bdi.examples.cleanerworld_classic.Waste;
import jadex.bdi.examples.cleanerworld_classic.Wastebin;
import jadex.bdi.runtime.PlanFailureException;
/**
* Pick up a piece of waste in the environment.
*/
public class RemoteDropWasteActionPlan extends RemoteActionPlan
{
//-------- methods --------
/**
* The plan body.
*/
public void body()
{
Waste waste = (Waste)getParameter("waste").getValue();
Wastebin wastebin = (Wastebin)getParameter("wastebin").getValue();
// Search and store the environment agent.
if(getBeliefbase().getBelief("environmentagent").getFact()==null)
searchEnvironmentAgent();
if(getBeliefbase().getBelief("environmentagent").getFact()==null)
throw new PlanFailureException();
RequestDropWaste rd = new RequestDropWaste();
rd.setWaste(waste);
rd.setWastebinname(wastebin.getName());
requestAction(rd);
}
}