/** * Create the node memory. * @param state The state. * @return The node memory. */ public Object createNodeMemory(IOAVState state) { return new BetaMemory(state); }
/** * Find all objects for a tuple. * @param left The tuple. * @param bmem The beta memory. * @return The result collection. */ public Set findObjects(Tuple left, BetaMemory bmem) { return bmem.getObjects(left, this); }
/** * Find all tuples for an object. * @param right The object. * @param bmem The beta memory. * @return The result collection. */ public Set findTuples(Object right, BetaMemory bmem) { return bmem.getTuples(right, this); }
/** * Add an value -> object pair to the tuple index. * @param value The value. * @param tuple The tuple. * @param ci The constraint indexer. */ public void addTuple(Object value, Tuple tuple, ConstraintIndexer ci) { getIndexedMemory(ci).addTuple(value, tuple); }
/** * Get the memory for this node. * @return The memory. */ public Collection getNodeMemory(ReteMemory mem) { return mem.hasNodeMemory(this) ? ((BetaMemory)mem.getNodeMemory(this)).getResultMemory() : null; }
/** * Add an object to the memory. * @param right The object. * @param state The state. * @param bmem The beta memory. */ public void addObject(Object right, IOAVState state, BetaMemory bmem) { Object rvalue = extractor2.getValue(null, right, null, state); bmem.addObject(rvalue, right, this); }
/** * Add a tuple to the memory. * @param left The tuple. * @param state The state. * @param bmem The beta memory. */ public void addTuple(Tuple left, IOAVState state, BetaMemory bmem) { Object lvalue = extractor1.getValue(left, null, null, state); bmem.addTuple(lvalue, left, this); }
/** * Remove an object from the memory. * @param right The object. * @param bmem The beta memory. */ public void removeObject(Object right, BetaMemory bmem) { bmem.removeObject(right, this); }
/** * 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(mem.hasNodeMemory(this)) { Tuple result = mem.getTuple(state, left, right); if(((BetaMemory)mem.getNodeMemory(this)).removeResultTuple(result)) { // if(getNodeId()==3713) // System.out.println("remmi: "+result); ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].removeTuple(result, state, mem, agenda); } } }
/** * Remove an value -> object pair from the tuple index. * @param object The object. * @param ci The constraint indexer. */ public void removeTuple(Tuple tuple, ConstraintIndexer ci) { getIndexedMemory(ci).removeTuple(tuple); }
/** * Get the memory for this node. * @return The memory. */ public Collection getNodeMemory(ReteMemory mem) { return mem.hasNodeMemory(this) ? ((BetaMemory)mem.getNodeMemory(this)).getResultMemory() : null; }
/** * Add an object to the memory. * @param right The object. * @param state The state. * @param bmem The beta memory. */ public void addObject(Object right, IOAVState state, BetaMemory bmem) { Object rvalue = extractor2.getValue(null, right, null, state); bmem.addObject(rvalue, right, this); }
/** * Add a tuple to the memory. * @param left The tuple. * @param state The state. * @param bmem The beta memory. */ public void addTuple(Tuple left, IOAVState state, BetaMemory bmem) { Object lvalue = extractor1.getValue(left, null, null, state); bmem.addTuple(lvalue, left, this); }
/** * Remove an object from the memory. * @param right The object. * @param bmem The beta memory. */ public void removeObject(Object right, BetaMemory bmem) { bmem.removeObject(right, this); }
/** * 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(mem.hasNodeMemory(this)) { Tuple result = mem.getTuple(state, left, right); if(((BetaMemory)mem.getNodeMemory(this)).removeResultTuple(result)) { // if(getNodeId()==3713) // System.out.println("remmi: "+result); ITupleConsumerNode[] tcs = tconsumers; for(int j=0; tcs!=null && j<tcs.length; j++) tcs[j].removeTuple(result, state, mem, agenda); } } }
/** * Add an value -> object pair to the tuple index. * @param value The value. * @param tuple The tuple. * @param ci The constraint indexer. */ public void addTuple(Object value, Tuple tuple, ConstraintIndexer ci) { getIndexedMemory(ci).addTuple(value, tuple); }
/** * Check if a match is contained. */ protected boolean isMatchContained(IOAVState state, Tuple left, Object right, ReteMemory mem) { return mem.hasNodeMemory(this) && ((BetaMemory)mem.getNodeMemory(this)).getResultMemory() .contains(mem.getTuple(state, left, right)); }
/** * Create the node memory. * @param state The state. * @return The node memory. */ public Object createNodeMemory(IOAVState state) { return new BetaMemory(state); }