Search in sources :

Example 1 with WindowMemory

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;
}
Also used : WindowMemory(org.drools.core.reteoo.WindowNode.WindowMemory)

Example 2 with WindowMemory

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);
}
Also used : AlphaNodeFieldConstraint(org.drools.core.spi.AlphaNodeFieldConstraint) WindowMemory(org.drools.core.reteoo.WindowNode.WindowMemory) EventFactHandle(org.drools.core.common.EventFactHandle) InternalFactHandle(org.drools.core.common.InternalFactHandle)

Example 3 with WindowMemory

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);
}
Also used : WindowMemory(org.drools.core.reteoo.WindowNode.WindowMemory) InternalFactHandle(org.drools.core.common.InternalFactHandle)

Aggregations

WindowMemory (org.drools.core.reteoo.WindowNode.WindowMemory)3 InternalFactHandle (org.drools.core.common.InternalFactHandle)2 EventFactHandle (org.drools.core.common.EventFactHandle)1 AlphaNodeFieldConstraint (org.drools.core.spi.AlphaNodeFieldConstraint)1