public IFuture<Void> execute(IInternalAccess ia) { IBeliefbase bb = ((IBDIInternalAccess) ia).getBeliefbase(); for (Iterator it = beliefs.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry) it.next(); bb.getBelief((String) entry.getKey()).setFact(entry.getValue()); } return IFuture.DONE; } }
/** * Create a wrapper service implementation based on */ // public static Object createServiceImplementation(IBDIInternalAccess agent, Class<?> type, Map<String, String> goalnames) public static Object createServiceImplementation(IBDIInternalAccess agent, Class<?> type, String[] methodnames, String[] goalnames) { // if(methodnames==null || methodnames.length==0) // throw new IllegalArgumentException("At least one method-goal mapping must be given."); Map<String, String> gn = new HashMap<String, String>(); for(int i=0; i<methodnames.length; i++) { gn.put(methodnames[i], goalnames[i]); } return Proxy.newProxyInstance(agent.getClassLoader(), new Class[]{type}, new GoalDelegationHandler(agent, gn)); }
String clname = (String)scope.getModel().getProperty(PROPERTY_AGENTVIEWERCLASS, cl); if(clname!=null) Class<?> clazz = SReflect.classForName(clname, scope.getClassLoader()); IComponentViewerPanel panel = (IComponentViewerPanel)clazz.newInstance(); panels.add(new Object[]{"agent", panel}); ICapability subcap = (ICapability)scope.getSubcapability(subcapnames[i]); Object clid = subcap.getModel().getProperty(IAbstractViewerPanel.PROPERTY_VIEWERCLASS, cl); Class<?> clazz = null;
public IFuture<Map<String, Object>> execute(IInternalAccess ia) final IGoal goal = ((IBDIInternalAccess) ia).getGoalbase().createGoal(goaltype); if (parameters != null) ((IBDIInternalAccess) ia).getGoalbase().dispatchTopLevelGoal(goal);
throw new RuntimeException("No method-goal mapping found: "+method.getName()+" "+goalnames); final IGoal goal = agent.getGoalbase().createGoal(goalname); agent.getGoalbase().dispatchTopLevelGoal(goal);
@Classname("addTarget") public IFuture<Void> execute(IInternalAccess ia) { IBDIInternalAccess bia = (IBDIInternalAccess)ia; if(!bia.getBeliefbase().getBeliefSet("my_targets").containsFact(so)) { bia.getBeliefbase().getBeliefSet("my_targets").addFact(so); } return IFuture.DONE; } });