StagedRightTuples srcRightTuples,
StagedLeftTuples trgLeftTuples) {
boolean tupleMemory = true;
boolean tupleMemoryEnabled = true;
LeftTupleMemory ltm = bm.getLeftTupleMemory();
RightTupleMemory rtm = bm.getRightTupleMemory();
ContextEntry[] contextEntry = bm.getContext();
BetaConstraints constraints = notNode.getRawConstraints();
FastIterator it = notNode.getRightIterator( rtm );
for ( RightTuple rightTuple = srcRightTuples.getDeleteFirst(); rightTuple != null; ) {
RightTuple next = rightTuple.getStagedNext();
// assign now, so we can remove from memory before doing any possible propagations
final RightTuple rootBlocker = (RightTuple) it.next( rightTuple );
rtm.remove( rightTuple );
if ( rightTuple.getBlocked() != null ) {
PropagationContext context = rightTuple.getPropagationContext();
for ( LeftTuple leftTuple = rightTuple.getBlocked(); leftTuple != null; ) {
LeftTuple temp = leftTuple.getBlockedNext();
leftTuple.clearBlocker();
constraints.updateFromTuple( contextEntry,
wm,
leftTuple );
// we know that older tuples have been checked so continue next
for ( RightTuple newBlocker = rootBlocker; newBlocker != null; newBlocker = (RightTuple) it.next( newBlocker ) ) {
if ( constraints.isAllowedCachedLeft( contextEntry,
newBlocker.getFactHandle() ) ) {
leftTuple.setBlocker( newBlocker );
newBlocker.addBlocked( leftTuple );
break;
}
}
if ( leftTuple.getBlocker() == null ) {
// was previous blocked and not in memory, so add
ltm.add( leftTuple );
trgLeftTuples.addInsert( sink.createLeftTuple( leftTuple,
sink,
tupleMemory ) );
}