SlidingLengthWindowContext window = (SlidingLengthWindowContext) context;
window.pos = (window.pos + 1) % window.handles.length;
if ( window.handles[window.pos] != null ) {
final EventFactHandle previous = window.handles[window.pos];
// retract previous
final PropagationContext pctx = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(),
PropagationContext.EXPIRATION,
null,
null,
previous );
WindowTupleList list = (WindowTupleList) memory.events.get( previous );
//for( RightTuple tuple = list.getFirstWindowTuple(); tuple != null; tuple = list.getFirstWindowTuple() ) {
for( WindowTuple tuple = list.getFirstWindowTuple(); tuple != null; ) {
WindowTuple next = tuple.getWindowNext();
tuple.setPropagationContext(pctx);
tuple.getRightTupleSink().retractRightTuple(tuple,
pctx,
workingMemory);
pctx.evaluateActionQueue(workingMemory);
//tuple.unlinkFromRightParent();
tuple = next;
}
// Commented out, for phreak development
// for( WindowTuple tuple = list.getFirstWindowTuple(); tuple != null; ) {