BetaConstraints constraints = notNode.getRawConstraints();
boolean iterateFromStart = notNode.isIndexedUnificationJoin() || rtm.getIndexType().isComparison();
for (RightTuple rightTuple = srcRightTuples.getUpdateFirst(); rightTuple != null; ) {
RightTuple next = rightTuple.getStagedNext();
PropagationContext context = rightTuple.getPropagationContext();
constraints.updateFromFactHandle(contextEntry,
wm,
rightTuple.getFactHandle());
FastIterator leftIt = notNode.getLeftIterator(ltm);
LeftTuple firstLeftTuple = notNode.getFirstLeftTuple(rightTuple, ltm, context, leftIt);
LeftTuple firstBlocked = rightTuple.getTempBlocked();
// first process non-blocked tuples, as we know only those ones are in the left memory.
for (LeftTuple leftTuple = firstLeftTuple; leftTuple != null; ) {
// preserve next now, in case we remove this leftTuple
LeftTuple temp = (LeftTuple) leftIt.next(leftTuple);
if (leftTuple.getStagedType() == LeftTuple.UPDATE) {
// ignore, as it will get processed via left iteration. Children cannot be processed twice
leftTuple = temp;
continue;
}
// we know that only unblocked LeftTuples are still in the memory
if (constraints.isAllowedCachedRight(contextEntry,
leftTuple)) {
leftTuple.setBlocker(rightTuple);
rightTuple.addBlocked(leftTuple);
// this is now blocked so remove from memory
ltm.remove(leftTuple);
LeftTuple childLeftTuple = leftTuple.getFirstChild();
if ( childLeftTuple != null) {
childLeftTuple.setPropagationContext(rightTuple.getPropagationContext());
RuleNetworkEvaluator.deleteRightChild(childLeftTuple, trgLeftTuples, stagedLeftTuples);
}
}
leftTuple = temp;
}
if (firstBlocked != null) {
RightTuple rootBlocker = rightTuple.getTempNextRightTuple();
if (rootBlocker == null ) {
iterateFromStart = true;
}