/** * Get the object type * @param object The object. * @return The object type. */ public Object getObjectType(Object object, AReadContext context) { return ((IOAVState)context).getType(object); }
/** * Get the object type * @param object The object. * @return The object type. */ public Object getObjectType(Object object, AReadContext context) { return ((IOAVState)context).getType(object); }
/** * Get the object type * @param object The object. * @return The object type. */ public Object getObjectType(Object object, IContext context) { return ((IOAVState)context).getType(object); }
/** * Get the object type * @param object The object. * @return The object type. */ public Object getObjectType(Object object, IContext context) { return ((IOAVState)context).getType(object); }
public Object put(Object key, Object value) { OAVObjectType type = key!=null && !(key instanceof Tuple) ? state.getType(key) : null; return type instanceof OAVJavaType && !OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind()) ? identity.put(key, value) : equality.put(key, value); }
public Object put(Object key, Object value) { OAVObjectType type = key!=null && !(key instanceof Tuple) ? state.getType(key) : null; return type instanceof OAVJavaType && !OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind()) ? identity.put(key, value) : equality.put(key, value); }
public boolean add(Object value) { OAVObjectType type = value!=null && !(value instanceof Tuple) ? state.getType(value) : null; boolean ret; if(type instanceof OAVJavaType && !OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind())) { if(identity==null) identity = new IdentityHashSet(); ret = identity.add(value); } else { if(equality==null) equality = new LinkedHashSet(); ret = equality.add(value); } return ret; }
public boolean add(Object value) { OAVObjectType type = value!=null && !(value instanceof Tuple) ? state.getType(value) : null; boolean ret; if(type instanceof OAVJavaType && !OAVJavaType.KIND_VALUE.equals(((OAVJavaType)type).getKind())) { if(identity==null) identity = new IdentityHashSet(); ret = identity.add(value); } else { if(equality==null) equality = new LinkedHashSet(); ret = equality.add(value); } return ret; }
/** * Get the properties of an object. */ protected Collection getProperties(Object object, IContext context, boolean includemethods, boolean includefields) { Collection ret = new LinkedHashSet(); IOAVState state = (IOAVState)context; OAVObjectType type = state.getType(object); while(type!=null && !(type instanceof OAVJavaType)) { Collection props = type.getDeclaredAttributeTypes(); ret.addAll(props); type = type.getSupertype(); } return ret; }
/** * Get the properties of an object. */ protected Collection getProperties(Object object, IContext context, boolean includemethods, boolean includefields) { Collection ret = new LinkedHashSet(); IOAVState state = (IOAVState)context; OAVObjectType type = state.getType(object); while(type!=null && !(type instanceof OAVJavaType)) { Collection props = type.getDeclaredAttributeTypes(); ret.addAll(props); type = type.getSupertype(); } return ret; }
/** * */ public static boolean isSucceeded(IOAVState state, Object handle) { boolean ret; Object pstate = state.getAttributeValue(handle, OAVBDIRuntimeModel.goal_has_processingstate); Object mgoal = state.getAttributeValue(handle, OAVBDIRuntimeModel.element_has_model); if(state.getType(mgoal).isSubtype(OAVBDIMetaModel.maintaingoal_type)) ret = OAVBDIRuntimeModel.GOALPROCESSINGSTATE_IDLE.equals(pstate); else ret = OAVBDIRuntimeModel.GOALPROCESSINGSTATE_SUCCEEDED.equals(pstate); return ret; }
/** * Create a new fetcher. */ public OAVBDIFetcher(IOAVState state, Object rcapa, Object relem) { this(state, rcapa); if(state.getType(relem).equals(OAVBDIRuntimeModel.goal_type)) setRGoal(relem); else if(state.getType(relem).equals(OAVBDIRuntimeModel.plan_type)) setRPlan(relem); else if(state.getType(relem).equals(OAVBDIRuntimeModel.messageevent_type)) setRMessageEvent(relem); else if(state.getType(relem).equals(OAVBDIRuntimeModel.internalevent_type)) setRInternalEvent(relem); else throw new IllegalArgumentException("Unsoppurted object: "+relem); }
/** * * @param state * @param handle * @param interpreter */ public static void modified(IOAVState state, Object handle, BDIInterpreter interpreter) { Object fact = state.getAttributeValue(handle, OAVBDIRuntimeModel.belief_has_fact); interpreter.getEventReificator().objectModified(handle, state.getType(handle), OAVBDIRuntimeModel.belief_has_fact, fact, fact); }
/** * Test if a value is compatible with the defined typeinfo. */ protected boolean isTypeCompatible(Object object, ObjectInfo info, IContext context) { boolean ret = true; if(info!=null && info.getTypeInfo() instanceof OAVObjectType) { OAVObjectType otype = (OAVObjectType)info.getTypeInfo(); ret = ((IOAVState)context).getType(object).isSubtype(otype); } return ret; }
/** * Test if a value is compatible with the defined typeinfo. */ protected boolean isTypeCompatible(Object object, ObjectInfo info, IContext context) { boolean ret = true; if(info!=null && info.getTypeInfo() instanceof OAVObjectType) { OAVObjectType otype = (OAVObjectType)info.getTypeInfo(); ret = ((IOAVState)context).getType(object).isSubtype(otype); } return ret; }
/** * Get the type name (name of the modelelement). */ public static String getTypeName(IOAVState state, Object handle) { // Only called from synchronized code -> no agent invocation necessary String ret = "unknown"; try { if(handle!=null && state.getType(handle).isSubtype(OAVBDIRuntimeModel.element_type)) { Object me = state.getAttributeValue(handle, OAVBDIRuntimeModel.element_has_model); if(me!=null) ret = (String)state.getAttributeValue(me, OAVBDIMetaModel.modelelement_has_name); } } catch(RuntimeException e) { } return ret; }
/** * Initialize the pattern matcher. * Called before the agenda is accessed * to perform any initialization, if necessary. */ public void init() { // Initialize initial fact node, if any. if(node.getInitialFactNode()!=null) node.getInitialFactNode().init(state, retemem, agenda); // Add initial objects. for(Iterator objects=state.getDeepObjects(); objects.hasNext(); ) { Object object = objects.next(); objectAdded(object, state.getType(object), false); // Hack!!! Should check if root? } state.addStateListener(this, true); // state.addStateListener(this, false); }
/** * Initialize the pattern matcher. * Called before the agenda is accessed * to perform any initialization, if necessary. */ public void init() { // Initialize initial fact node, if any. if(node.getInitialFactNode()!=null) node.getInitialFactNode().init(state, retemem, agenda); // Add initial objects. for(Iterator objects=state.getDeepObjects(); objects.hasNext(); ) { Object object = objects.next(); objectAdded(object, state.getType(object), false); // Hack!!! Should check if root? } state.addStateListener(this, true); // state.addStateListener(this, false); }
public void run() { getInterpreter().getEventReificator().objectModified(getHandle(), getState().getType(getHandle()), OAVBDIRuntimeModel.beliefset_has_facts, fact, fact); } };
/** * Schedule a plan instance candidate. */ public static void schedulePlanInstanceCandidate(IOAVState state, Object dispelem, Object rplan, Object rcapa)//Object cand) { // System.out.println("schedulePlanInstanceCandidate: Setting plan to ready: " // +BDIInterpreter.getInterpreter(state).getAgentAdapter().getComponentIdentifier().getLocalName() // +", "+rplan); // Object rplan = state.getAttributeValue(cand, OAVBDIRuntimeModel.plancandidate_has_plan); // Object rcapa = state.getAttributeValue(cand, OAVBDIRuntimeModel.plancandidate_has_rcapa); state.setAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_processingstate, OAVBDIRuntimeModel.PLANPROCESSINGTATE_READY); state.setAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_dispatchedelement, dispelem); PlanRules.cleanupPlanWait(state, rcapa, rplan, false); if(dispelem!=null && state.getType(dispelem).isSubtype(OAVBDIRuntimeModel.processableelement_type)) { state.setAttributeValue(dispelem, OAVBDIRuntimeModel.processableelement_has_state, OAVBDIRuntimeModel.PROCESSABLEELEMENT_CANDIDATESSELECTED); } }