public void execute(InternalWorkingMemory workingMemory) { leftTuple.setLeftTupleSink(this.node); if (leftTuple.getFirstChild() == null) { this.node.assertLeftTuple(leftTuple, context, workingMemory); } else { if (retract) { this.node .getSinkPropagator() .propagateRetractLeftTuple(leftTuple, context, workingMemory); } else { this.node .getSinkPropagator() .propagateModifyChildLeftTuple(leftTuple, context, workingMemory, true); } } if (leftTuple.getLeftParent() == null) { // It's not an open query, as we aren't recording parent chains, so we need to clear out // right memory Object node = workingMemory.getNodeMemory(this.node); RightTupleMemory rightMemory = null; if (node instanceof BetaMemory) { rightMemory = ((BetaMemory) node).getRightTupleMemory(); } else if (node instanceof AccumulateMemory) { rightMemory = ((AccumulateMemory) node).betaMemory.getRightTupleMemory(); } final TupleStartEqualsConstraint constraint = TupleStartEqualsConstraint.getInstance(); TupleStartEqualsConstraintContextEntry contextEntry = new TupleStartEqualsConstraintContextEntry(); contextEntry.updateFromTuple(workingMemory, leftTuple); FastIterator rightIt = rightMemory.fastIterator(); RightTuple temp = null; for (RightTuple rightTuple = rightMemory.getFirst( leftTuple, (InternalFactHandle) context.getFactHandle(), rightIt); rightTuple != null; ) { temp = (RightTuple) rightIt.next(rightTuple); if (constraint.isAllowedCachedLeft(contextEntry, rightTuple.getFactHandle())) { rightMemory.remove(rightTuple); } rightTuple = temp; } } }