/** * Notification when an object has been removed from state. * @param id The object id. * @param type The object type. */ public void objectRemoved(Object id, OAVObjectType type) { assert !running; running = true; state.getProfiler().start(IProfiler.TYPE_OBJECT, type); state.getProfiler().start(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_REMOVED); node.removeObject(id, type, state, retemem, agenda); state.getProfiler().stop(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_REMOVED); state.getProfiler().stop(IProfiler.TYPE_OBJECT, type); running = false; }
/** * Notification when an object has been removed from state. * @param id The object id. * @param type The object type. */ public void objectRemoved(Object id, OAVObjectType type) { assert !running; running = true; state.getProfiler().start(IProfiler.TYPE_OBJECT, type); state.getProfiler().start(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_REMOVED); node.removeObject(id, type, state, retemem, agenda); state.getProfiler().stop(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_REMOVED); state.getProfiler().stop(IProfiler.TYPE_OBJECT, type); running = false; }
/** * Notification when an object has been added to the state. * @param id The object id. * @param type The object type. */ public void objectAdded(Object id, OAVObjectType type, boolean root) { assert !running; running = true; state.getProfiler().start(IProfiler.TYPE_OBJECT, type); state.getProfiler().start(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_ADDED); node.addObject(id, type, state, retemem, agenda); state.getProfiler().stop(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_ADDED); state.getProfiler().stop(IProfiler.TYPE_OBJECT, type); running = false; }
/** * Notification when an object has been added to the state. * @param id The object id. * @param type The object type. */ public void objectAdded(Object id, OAVObjectType type, boolean root) { assert !running; running = true; state.getProfiler().start(IProfiler.TYPE_OBJECT, type); state.getProfiler().start(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_ADDED); node.addObject(id, type, state, retemem, agenda); state.getProfiler().stop(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_ADDED); state.getProfiler().stop(IProfiler.TYPE_OBJECT, type); running = false; }
/** * Notification when an attribute value of an object has been set. * @param id The object id. * @param type The object type. * @param attr The attribute type. * @param oldvalue The oldvalue. * @param newvalue The newvalue. */ public void objectModified(Object id, OAVObjectType type, OAVAttributeType attr, Object oldvalue, Object newvalue) { assert !running; running = true; state.getProfiler().start(IProfiler.TYPE_OBJECT, type); state.getProfiler().start(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_MODIFIED); node.modifyObject(id, type, attr, oldvalue, newvalue, state, retemem, agenda); state.getProfiler().stop(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_MODIFIED); state.getProfiler().stop(IProfiler.TYPE_OBJECT, type); running = false; }
/** * Notification when an attribute value of an object has been set. * @param id The object id. * @param type The object type. * @param attr The attribute type. * @param oldvalue The oldvalue. * @param newvalue The newvalue. */ public void objectModified(Object id, OAVObjectType type, OAVAttributeType attr, Object oldvalue, Object newvalue) { assert !running; running = true; state.getProfiler().start(IProfiler.TYPE_OBJECT, type); state.getProfiler().start(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_MODIFIED); node.modifyObject(id, type, attr, oldvalue, newvalue, state, retemem, agenda); state.getProfiler().stop(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_MODIFIED); state.getProfiler().stop(IProfiler.TYPE_OBJECT, type); running = false; }
/** * Send a removed object to this node. * @param object The object. */ public void removeObject(Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Remove object called: "+this+" "+object); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTREMOVED); if(mem.hasNodeMemory(this) && ((Collection)mem.getNodeMemory(this)).remove(object)) { //System.out.println("Object passed constraint check: "+this+" "+object); propagateRemovalToObjectConsumers(object, state, mem, agenda); } state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTREMOVED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Remove a tuple from this node. * @param tuple The tuple. */ public void removeTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { // System.out.println("Remove Tuple: "+tuple); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEREMOVED); // Get old assignments. Map nodemem = (Map)mem.getNodeMemory(this); ReteVariableAssignments assignments = (ReteVariableAssignments)nodemem.remove(tuple); // Activation act = new Activation(rule, new ReteVariableAssignments(state, tuple, extractors)); Activation act = new Activation(rule, assignments, state); agenda.removeActivation(act); state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEREMOVED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Send an object to this node. * @param object The object. */ public void addObject(Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Add object called: "+this+" "+object); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); Collection amem = (Collection)mem.getNodeMemory(this); Tuple tuple = mem.getTuple(state, null, object); amem.add(tuple); ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(tuple, state, mem, agenda); state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Send a removed object to this node. * @param object The object. */ public void removeObject(Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Remove object called: "+this+" "+object); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTREMOVED); if(mem.hasNodeMemory(this) && ((Collection)mem.getNodeMemory(this)).remove(object)) { //System.out.println("Object passed constraint check: "+this+" "+object); propagateRemovalToObjectConsumers(object, state, mem, agenda); } state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTREMOVED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Send a new object to this node. * @param object The object. */ public void addObject(Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Add object called: "+this+" "+object); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); Map smem = (Map)mem.getNodeMemory(this); assert !smem.containsKey(object) : object; // if(!smem.containsKey(object)) { Collection vfs = generateVirtualFacts(object, state); smem.put(object, vfs); //System.out.println("ADD: Object splitted to: "+object+" "+vfs); for(Iterator it=vfs.iterator(); it.hasNext(); ) { propagateAdditionToObjectConsumers(it.next(), state, mem, agenda); } } state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Add a new tuple to this node. * @param tuple The tuple. */ public void addTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Add tuple called: "+this+" "+tuple); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEADDED); Collection tmem = (Collection)mem.getNodeMemory(this); if(!tmem.contains(tuple) && evaluator.evaluate(null, tuple, state)) { tmem.add(tuple); //System.out.println("Tuple passed constraint check: "+this+" "+object); propagateAdditionToTupleConsumers(tuple, state, mem, agenda); } state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEADDED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Send an object to this node. * @param object The object. */ public void addObject(Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Add object called: "+this+" "+object); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); Collection amem = (Collection)mem.getNodeMemory(this); Tuple tuple = mem.getTuple(state, null, object); amem.add(tuple); ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(tuple, state, mem, agenda); state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Remove a tuple from this node. * @param tuple The tuple. */ public void removeTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Remove tuple called: "+this+" "+tuple); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEREMOVED); if(mem.hasNodeMemory(this)) { if(((Collection)mem.getNodeMemory(this)).remove(tuple)) { propagateRemovalToTupleConsumers(tuple, state, mem, agenda); } } state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEREMOVED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Tell the condition system about a * new object in the state. * @param object The new object. */ public void addObject(Object id, OAVObjectType type, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { // if(type.getName().equals("goal")) // System.out.println("Value added: "+id+" "+type); // System.out.println("Value added: "+id+" "+type); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); Set tns = getTypeNodes(type); if(tns!=null) { for(Iterator it=tns.iterator(); it.hasNext(); ) ((AlphaNode)it.next()).addObject(id, state, mem, agenda); assert !check || checkConsistency(mem); } // else // System.out.println("No typenode(s) available for: "+type); state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Send a new object to this node. * @param object The object. */ public void addObject(Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Add object called: "+this+" "+object); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); Map smem = (Map)mem.getNodeMemory(this); assert !smem.containsKey(object) : object; // if(!smem.containsKey(object)) { Collection vfs = generateVirtualFacts(object, state); smem.put(object, vfs); //System.out.println("ADD: Object splitted to: "+object+" "+vfs); for(Iterator it=vfs.iterator(); it.hasNext(); ) { propagateAdditionToObjectConsumers(it.next(), state, mem, agenda); } } state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Remove a tuple from this node. * @param tuple The tuple. */ public void removeTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Remove tuple called: "+this+" "+tuple); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEREMOVED); if(mem.hasNodeMemory(this)) { if(((Collection)mem.getNodeMemory(this)).remove(tuple)) { propagateRemovalToTupleConsumers(tuple, state, mem, agenda); } } state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEREMOVED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Add a new tuple to this node. * @param tuple The tuple. */ public void addTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { //System.out.println("Add tuple called: "+this+" "+tuple); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEADDED); Collection tmem = (Collection)mem.getNodeMemory(this); if(!tmem.contains(tuple) && evaluator.evaluate(null, tuple, state)) { tmem.add(tuple); //System.out.println("Tuple passed constraint check: "+this+" "+object); propagateAdditionToTupleConsumers(tuple, state, mem, agenda); } state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEADDED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Remove a tuple from this node. * @param tuple The tuple. */ public void removeTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { // System.out.println("Remove Tuple: "+tuple); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEREMOVED); // Get old assignments. Map nodemem = (Map)mem.getNodeMemory(this); ReteVariableAssignments assignments = (ReteVariableAssignments)nodemem.remove(tuple); // Activation act = new Activation(rule, new ReteVariableAssignments(state, tuple, extractors)); Activation act = new Activation(rule, assignments, state); agenda.removeActivation(act); state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_TUPLEREMOVED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }
/** * Tell the condition system about a * new object in the state. * @param object The new object. */ public void addObject(Object id, OAVObjectType type, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { // if(type.getName().equals("goal")) // System.out.println("Value added: "+id+" "+type); // System.out.println("Value added: "+id+" "+type); state.getProfiler().start(IProfiler.TYPE_NODE, this); state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); Set tns = getTypeNodes(type); if(tns!=null) { for(Iterator it=tns.iterator(); it.hasNext(); ) ((AlphaNode)it.next()).addObject(id, state, mem, agenda); assert !check || checkConsistency(mem); } // else // System.out.println("No typenode(s) available for: "+type); state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED); state.getProfiler().stop(IProfiler.TYPE_NODE, this); }