use of org.drools.core.reteoo.LeftTupleSinkNode in project drools by kiegroup.
the class ReactiveObjectUtil method notifyModification.
public static void notifyModification(Object object, Collection<Tuple> leftTuples, ModificationType type) {
for (Tuple leftTuple : leftTuples) {
if (!((ReactiveFromNodeLeftTuple) leftTuple).updateModificationState(object, type)) {
continue;
}
PropagationContext propagationContext = leftTuple.getPropagationContext();
ReactiveFromNode node = (ReactiveFromNode) leftTuple.getTupleSink();
LeftTupleSinkNode sink = node.getSinkPropagator().getFirstLeftTupleSink();
InternalWorkingMemory wm = getInternalWorkingMemory(propagationContext);
wm.addPropagation(new ReactivePropagation(object, (ReactiveFromNodeLeftTuple) leftTuple, propagationContext, node, sink, type));
}
}
use of org.drools.core.reteoo.LeftTupleSinkNode in project drools by kiegroup.
the class RuleNetworkEvaluator method evalStackEntry.
public void evalStackEntry(StackEntry entry, LinkedList<StackEntry> stack, RuleExecutor executor, InternalAgenda agenda) {
NetworkNode node = entry.getNode();
Memory nodeMem = entry.getNodeMem();
TupleSets<LeftTuple> trgTuples = entry.getTrgTuples();
if (node.getType() == NodeTypeEnums.QueryElementNode) {
// copy across the results, if any from the query node memory
QueryElementNodeMemory qmem = (QueryElementNodeMemory) nodeMem;
qmem.setNodeCleanWithoutNotify();
qmem.getResultLeftTuples().addTo(trgTuples);
}
LeftTupleSinkNode sink = entry.getSink();
PathMemory pmem = entry.getRmem();
SegmentMemory[] smems = entry.getSmems();
int smemIndex = entry.getSmemIndex();
boolean processRian = entry.isProcessRian();
long bit = entry.getBit();
if (entry.isResumeFromNextNode()) {
SegmentMemory smem = smems[smemIndex];
if (node != smem.getTipNode()) {
// get next node and node memory in the segment
LeftTupleSink nextSink = sink.getNextLeftTupleSinkNode();
if (nextSink == null) {
node = sink;
} else {
// there is a nested subnetwork, take out path
node = nextSink;
}
nodeMem = nodeMem.getNext();
// update bit to new node
bit = bit << 1;
} else {
// Reached end of segment, start on new segment.
SegmentPropagator.propagate(smem, trgTuples, agenda.getWorkingMemory());
smem = smems[++smemIndex];
trgTuples = smem.getStagedLeftTuples().takeAll();
node = smem.getRootNode();
nodeMem = smem.getNodeMemories().getFirst();
// update bit to start of new segment
bit = 1;
}
}
if (log.isTraceEnabled()) {
int offset = getOffset(node);
log.trace("{} Resume {} {}", indent(offset), node.toString(), trgTuples.toStringSizes());
}
innerEval(pmem, node, bit, nodeMem, smems, smemIndex, trgTuples, agenda, stack, processRian, executor);
}
Aggregations