/** * Set the handle. * @param handle The handle to set. */ protected void setHandle(Object handle) { assert this.handle==null; this.handle = handle; // Only called from synchronized code -> no agent invocation necessary if(handle!=null) state.addExternalObjectUsage(handle, this); }
/** * Set the handle. * @param handle The handle to set. */ protected void setHandle(Object handle) { assert this.handle==null; this.handle = handle; // Only called from synchronized code -> no agent invocation necessary if(handle!=null) state.addExternalObjectUsage(handle, this); }
/** * Create a new parameter flyweight. * @param state The state. * @param scope The scope handle. * @param handle The parameter handle (or null if no value yet). * @param name The parameter name (used, if no value yet). * @param parameterelement The handle for the parameter element to which this parameter belongs. */ private ParameterFlyweight(IOAVState state, Object scope, Object handle, String name, Object parameterelement) { super(state, scope, handle); this.name = name; this.parameterelement = parameterelement; assert parameterelement!=null; if(parameterelement!=null) state.addExternalObjectUsage(parameterelement, this); }
/** * Create a new element flyweight. * @param state The state. * @param scope The scope handle. * @param handle The element handle. * @param rplan The calling plan (if called from plan) */ public MElementFlyweight(IOAVState state, Object scope, Object handle) { assert !(scope instanceof ElementFlyweight); assert handle!=null; this.state = state; this.scope = scope; if(scope!=null) state.addExternalObjectUsage(scope, this); this.interpreter = BDIInterpreter.getInterpreter(state); setHandle(handle); }
/** * Create a new element flyweight. * @param state The state. * @param scope The scope handle. * @param handle The element handle. */ private WaitqueueFlyweight(IOAVState state, Object scope, Object rplan) { super(state, scope, state.getAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_waitqueuewa)); // Hack!! Super constructor creates wa, when null. if(state.getAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_waitqueuewa)==null) state.setAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_waitqueuewa, getHandle()); this.rplan = rplan; state.addExternalObjectUsage(rplan, this); }
/** * Create a new element flyweight. * @param state The state. * @param scope The scope handle. * @param handle The element handle. * @param rplan The calling plan (if called from plan) */ public ElementFlyweight(IOAVState state, Object scope, Object handle) { assert !(scope instanceof ElementFlyweight); // assert !BDIInterpreter.getInterpreter(state).isExternalThread(); assert !BDIInterpreter.getInterpreter(state).getComponentAdapter().isExternalThread(); // if(handle==null && !(this instanceof ParameterFlyweight || this instanceof ParameterSetFlyweight)) // Thread.dumpStack(); assert handle!=null || this instanceof ParameterFlyweight || this instanceof ParameterSetFlyweight || this instanceof ProcessableElementFlyweight: this; this.state = state; this.scope = scope; if(scope!=null) state.addExternalObjectUsage(scope, this); this.interpreter = BDIInterpreter.getInterpreter(state); if(interpreter==null) throw new RuntimeException("No interpreter"); setHandle(handle); }