public void run() { Collection coll = getState().getAttributeValues(rplan, OAVBDIRuntimeModel.plan_has_waitqueueelements); integer = coll==null? 0: coll.size(); } };
/** * Add an external condition to an OAV waitabstraction. */ public static void addExternalCondition(Object wa, IExternalCondition condition, IOAVState state, Object rcapa) { Collection conditions = state.getAttributeValues(wa, OAVBDIRuntimeModel.waitabstraction_has_externalconditions); if(conditions==null || !conditions.contains(condition)) state.addAttributeValue(wa, OAVBDIRuntimeModel.waitabstraction_has_externalconditions, condition); }
public void run() { Collection coll = getState().getAttributeValues(rplan, OAVBDIRuntimeModel.plan_has_waitqueueelements); bool = coll==null? true: coll.isEmpty(); } };
/** * Remove an external condition. * @param condition The condition. */ public static void removeExternalCondition(IOAVState state, IExternalCondition condition, Object wa) { if(wa!=null) { Collection conditions = state.getAttributeValues(wa, OAVBDIRuntimeModel.waitabstraction_has_externalconditions); if(conditions!=null && conditions.contains(condition)) state.removeAttributeValue(wa, OAVBDIRuntimeModel.waitabstraction_has_externalconditions, condition); } }
public void run() { Collection coll = getState().getAttributeValues(getHandle(), OAVBDIRuntimeModel.beliefset_has_facts); integer = coll!=null ? Integer.valueOf(coll.size()): Integer.valueOf(0); } };
public void run() { Collection params = (Collection)getState().getAttributeValues(getScope(), OAVBDIMetaModel.goal_has_excludedparameter); object = params!=null ? params.toArray(new String[params.size()]) : SUtil.EMPTY_STRING_ARRAY; } };
public void run() { object = ((Collection)getState().getAttributeValues(getHandle(), OAVBDIMetaModel.trigger_has_factremoveds)).toArray(new String[0]); } };
public void run() { object = ((Collection)getState().getAttributeValues(getHandle(), OAVBDIMetaModel.trigger_has_factaddeds)).toArray(new String[0]); } };
public void run() { object = ((Collection)getState().getAttributeValues(getHandle(), OAVBDIMetaModel.trigger_has_factchangeds)).toArray(new String[0]); } };
public void run() { object = getState().getAttributeValues(getHandle(), OAVBDIMetaModel.referenceableelement_has_assignto); } };
/** * */ public static boolean containsFact(IOAVState state, Object handle, Object fact) { // Convert wrapped basic values to desired class (e.g. Integer to Long). Object mbel = state.getAttributeValue(handle, OAVBDIRuntimeModel.element_has_model); Class clazz = (Class)state.getAttributeValue(mbel, OAVBDIMetaModel.typedelement_has_class); Object newfact = SReflect.convertWrappedValue(fact, clazz); Collection coll = state.getAttributeValues(handle, OAVBDIRuntimeModel.beliefset_has_facts); return coll!=null && coll.contains(newfact); }
public void run() { Collection goals = getState().getAttributeValues(getHandle(), OAVBDIRuntimeModel.capability_has_goals); bool = goals!=null && goals.contains(((GoalFlyweight)goal).getHandle()); } };
/** * Add a message event instance to an OAV waitabstraction. */ public static void addReply(Object wa, ElementFlyweight me, IOAVState state, Object rcapa) { // Register event also in conversation map for message routing. Object rmevent = me.getHandle(); MessageEventRules.registerMessageEvent(state, rmevent, rcapa); Collection rmevents = state.getAttributeValues(wa, OAVBDIRuntimeModel.waitabstraction_has_messageevents); if(rmevents==null || !rmevents.contains(rmevent)) state.addAttributeValue(wa, OAVBDIRuntimeModel.waitabstraction_has_messageevents, rmevent); }
public void run() { Collection elems = (Collection)getState().getAttributeValues(getScope(), OAVBDIMetaModel.capability_has_beliefsets); IMBeliefSet[] ret = new IMBeliefSet[elems==null? 0: elems.size()]; if(elems!=null) { int i=0; for(Iterator it=elems.iterator(); it.hasNext(); ) { ret[i++] = new MBeliefSetFlyweight(getState(), getScope(), it.next()); } } object = ret; } };
public void run() { Collection elems = (Collection)getState().getAttributeValues(getScope(), OAVBDIMetaModel.configuration_has_initialmessageevents); IMConfigElement[] ret = new IMConfigElement[elems==null? 0: elems.size()]; if(elems!=null) { int i=0; for(Iterator it=elems.iterator(); it.hasNext(); ) { ret[i++] = new MConfigElementFlyweight(getState(), getScope(), it.next()); } } object = ret; } };
/** * Add a message event type to an OAV waitabstraction. */ public static void addMessageEvent(Object wa, String type, IOAVState state, Object rcapa) { Collection mevents = state.getAttributeValues(wa, OAVBDIRuntimeModel.waitabstraction_has_messageeventtypes); Object[] scope = AgentRules.resolveCapability(type, OAVBDIMetaModel.messageevent_type, rcapa, state); Object mcapa = state.getAttributeValue(scope[1], OAVBDIRuntimeModel.element_has_model); if(!state.containsKey(mcapa, OAVBDIMetaModel.capability_has_messageevents, scope[0])) throw new RuntimeException("Unknown message event: "+type); Object mevent = state.getAttributeValue(mcapa, OAVBDIMetaModel.capability_has_messageevents, scope[0]); if(mevents==null || !mevents.contains(mevent)) state.addAttributeValue(wa, OAVBDIRuntimeModel.waitabstraction_has_messageeventtypes, mevent); }
/** * Add a condition type to an OAV waitabstraction. */ public static void addCondition(Object wa, String condition, IOAVState state, Object rcapa) { Collection mconds = state.getAttributeValues(wa, OAVBDIRuntimeModel.waitabstraction_has_conditiontypes); Object[] scope = AgentRules.resolveCapability(condition, OAVBDIMetaModel.condition_type, rcapa, state); Object mcapa = state.getAttributeValue(scope[1], OAVBDIRuntimeModel.element_has_model); if(!state.containsKey(mcapa, OAVBDIMetaModel.capability_has_conditions, scope[0])) throw new RuntimeException("Unknown condition: "+condition); Object mcond = state.getAttributeValue(mcapa, OAVBDIMetaModel.capability_has_conditions, scope[0]); if(mconds==null || !mconds.contains(mcond)) state.addAttributeValue(wa, OAVBDIRuntimeModel.waitabstraction_has_conditiontypes, mcond); }
/** * Add a goal instance to an OAV waitabstraction. */ public static void addGoal(Object wa, ElementFlyweight goal, IOAVState state, Object rcapa) { Collection goals = state.getAttributeValues(wa, OAVBDIRuntimeModel.waitabstraction_has_goals); Object rgoal = goal.getHandle(); if(goals==null || !goals.contains(rgoal)) state.addAttributeValue(wa, OAVBDIRuntimeModel.waitabstraction_has_goals, rgoal); BDIInterpreter.getInterpreter(state).getEventReificator().addObservedElement(rgoal); }
/** * Schedule a plan candidate. */ protected static Object schedulePlanCandidate(IOAVState state, Object rpe, Object cand) { Object mplan = state.getAttributeValue(cand, OAVBDIRuntimeModel.mplancandidate_has_mplan); Object rcapa = state.getAttributeValue(cand, OAVBDIRuntimeModel.mplancandidate_has_rcapa); Collection bindings = state.getAttributeValues(cand, OAVBDIRuntimeModel.mplancandidate_has_bindings); Object rplan = PlanRules.instantiatePlan(state, rcapa, mplan, null, rpe, bindings, null, null); PlanRules.adoptPlan(state, rcapa, rplan); state.setAttributeValue(rpe, OAVBDIRuntimeModel.processableelement_has_state, OAVBDIRuntimeModel.PROCESSABLEELEMENT_CANDIDATESSELECTED); return rplan; }
public void run() { Object plan = getState().getAttributeValue(getHandle(), OAVBDIRuntimeModel.mplancandidate_has_plan); if(plan==null) { Object mplan = getState().getAttributeValue(getHandle(), OAVBDIRuntimeModel.mplancandidate_has_mplan); Collection bindings = getState().getAttributeValues(getHandle(), OAVBDIRuntimeModel.mplancandidate_has_bindings); plan = PlanRules.instantiatePlan(getState(), getScope(), mplan, null, rpe, bindings, null, null); getState().setAttributeValue(getHandle(), OAVBDIRuntimeModel.mplancandidate_has_plan, plan); } object = PlanFlyweight.getPlanFlyweight(getState(), getScope(), plan); } };