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

jadex.bdi.testcases.plans.PlanPrioritiesTesterPlan 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.base.test.TestReport;
import jadex.bdi.runtime.IGoal;
import jadex.bdi.runtime.Plan;

/**
 *  Test plan priorities.
 */
public class PlanPrioritiesTesterPlan extends Plan
{
	/**
	 * The body method is called on the
	 * instatiated plan instance from the scheduler.
	 */
	public void body()
	{
		TestReport tr = new TestReport("#1", "Test plan priorities.");
		IGoal goal = createGoal("test");
		dispatchSubgoalAndWait(goal);

		Integer[] results = (Integer[])getBeliefbase().getBeliefSet("results").getFacts();
		boolean succ = results.length==3;
		for(int i=0; succ && i=results[i+1].intValue();
		}
		if(succ)
			tr.setSucceeded(true);
		else
			tr.setReason("Plan priorities were not respected.");

		getBeliefbase().getBeliefSet("testcap.reports").addFact(tr);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy