StagedLeftTuples trgLeftTuples,
StagedLeftTuples stagedLeftTuples) {
boolean tupleMemory = true;
LeftTupleMemory ltm = bm.getLeftTupleMemory();
ContextEntry[] contextEntry = bm.getContext();
BetaConstraints constraints = joinNode.getRawConstraints();
FastIterator it = joinNode.getLeftIterator( ltm );
for ( RightTuple rightTuple = srcRightTuples.getUpdateFirst(); rightTuple != null; ) {
RightTuple next = rightTuple.getStagedNext();
PropagationContext context = rightTuple.getPropagationContext();
LeftTuple childLeftTuple = rightTuple.getFirstChild();
LeftTuple leftTuple = joinNode.getFirstLeftTuple( rightTuple, ltm, context, it );
constraints.updateFromFactHandle( contextEntry,
wm,
rightTuple.getFactHandle() );
// first check our index (for indexed nodes only) hasn't changed and we are returning the same bucket
// We assume a bucket change if leftTuple == null
if ( childLeftTuple != null && ltm.isIndexed() && !it.isFullIterator() && (leftTuple == null || (leftTuple.getMemory() != childLeftTuple.getLeftParent().getMemory())) ) {
// our index has changed, so delete all the previous propagations
while ( childLeftTuple != null ) {
childLeftTuple = deleteRightChild( childLeftTuple, trgLeftTuples, stagedLeftTuples );
}
// childLeftTuple is now null, so the next check will attempt matches for new bucket
}
// we can't do anything if LeftTupleMemory is empty
if ( leftTuple != null ) {
doRightUpdatesProcessChildren( childLeftTuple, leftTuple, rightTuple, stagedLeftTuples, tupleMemory, contextEntry, constraints, sink, it, trgLeftTuples );
}
rightTuple.clearStaged();
rightTuple = next;
}
srcRightTuples.setUpdate( null );
constraints.resetFactHandle( contextEntry );
}