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

jadex.bdi.testcases.BeliefChangePlan Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.4
Show newest version
package jadex.bdi.testcases;

import jadex.bdi.runtime.Plan;

/**
 *  Change a belief to a value.
 */
public class BeliefChangePlan extends Plan
{
	//-------- attributes --------

	/** The belief name. */
	protected String belname;

	/** The new value. */
	protected Object value;

	//-------- constructors --------

	/**
	 *  Create a new plan.
	 */
	public BeliefChangePlan()
	{
		this.belname = (String)getParameter("beliefname").getValue();
		if(belname==null)
			throw new RuntimeException("Beliefname must not null.");

		this.value = getParameter("value").getValue();
	}

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

	/**
	 * The body method is called on the
	 * instatiated plan instance from the scheduler.
	 */
	public void body()
	{
		getLogger().info("Setting belief: "+belname+" to :"+value);
		getBeliefbase().getBelief(belname).setFact(value);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy