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

jadex.bdi.testcases.plans.CountdownPlan Maven / Gradle / Ivy

Go to download

The Jadex BDI applications package contain several example applications, benchmarks and testcases using BDI agents.

The newest version!
package jadex.bdi.testcases.plans;

import jadex.bdi.runtime.Plan;

/**
 *  The countdown plan counts down to zero.
 */
public class CountdownPlan extends Plan
{
	//-------- constructors --------

	/**
	 *  Create a new countdown plan.
	 */
	public CountdownPlan()
	{
		getLogger().info("Created: "+this);
	}

	//-------- methods --------

	/**
	 *  The plan body.
	 */
	public void body()
	{
		while(true)
		{
			int num = ((Integer)getBeliefbase().getBelief("num").getFact()).intValue();
			getLogger().info(""+num);
			getBeliefbase().getBelief("num").setFact(Integer.valueOf(num-1));
			waitFor(10);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy