jadex.bdi.testcases.BeliefChangePlan 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.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);
}
}