use of org.drools.core.reteoo.WindowNode.WindowMemory in project drools by kiegroup.
the class WindowNode method createMemory.
/**
* Creates the WindowNode's memory.
*/
public WindowMemory createMemory(final RuleBaseConfiguration config, InternalWorkingMemory wm) {
WindowMemory memory = new WindowMemory();
memory.behaviorContext = this.behavior.createBehaviorContext();
return memory;
}
use of org.drools.core.reteoo.WindowNode.WindowMemory in project drools by kiegroup.
the class WindowNode method assertObject.
public void assertObject(final InternalFactHandle factHandle, final PropagationContext pctx, final InternalWorkingMemory workingMemory) {
EventFactHandle evFh = (EventFactHandle) factHandle;
for (AlphaNodeFieldConstraint constraint : constraints) {
if (!constraint.isAllowed(evFh, workingMemory)) {
return;
}
}
RightTuple rightTuple = new RightTupleImpl(evFh, this);
rightTuple.setPropagationContext(pctx);
// this is cloned, as we need to separate the child RightTuple references
InternalFactHandle clonedFh = evFh.cloneAndLink();
rightTuple.setContextObject(clonedFh);
// process the behavior
final WindowMemory memory = workingMemory.getNodeMemory(this);
if (!behavior.assertFact(memory.behaviorContext, clonedFh, pctx, workingMemory)) {
return;
}
this.sink.propagateAssertObject(clonedFh, pctx, workingMemory);
}
use of org.drools.core.reteoo.WindowNode.WindowMemory in project drools by kiegroup.
the class WindowNode method retractRightTuple.
@Override
public void retractRightTuple(RightTuple rightTuple, PropagationContext pctx, InternalWorkingMemory wm) {
if (isInUse()) {
// This retraction could be the effect of an event expiration, but this node could be no
// longer in use since an incremental update could have concurrently removed it
WindowMemory memory = wm.getNodeMemory(this);
behavior.retractFact(memory.behaviorContext, rightTuple.getFactHandle(), pctx, wm);
}
InternalFactHandle clonedFh = (InternalFactHandle) rightTuple.getContextObject();
ObjectTypeNode.doRetractObject(clonedFh, pctx, wm);
}
Aggregations