jadex.bdi.examples.cleanerworld_classic.cleaner.LocalPickUpWasteActionPlan 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.IEnvironment;
import jadex.bdi.examples.cleanerworld_classic.Waste;
import jadex.bdi.runtime.Plan;
import jadex.bdi.runtime.PlanFailureException;
/**
* Pick up a piece of waste in the environment.
*/
public class LocalPickUpWasteActionPlan extends Plan
{
//-------- methods --------
/**
* The plan body.
*/
public void body()
{
IEnvironment environment = (IEnvironment)getBeliefbase().getBelief("environment").getFact();
Waste waste = (Waste)getParameter("waste").getValue();
boolean success = environment.pickUpWaste(waste);
if(!success)
throw new PlanFailureException();
}
}