
jadex.bdi.examples.cleanerworld_classic.environment.PickUpWastePlan 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.
The newest version!
package jadex.bdi.examples.cleanerworld_classic.environment;
import jadex.bdi.examples.cleanerworld_classic.Environment;
import jadex.bdi.examples.cleanerworld_classic.RequestPickUpWaste;
import jadex.bdi.examples.cleanerworld_classic.Waste;
import jadex.bdi.runtime.Plan;
import jadex.bridge.fipa.Done;
/**
* Pick up some piece of waste.
*/
public class PickUpWastePlan extends Plan
{
//-------- constructors --------
/**
* Create a new plan.
*/
public PickUpWastePlan()
{
getLogger().info("Created: "+this);
}
//------ methods -------
/**
* The plan body.
*/
public void body()
{
RequestPickUpWaste op = (RequestPickUpWaste)getParameter("action").getValue();
Waste waste = op.getWaste();
Environment env = (Environment)getBeliefbase().getBelief("environment").getFact();
boolean success = env.pickUpWaste(waste);
if(!success)
fail();
Done done = new Done();
done.setAction(op);
getParameter("result").setValue(done);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy