/** * Create a goal from a template goal. * To be processed, the goal has to be dispatched as subgoal * or adopted as top-level goal. * @param type The template goal name as specified in the ADF. * @return The created goal. */ public IGoal createGoal(String type) { return getGoalbase().createGoal(type); }
/** * Buy an item. * @param item The item. */ public IFuture<ItemInfo> buyItem(final String item, final double price) { IBDIXAgentFeature capa = comp.getComponentFeature(IBDIXAgentFeature.class); final IGoal sell = capa.getGoalbase().createGoal("sell"); sell.getParameter("name").setValue(item); sell.getParameter("price").setValue(Double.valueOf(price)); return capa.getGoalbase().dispatchTopLevelGoal(sell); }
public IFuture<Map<String, Object>> execute(IInternalAccess ia) final IGoal goal = ia.getComponentFeature(IBDIXAgentFeature.class).getGoalbase().createGoal(goaltype); if(parameters != null)
/** * Buy a book * @param title The book title. * @param price The price to pay. * @return A future indicating if the transaction was successful. */ public IFuture<Void> acceptProposal(String title, int price) { final Future<Void> ret = new Future<Void>(); final IGoal goal = agent.getGoalbase().createGoal("cnp_execute_task"); goal.getParameter("cfp").setValue(title); goal.getParameter("proposal").setValue(Integer.valueOf(price)); agent.getGoalbase().dispatchTopLevelGoal(goal) .addResultListener(new ExceptionDelegationResultListener<Object, Void>(ret) { public void customResultAvailable(Object result) { ret.setResult(null); } }); return ret; }
/** * Ask the seller for a a quote on a book. * @param title The book title. * @return The price. */ public IFuture<Integer> callForProposal(String title) { final Future<Integer> ret = new Future<Integer>(); final IGoal goal = agent.getGoalbase().createGoal("cnp_make_proposal"); goal.getParameter("cfp").setValue(title); agent.getGoalbase().dispatchTopLevelGoal(goal) .addResultListener(new ExceptionDelegationResultListener<Object, Integer>(ret) { public void customResultAvailable(Object result) { ret.setResult((Integer)goal.getParameter("proposal").getValue()); } }); return ret; }
final IGoal g = capa.getGoalbase().createGoal("reasoncall");
IGoal dp = getScope().getGoalbase().createGoal("da_decide_participation"); dp.getParameter("auction_description").setValue(auctiondesc); dp.getParameter("initiator").setValue(initiator);
IGoal dp = getScope().getGoalbase().createGoal("ea_decide_participation"); dp.getParameter("auction_description").setValue(auctiondesc); dp.getParameter("initiator").setValue(initiator);
final IGoal clearchem = capa.getGoalbase().createGoal("clear_chemicals"); clearchem.getParameter("disasterId").setValue(disasterId);
final IGoal exfire = (IGoal)capa.getGoalbase().createGoal("extinguish_fire"); exfire.getParameter("disasterId").setValue(disasterId);
final IGoal tv = (IGoal)capa.getGoalbase().createGoal("treat_victims");
IGoal goal = getGoalbase().createGoal("test"); try