/** * Get the plan instance. * @return The plan instance. */ public IInternalPlan getPlan() { // if(rplan!=null) // System.out.println("access"); if(rplan==null) rplan = RPlan.createRPlan((MPlan)getModelElement(), this, element, agent, mplaninfo.getBinding(), null); return rplan; }
/** * Check if plan is already aborted. */ protected void testBodyAborted(RPlan rplan) { // Throw error to exit body method of aborted plan. if(rplan!=null && rplan.isFinishing() && rplan.getLifecycleState()==PlanLifecycleState.BODY) { // System.out.println("aborting after block: "+rplan); throw new BodyAborted(); } }
/** * The values to set. * @param values The values to set */ // Internal method, overridden for message event. protected void setValues(List<Object> values) { testWriteOK((MParameter)getModelElement()); internalSetValues(values); }
/** * Drop a pojo goal. */ public void dropGoal(Object goal) { for(RGoal rgoal: getCapability().getGoals(goal.getClass())) { if(goal.equals(rgoal.getPojoElement())) { rgoal.drop(); } } }
/** * Execute a goal method. */ protected IFuture<Boolean> executeGoalMethod(Method m, RProcessableElement goal, IEvent event) { return invokeBooleanMethod(goal.getPojoElement(), m, goal.getModelElement(), event, null); }
public void resultAvailable(Void result) { RPLANS.set(null); ip.getCapability().removePlan(rplan); Object reason = rplan.getReason(); if(reason instanceof RProcessableElement) ((RProcessableElement)reason).planFinished(ia, rplan); }
/** * Create a new plan. */ public RPlan(MPlan mplan, ICandidateInfo candidate, Object reason, IInternalAccess agent, Map<String, Object> mappingvals, MConfigParameterElement config) { super(mplan, agent, mappingvals, config); this.candidate = candidate; this.reason = reason; setLifecycleState(PlanLifecycleState.NEW); setProcessingState(PlanProcessingState.READY); // Tricky, requires reason to be set before initing parameters. super.initParameters(mappingvals, config); }
/** * Check if plan is already aborted. */ protected void testBodyAborted(RPlan rplan) { // Throw error to exit body method of aborted plan. if(rplan!=null && rplan.aborted && rplan.getLifecycleState()==PlanLifecycleState.BODY) { // System.out.println("aborting after block: "+rplan); throw new BodyAborted(); } }
/** * Create a new action. */ public AdoptGoalAction(RGoal goal) { // System.out.println("adopting: "+goal.getId()+" "+goal.getPojoElement().getClass().getName()); this.goal = goal; if(goal.getParentPlan()!=null) this.state = goal.getParentPlan().getLifecycleState(); }
/** * */ public void planFinished(IInternalAccess ia, RPlan rplan) { if(rplan!=null) { addTriedPlan(rplan); if(apl!=null) apl.planFinished(rplan); } }
/** * Set a value of a parameter. * @param value The new value. */ public void setValue(Object value) { testWriteOK((MParameter)getModelElement()); internalSetValue(value); }
/** * Get the capability model. * @return The capability model. */ public MCapability getMCapability() { return (MCapability)getCapability().getModelElement(); }
/** * Get the plan instance. * @return The plan instance. */ public IInternalPlan getPlan() { // if(rplan!=null) // System.out.println("access: "+this); if(rplan==null) rplan = RPlan.createRPlan((MPlan)getModelElement(), this, element, agent, null, null); return rplan; }
/** * Test if waitqueue is empty. */ public boolean isEmpty() { return rplan.getWaitqueue().isEmpty(); }
/** * Get the currently contained elements of the waitqueue. * @return The collected elements. */ public Object[] getElements() { return rplan.getWaitqueue().getElements(); } }
/** * Get the service container of the capability. */ public IServiceContainer getServiceContainer() { return new ServiceContainerProxy(getInterpreter(), capa); }
/** * Update the dynamic value for push or update rate implementation. */ public void updateDynamicValue() { internalSetValue(evaluateValue(inival)); }
/** * Get the belief base. * @return The belief base. */ public IBeliefbase getBeliefbase() { return capa.getBeliefbase(); }
/** * Get the plan base. * @return The plan base. */ public IPlanbase getPlanbase() { return capa.getPlanbase(); }
/** * Check if plan is already aborted. */ protected void testBodyAborted(RPlan rplan) { // Throw error to exit body method of aborted plan. if(rplan!=null && rplan.isFinishing() && rplan.getLifecycleState()==PlanLifecycleState.BODY) { // System.out.println("aborting after block: "+rplan); throw new BodyAborted(); } }