jadex.gpmn.runtime.plan.GoalHierarchyExecutionPlan Maven / Gradle / Ivy
package jadex.gpmn.runtime.plan;
import jadex.bdi.runtime.IGoal;
import jadex.bdi.runtime.Plan;
import jadex.commons.SUtil;
/**
* Create subgoals according to the goal hierarchy specified in plan parameters.
* The 'subgoals' parameter set denotes the names of goals to create.
* The 'mode' parameter specifies the execution mode ('sequential' or 'parallel').
*/
public class GoalHierarchyExecutionPlan extends Plan
{
/**
* Plan body.
*/
public void body()
{
String[] subgoals = (String[]) getParameterSet("subgoals").getValues();
String mode = (String) getParameter("mode").getValue();
System.out.println("Goal decomposition: "+mode+SUtil.arrayToString(subgoals));
if("parallel".equals(mode))
{
IGoal[] goals = new IGoal[subgoals.length];
for(int i=0; i