Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package jadex.bdi.planlib.iasteps;
  
 
 import java.util.Map;
 
 public class DispatchGoalStep implements IComponentStep
 {
 	protected String goaltype;
 	protected Map parameters;

Dispatches a goal.

Parameters:
goal The goal.
 
 	public DispatchGoalStep(String goal)
 	{
 		this(goalnull);
 	}

Dispatches a goal.

Parameters:
goal The goal.
parameterName Name of a goal parameter.
parameterValue Value of the goal parameter.
 
 	public DispatchGoalStep(String goalfinal String parameterNamefinal Object parameterValue)
 	{
 		this(goalnew HashMap() {{
 			put(parameterNameparameterValue);
 		}});
 	}

Dispatches a goal.

Parameters:
goal The goal.
parameters The goal parameters.
 
 	public DispatchGoalStep(String goalMap parameters)
 	{
 		this. = goal;
 		this. = parameters;
 	}
 	
 	{
 		final IGoal goal = ((IBDIInternalAccessia).getGoalbase().createGoal();
 		if ( != null)
 		{
 			for (Iterator it = .entrySet().iterator(); it.hasNext(); )
 			{
 				Map.Entry paramEntry = (Map.Entryit.next();
 				goal.getParameter((StringparamEntry.getKey()).setValue(paramEntry.getValue());
 			}
 		}
 		
 		final Future goalFuture = new Future();
 		{
 			public void goalFinished(AgentEvent ae)
 			{
 				goalFuture.setResult(goal.getParameters());
 			}
 			
 			public void goalAdded(AgentEvent ae)
 			{
 			}
 		});
 		
 		final Future ret = new Future();
 		{
 			public void resultAvailable(Object result)
 			{
 				Map results = new HashMap();
 				IParameter[] params = (IParameter[]) result;
 				for (int i = 0; i < params.length; ++i)
 				{
 //					String dir = ((IMParameter) params[i].getModelElement()).getDirection();
 					//System.out.println(params[i].getName() + " " + params[i].getValue() + " " + dir);
 					//if (OAVBDIMetaModel.PARAMETER_DIRECTION_INOUT.equals(dir) ||
 						//OAVBDIMetaModel.PARAMETER_DIRECTION_OUT.equals(dir))
 					results.put(params[i].getName(), params[i].getValue());
 				}
 				ret.setResult(results);
 			}
 		});
 		
		return ret;
	}
New to GrepCode? Check out our FAQ X