/** * Propagate a new tuple to all tuple consumers. * @param object The new object. */ protected void propagateAdditionToTupleConsumers(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { ITupleConsumerNode[] tcon = tconsumers; for(int i=0; tcon!=null && i<tcon.length; i++) tcon[i].addTuple(tuple, state, mem, agenda); }
/** * Propagate a new tuple to all tuple consumers. * @param tuple The new tuple. */ protected void propagateAdditionToTupleConsumers(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { ITupleConsumerNode[] tcon = tconsumers; for(int i=0; tcon!=null && i<tcon.length; i++) tcon[i].addTuple(tuple, state, mem, agenda); }
/** * Propagate a new tuple to all tuple consumers. * @param object The new object. */ protected void propagateAdditionToTupleConsumers(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { ITupleConsumerNode[] tcon = tconsumers; for(int i=0; tcon!=null && i<tcon.length; i++) tcon[i].addTuple(tuple, state, mem, agenda); }
/** * Propagate a new tuple to all tuple consumers. * @param tuple The new tuple. */ protected void propagateAdditionToTupleConsumers(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { ITupleConsumerNode[] tcon = tconsumers; for(int i=0; tcon!=null && i<tcon.length; i++) tcon[i].addTuple(tuple, state, mem, agenda); }
/** * Initialize the pattern matcher. * Called before the agenda is accessed * to perform any initialization, if necessary. */ public void init(IOAVState state, ReteMemory mem, AbstractAgenda agenda) { this.initial_fact_tuple = new Tuple(state, null, INITIAL_FACT); this.initial_fact_mem = Collections.singletonList(initial_fact_tuple); ITupleConsumerNode[] tcon = tconsumers; for(int i=0; tcon!=null && i<tcon.length; i++) tcon[i].addTuple(initial_fact_tuple, state, mem, agenda); }
/** * Initialize the pattern matcher. * Called before the agenda is accessed * to perform any initialization, if necessary. */ public void init(IOAVState state, ReteMemory mem, AbstractAgenda agenda) { this.initial_fact_tuple = new Tuple(state, null, INITIAL_FACT); this.initial_fact_mem = Collections.singletonList(initial_fact_tuple); ITupleConsumerNode[] tcon = tconsumers; for(int i=0; tcon!=null && i<tcon.length; i++) tcon[i].addTuple(initial_fact_tuple, state, mem, agenda); }
/** * Add a match to the node memory and propagate if necessary. */ protected void addMatch(Tuple left, Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { Tuple result = mem.getTuple(state, left, right); BetaMemory bmem = (BetaMemory)mem.getNodeMemory(this); if(bmem.addResultTuple(result)) { ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(result, state, mem, agenda); } }
/** * Add a match to the node memory and propagate if necessary. */ protected void addMatch(Tuple left, Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { Tuple result = mem.getTuple(state, left, right); BetaMemory bmem = (BetaMemory)mem.getNodeMemory(this); if(bmem.addResultTuple(result)) { ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(result, state, mem, agenda); } }
/** * Remove a match from the node memory and propagate if necessary. */ protected void removeMatch(Tuple left, Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { // if(getNodeId()==1137) // if(mem.debug!=null) // mem.debug.add(this+".removeMatch?: "+left+", "+right); if(mem.hasNodeMemory(this)) { NotMemory nomem = (NotMemory)mem.getNodeMemory(this); boolean removed = nomem.removeMapping(left, right); // if(mem.debug!=null) // mem.debug.add(this+".removeMatch: removed="+removed+", delay="+nomem.isDelay()+", mappings="+nomem.getMappings(left)); if(removed && !nomem.isDelay() && (nomem.getMappings(left)==null || nomem.getMappings(left).isEmpty())) { // if(mem.debug!=null) // mem.debug.add(this+".removeMatch: add result tuple "+left); nomem.addResultTuple(left); ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(left, state, mem, agenda); } } }
/** * Remove a match from the node memory and propagate if necessary. */ protected void removeMatch(Tuple left, Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda) { // if(getNodeId()==1137) // if(mem.debug!=null) // mem.debug.add(this+".removeMatch?: "+left+", "+right); if(mem.hasNodeMemory(this)) { NotMemory nomem = (NotMemory)mem.getNodeMemory(this); boolean removed = nomem.removeMapping(left, right); // if(mem.debug!=null) // mem.debug.add(this+".removeMatch: removed="+removed+", delay="+nomem.isDelay()+", mappings="+nomem.getMappings(left)); if(removed && !nomem.isDelay() && (nomem.getMappings(left)==null || nomem.getMappings(left).isEmpty())) { // if(mem.debug!=null) // mem.debug.add(this+".removeMatch: add result tuple "+left); nomem.addResultTuple(left); ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(left, state, mem, agenda); } } }
/** * 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 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); }
ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(left, state, mem, agenda);
ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(left, state, mem, agenda);
ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(left, state, mem, agenda);
ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(left, state, mem, agenda);
ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(left, state, mem, agenda);
ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].addTuple(left, state, mem, agenda);