LeftTuple next = leftTuple.getStagedNext();
PropagationContext pctx = leftTuple.getPropagationContext();
InternalFactHandle handle = riaNode.createFactHandle(leftTuple, pctx, wm);
RightTuple rightTuple = new RightTuple(handle, betaNode);
leftTuple.setObject(handle);
rightTuple.setPropagationContext(pctx);
bm.getStagedRightTuples().addInsert(rightTuple);
if (bns != null) {
// Add peered RightTuples, they are attached to FH - unlink LeftTuples that has a peer ref
for (int i = 0; i < length; i++) {
rightTuple = new RightTuple(handle, bns[i]);
rightTuple.setPropagationContext(pctx);
bms[i].getStagedRightTuples().addInsert(rightTuple);
}
}
leftTuple.clearStaged();
leftTuple = next;
}
for (LeftTuple leftTuple = srcTuples.getDeleteFirst(); leftTuple != null; ) {
LeftTuple next = leftTuple.getStagedNext();
InternalFactHandle handle = (InternalFactHandle) leftTuple.getObject();
RightTuple rightTuple = handle.getFirstRightTuple();
RightTupleSets rightTuples = bm.getStagedRightTuples();
rightTuples.addDelete(rightTuple);
if (bns != null) {
// Add peered RightTuples, they are attached to FH - unlink LeftTuples that has a peer ref
for (int i = 0; i < length; i++) {
rightTuple = rightTuple.getHandleNext();
rightTuples = bms[i].getStagedRightTuples();
rightTuples.addDelete(rightTuple);
}
}
leftTuple.clearStaged();
leftTuple = next;
}
for (LeftTuple leftTuple = srcTuples.getUpdateFirst(); leftTuple != null; ) {
LeftTuple next = leftTuple.getStagedNext();
InternalFactHandle handle = (InternalFactHandle) leftTuple.getObject();
RightTuple rightTuple = handle.getFirstRightTuple();
RightTupleSets rightTuples = bm.getStagedRightTuples();
rightTuples.addUpdate(rightTuple);
if (bns != null) {
// Add peered RightTuples, they are attached to FH - unlink LeftTuples that has a peer ref
for (int i = 0; i < length; i++) {
rightTuple = rightTuple.getHandleNext();
rightTuples = bms[i].getStagedRightTuples();
rightTuples.addUpdate(rightTuple);
}
}