Search in sources :

Example 1 with RiaNodeMemory

use of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory in project drools by kiegroup.

the class SegmentUtilities method createSegmentMemory.

public static SegmentMemory createSegmentMemory(LeftTupleSource tupleSource, Memory mem, InternalWorkingMemory wm) {
    // find segment root
    while (!SegmentUtilities.isRootNode(tupleSource, null)) {
        tupleSource = tupleSource.getLeftTupleSource();
    }
    LeftTupleSource segmentRoot = tupleSource;
    int nodeTypesInSegment = 0;
    SegmentMemory smem = restoreSegmentFromPrototype(wm, segmentRoot, nodeTypesInSegment);
    if (smem != null) {
        if (NodeTypeEnums.isBetaNode(segmentRoot) && ((BetaNode) segmentRoot).isRightInputIsRiaNode()) {
            createRiaSegmentMemory((BetaNode) segmentRoot, wm);
        }
        return smem;
    }
    smem = new SegmentMemory(segmentRoot);
    // Iterate all nodes on the same segment, assigning their position as a bit mask value
    // allLinkedTestMask is the resulting mask used to test if all nodes are linked in
    long nodePosMask = 1;
    long allLinkedTestMask = 0;
    // nodes after a branch CE can notify, but they cannot impact linking
    boolean updateNodeBit = true;
    while (true) {
        nodeTypesInSegment = updateNodeTypesMask(tupleSource, nodeTypesInSegment);
        if (NodeTypeEnums.isBetaNode(tupleSource)) {
            allLinkedTestMask = processBetaNode((BetaNode) tupleSource, wm, smem, nodePosMask, allLinkedTestMask, updateNodeBit);
        } else {
            switch(tupleSource.getType()) {
                case NodeTypeEnums.LeftInputAdapterNode:
                    allLinkedTestMask = processLiaNode((LeftInputAdapterNode) tupleSource, wm, smem, nodePosMask, allLinkedTestMask);
                    break;
                case NodeTypeEnums.EvalConditionNode:
                    processEvalNode((EvalConditionNode) tupleSource, wm, smem);
                    break;
                case NodeTypeEnums.ConditionalBranchNode:
                    updateNodeBit = processBranchNode((ConditionalBranchNode) tupleSource, wm, smem);
                    break;
                case NodeTypeEnums.FromNode:
                    processFromNode((FromNode) tupleSource, wm, smem);
                    break;
                case NodeTypeEnums.ReactiveFromNode:
                    processReactiveFromNode((MemoryFactory) tupleSource, wm, smem, nodePosMask);
                    break;
                case NodeTypeEnums.TimerConditionNode:
                    processTimerNode((TimerNode) tupleSource, wm, smem, nodePosMask);
                    break;
                case NodeTypeEnums.QueryElementNode:
                    updateNodeBit = processQueryNode((QueryElementNode) tupleSource, wm, segmentRoot, smem, nodePosMask);
                    break;
            }
        }
        nodePosMask = nodePosMask << 1;
        if (tupleSource.getSinkPropagator().size() == 1) {
            LeftTupleSinkNode sink = tupleSource.getSinkPropagator().getFirstLeftTupleSink();
            if (NodeTypeEnums.isLeftTupleSource(sink)) {
                tupleSource = (LeftTupleSource) sink;
            } else {
                // rtn or rian
                // While not technically in a segment, we want to be able to iterate easily from the last node memory to the ria/rtn memory
                // we don't use createNodeMemory, as these may already have been created by, but not added, by the method updateRiaAndTerminalMemory
                Memory memory = wm.getNodeMemory((MemoryFactory) sink);
                if (sink.getType() == NodeTypeEnums.RightInputAdaterNode) {
                    PathMemory riaPmem = ((RiaNodeMemory) memory).getRiaPathMemory();
                    smem.getNodeMemories().add(riaPmem);
                    RightInputAdapterNode rian = (RightInputAdapterNode) sink;
                    ObjectSink[] nodes = rian.getObjectSinkPropagator().getSinks();
                    for (ObjectSink node : nodes) {
                        if (NodeTypeEnums.isLeftTupleSource(node)) {
                            createSegmentMemory((LeftTupleSource) node, wm);
                        }
                    }
                } else if (NodeTypeEnums.isTerminalNode(sink)) {
                    smem.getNodeMemories().add(memory);
                }
                memory.setSegmentMemory(smem);
                smem.setTipNode(sink);
                break;
            }
        } else {
            // not in same segment
            smem.setTipNode(tupleSource);
            break;
        }
    }
    smem.setAllLinkedMaskTest(allLinkedTestMask);
    // iterate to find root and determine the SegmentNodes position in the RuleSegment
    LeftTupleSource pathRoot = segmentRoot;
    int ruleSegmentPosMask = 1;
    int counter = 0;
    while (pathRoot.getType() != NodeTypeEnums.LeftInputAdapterNode) {
        LeftTupleSource leftTupleSource = pathRoot.getLeftTupleSource();
        if (SegmentUtilities.isNonTerminalTipNode(leftTupleSource, null)) {
            // for each new found segment, increase the mask bit position
            ruleSegmentPosMask = ruleSegmentPosMask << 1;
            counter++;
        }
        pathRoot = leftTupleSource;
    }
    smem.setSegmentPosMaskBit(ruleSegmentPosMask);
    smem.setPos(counter);
    nodeTypesInSegment = updateRiaAndTerminalMemory(tupleSource, tupleSource, smem, wm, false, nodeTypesInSegment);
    ((KnowledgeBaseImpl) wm.getKnowledgeBase()).registerSegmentPrototype(segmentRoot, smem);
    return smem;
}
Also used : SegmentMemory(org.drools.core.reteoo.SegmentMemory) BetaNode(org.drools.core.reteoo.BetaNode) Memory(org.drools.core.common.Memory) TimerNodeMemory(org.drools.core.reteoo.TimerNode.TimerNodeMemory) LiaNodeMemory(org.drools.core.reteoo.LeftInputAdapterNode.LiaNodeMemory) BetaMemory(org.drools.core.reteoo.BetaMemory) EvalMemory(org.drools.core.reteoo.EvalConditionNode.EvalMemory) QueryElementNodeMemory(org.drools.core.reteoo.QueryElementNode.QueryElementNodeMemory) SegmentMemory(org.drools.core.reteoo.SegmentMemory) PathMemory(org.drools.core.reteoo.PathMemory) InternalWorkingMemory(org.drools.core.common.InternalWorkingMemory) ConditionalBranchMemory(org.drools.core.reteoo.ConditionalBranchNode.ConditionalBranchMemory) RiaNodeMemory(org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory) AccumulateMemory(org.drools.core.reteoo.AccumulateNode.AccumulateMemory) QueryElementNode(org.drools.core.reteoo.QueryElementNode) ConditionalBranchNode(org.drools.core.reteoo.ConditionalBranchNode) KnowledgeBaseImpl(org.drools.core.impl.KnowledgeBaseImpl) QueryNameConstraint(org.drools.core.rule.constraint.QueryNameConstraint) LeftTupleSource(org.drools.core.reteoo.LeftTupleSource) RiaNodeMemory(org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory) LeftTupleSinkNode(org.drools.core.reteoo.LeftTupleSinkNode) ObjectSink(org.drools.core.reteoo.ObjectSink) RightInputAdapterNode(org.drools.core.reteoo.RightInputAdapterNode) LeftInputAdapterNode(org.drools.core.reteoo.LeftInputAdapterNode) PathMemory(org.drools.core.reteoo.PathMemory)

Example 2 with RiaNodeMemory

use of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory in project drools by kiegroup.

the class SegmentUtilities method updateRiaAndTerminalMemory.

/**
 * This adds the segment memory to the terminal node or ria node's list of memories.
 * In the case of the terminal node this allows it to know that all segments from
 * the tip to root are linked.
 * In the case of the ria node its all the segments up to the start of the subnetwork.
 * This is because the rianode only cares if all of it's segments are linked, then
 * it sets the bit of node it is the right input for.
 */
private static int updateRiaAndTerminalMemory(LeftTupleSource lt, LeftTupleSource originalLt, SegmentMemory smem, InternalWorkingMemory wm, boolean fromPrototype, int nodeTypesInSegment) {
    nodeTypesInSegment = checkSegmentBoundary(lt, wm, nodeTypesInSegment);
    for (LeftTupleSink sink : lt.getSinkPropagator().getSinks()) {
        if (NodeTypeEnums.isLeftTupleSource(sink)) {
            nodeTypesInSegment = updateRiaAndTerminalMemory((LeftTupleSource) sink, originalLt, smem, wm, fromPrototype, nodeTypesInSegment);
        } else if (sink.getType() == NodeTypeEnums.RightInputAdaterNode) {
            // Even though we don't add the pmem and smem together, all pmem's for all pathend nodes must be initialized
            RiaNodeMemory riaMem = (RiaNodeMemory) wm.getNodeMemory((MemoryFactory) sink);
            // Only add the RIANode, if the LeftTupleSource is part of the RIANode subnetwork
            if (inSubNetwork((RightInputAdapterNode) sink, originalLt)) {
                PathMemory pmem = riaMem.getRiaPathMemory();
                smem.addPathMemory(pmem);
                if (smem.getPos() < pmem.getSegmentMemories().length) {
                    pmem.setSegmentMemory(smem.getPos(), smem);
                }
                if (fromPrototype) {
                    ObjectSink[] nodes = ((RightInputAdapterNode) sink).getObjectSinkPropagator().getSinks();
                    for (ObjectSink node : nodes) {
                        // check if the SegmentMemory has been already created by the BetaNode and if so avoid to build it twice
                        if (NodeTypeEnums.isLeftTupleSource(node) && wm.getNodeMemory((MemoryFactory) node).getSegmentMemory() == null) {
                            restoreSegmentFromPrototype(wm, (LeftTupleSource) node, nodeTypesInSegment);
                        }
                    }
                } else if ((pmem.getAllLinkedMaskTest() & (1L << pmem.getSegmentMemories().length)) == 0) {
                    // must eagerly initialize child segment memories
                    ObjectSink[] nodes = ((RightInputAdapterNode) sink).getObjectSinkPropagator().getSinks();
                    for (ObjectSink node : nodes) {
                        if (NodeTypeEnums.isLeftTupleSource(node)) {
                            createSegmentMemory((LeftTupleSource) node, wm);
                        }
                    }
                }
            }
        } else if (NodeTypeEnums.isTerminalNode(sink)) {
            PathMemory pmem = (PathMemory) wm.getNodeMemory((MemoryFactory) sink);
            smem.addPathMemory(pmem);
            // with the former one and in this case doesn't have to be added to the the path memory
            if (smem.getPos() < pmem.getSegmentMemories().length) {
                pmem.setSegmentMemory(smem.getPos(), smem);
                if (smem.isSegmentLinked()) {
                    // not's can cause segments to be linked, and the rules need to be notified for evaluation
                    smem.notifyRuleLinkSegment(wm);
                }
                checkEagerSegmentCreation(sink.getLeftTupleSource(), wm, nodeTypesInSegment);
            }
        }
    }
    return nodeTypesInSegment;
}
Also used : LeftTupleSource(org.drools.core.reteoo.LeftTupleSource) RiaNodeMemory(org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory) LeftTupleSink(org.drools.core.reteoo.LeftTupleSink) ObjectSink(org.drools.core.reteoo.ObjectSink) MemoryFactory(org.drools.core.common.MemoryFactory) RightInputAdapterNode(org.drools.core.reteoo.RightInputAdapterNode) PathMemory(org.drools.core.reteoo.PathMemory)

Example 3 with RiaNodeMemory

use of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory in project drools by kiegroup.

the class SegmentUtilities method updateRiaAndTerminalMemory.

/**
 * This adds the segment memory to the terminal node or ria node's list of memories.
 * In the case of the terminal node this allows it to know that all segments from
 * the tip to root are linked.
 * In the case of the ria node its all the segments up to the start of the subnetwork.
 * This is because the rianode only cares if all of it's segments are linked, then
 * it sets the bit of node it is the right input for.
 */
private static int updateRiaAndTerminalMemory(LeftTupleSource lt, LeftTupleSource originalLt, SegmentMemory smem, ReteEvaluator reteEvaluator, boolean fromPrototype, int nodeTypesInSegment) {
    nodeTypesInSegment = checkSegmentBoundary(lt, reteEvaluator, nodeTypesInSegment);
    PathMemory pmem = null;
    for (LeftTupleSink sink : lt.getSinkPropagator().getSinks()) {
        if (NodeTypeEnums.isLeftTupleSource(sink)) {
            nodeTypesInSegment = updateRiaAndTerminalMemory((LeftTupleSource) sink, originalLt, smem, reteEvaluator, fromPrototype, nodeTypesInSegment);
        } else if (sink.getType() == NodeTypeEnums.RightInputAdaterNode) {
            // Even though we don't add the pmem and smem together, all pmem's for all pathend nodes must be initialized
            RiaNodeMemory riaMem = (RiaNodeMemory) reteEvaluator.getNodeMemory((MemoryFactory) sink);
            // Only add the RIANode, if the LeftTupleSource is part of the RIANode subnetwork
            if (inSubNetwork((RightInputAdapterNode) sink, originalLt)) {
                pmem = riaMem.getRiaPathMemory();
                if (fromPrototype) {
                    ObjectSink[] nodes = ((RightInputAdapterNode) sink).getObjectSinkPropagator().getSinks();
                    for (ObjectSink node : nodes) {
                        // check if the SegmentMemory has been already created by the BetaNode and if so avoid to build it twice
                        if (NodeTypeEnums.isLeftTupleSource(node) && reteEvaluator.getNodeMemory((MemoryFactory) node).getSegmentMemory() == null) {
                            restoreSegmentFromPrototype(reteEvaluator, (LeftTupleSource) node, nodeTypesInSegment);
                        }
                    }
                } else if ((pmem.getAllLinkedMaskTest() & (1L << pmem.getSegmentMemories().length)) == 0) {
                    // must eagerly initialize child segment memories
                    ObjectSink[] nodes = ((RightInputAdapterNode) sink).getObjectSinkPropagator().getSinks();
                    for (ObjectSink node : nodes) {
                        if (NodeTypeEnums.isLeftTupleSource(node)) {
                            createSegmentMemory((LeftTupleSource) node, reteEvaluator);
                        }
                    }
                }
            }
        } else if (NodeTypeEnums.isTerminalNode(sink)) {
            pmem = (PathMemory) reteEvaluator.getNodeMemory((MemoryFactory) sink);
        }
        if (pmem != null && smem.getPos() < pmem.getSegmentMemories().length) {
            smem.addPathMemory(pmem);
            pmem.setSegmentMemory(smem.getPos(), smem);
            if (smem.isSegmentLinked()) {
                // not's can cause segments to be linked, and the rules need to be notified for evaluation
                smem.notifyRuleLinkSegment(reteEvaluator);
            }
            checkEagerSegmentCreation(sink.getLeftTupleSource(), reteEvaluator, nodeTypesInSegment);
            pmem = null;
        }
    }
    return nodeTypesInSegment;
}
Also used : LeftTupleSource(org.drools.core.reteoo.LeftTupleSource) RiaNodeMemory(org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory) LeftTupleSink(org.drools.core.reteoo.LeftTupleSink) ObjectSink(org.drools.core.reteoo.ObjectSink) RightInputAdapterNode(org.drools.core.reteoo.RightInputAdapterNode) PathMemory(org.drools.core.reteoo.PathMemory)

Example 4 with RiaNodeMemory

use of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory in project drools by kiegroup.

the class SegmentUtilities method createSegmentMemory.

public static SegmentMemory createSegmentMemory(LeftTupleSource tupleSource, Memory mem, ReteEvaluator reteEvaluator) {
    // find segment root
    while (!SegmentUtilities.isRootNode(tupleSource, null)) {
        tupleSource = tupleSource.getLeftTupleSource();
    }
    LeftTupleSource segmentRoot = tupleSource;
    int nodeTypesInSegment = 0;
    SegmentMemory smem = restoreSegmentFromPrototype(reteEvaluator, segmentRoot, nodeTypesInSegment);
    if (smem != null) {
        if (NodeTypeEnums.isBetaNode(segmentRoot) && ((BetaNode) segmentRoot).isRightInputIsRiaNode()) {
            createRiaSegmentMemory((BetaNode) segmentRoot, reteEvaluator);
        }
        return smem;
    }
    smem = new SegmentMemory(segmentRoot);
    // Iterate all nodes on the same segment, assigning their position as a bit mask value
    // allLinkedTestMask is the resulting mask used to test if all nodes are linked in
    long nodePosMask = 1;
    long allLinkedTestMask = 0;
    // nodes after a branch CE can notify, but they cannot impact linking
    boolean updateNodeBit = true;
    while (true) {
        nodeTypesInSegment = updateNodeTypesMask(tupleSource, nodeTypesInSegment);
        if (NodeTypeEnums.isBetaNode(tupleSource)) {
            allLinkedTestMask = processBetaNode((BetaNode) tupleSource, reteEvaluator, smem, nodePosMask, allLinkedTestMask, updateNodeBit);
        } else {
            switch(tupleSource.getType()) {
                case NodeTypeEnums.LeftInputAdapterNode:
                    allLinkedTestMask = processLiaNode((LeftInputAdapterNode) tupleSource, reteEvaluator, smem, nodePosMask, allLinkedTestMask);
                    break;
                case NodeTypeEnums.EvalConditionNode:
                    processEvalNode((EvalConditionNode) tupleSource, reteEvaluator, smem);
                    break;
                case NodeTypeEnums.ConditionalBranchNode:
                    updateNodeBit = processBranchNode((ConditionalBranchNode) tupleSource, reteEvaluator, smem);
                    break;
                case NodeTypeEnums.FromNode:
                    processFromNode((FromNode) tupleSource, reteEvaluator, smem);
                    break;
                case NodeTypeEnums.ReactiveFromNode:
                    processReactiveFromNode((MemoryFactory) tupleSource, reteEvaluator, smem, nodePosMask);
                    break;
                case NodeTypeEnums.TimerConditionNode:
                    processTimerNode((TimerNode) tupleSource, reteEvaluator, smem, nodePosMask);
                    break;
                case NodeTypeEnums.AsyncSendNode:
                    processAsyncSendNode((AsyncSendNode) tupleSource, reteEvaluator, smem);
                    break;
                case NodeTypeEnums.AsyncReceiveNode:
                    processAsyncReceiveNode((AsyncReceiveNode) tupleSource, reteEvaluator, smem, nodePosMask);
                    break;
                case NodeTypeEnums.QueryElementNode:
                    updateNodeBit = processQueryNode((QueryElementNode) tupleSource, reteEvaluator, segmentRoot, smem, nodePosMask);
                    break;
            }
        }
        nodePosMask = nodePosMask << 1;
        if (tupleSource.getSinkPropagator().size() == 1) {
            LeftTupleSinkNode sink = tupleSource.getSinkPropagator().getFirstLeftTupleSink();
            if (NodeTypeEnums.isLeftTupleSource(sink)) {
                tupleSource = (LeftTupleSource) sink;
            } else {
                // rtn or rian
                // While not technically in a segment, we want to be able to iterate easily from the last node memory to the ria/rtn memory
                // we don't use createNodeMemory, as these may already have been created by, but not added, by the method updateRiaAndTerminalMemory
                Memory memory = reteEvaluator.getNodeMemory((MemoryFactory) sink);
                if (sink.getType() == NodeTypeEnums.RightInputAdaterNode) {
                    PathMemory riaPmem = ((RiaNodeMemory) memory).getRiaPathMemory();
                    smem.getNodeMemories().add(riaPmem);
                    RightInputAdapterNode rian = (RightInputAdapterNode) sink;
                    ObjectSink[] nodes = rian.getObjectSinkPropagator().getSinks();
                    for (ObjectSink node : nodes) {
                        if (NodeTypeEnums.isLeftTupleSource(node)) {
                            createSegmentMemory((LeftTupleSource) node, reteEvaluator);
                        }
                    }
                } else if (NodeTypeEnums.isTerminalNode(sink)) {
                    smem.getNodeMemories().add(memory);
                }
                memory.setSegmentMemory(smem);
                smem.setTipNode(sink);
                break;
            }
        } else {
            // not in same segment
            smem.setTipNode(tupleSource);
            break;
        }
    }
    smem.setAllLinkedMaskTest(allLinkedTestMask);
    // iterate to find root and determine the SegmentNodes position in the RuleSegment
    LeftTupleSource pathRoot = segmentRoot;
    int ruleSegmentPosMask = 1;
    int counter = 0;
    while (pathRoot.getType() != NodeTypeEnums.LeftInputAdapterNode) {
        LeftTupleSource leftTupleSource = pathRoot.getLeftTupleSource();
        if (SegmentUtilities.isNonTerminalTipNode(leftTupleSource, null)) {
            // for each new found segment, increase the mask bit position
            ruleSegmentPosMask = ruleSegmentPosMask << 1;
            counter++;
        }
        pathRoot = leftTupleSource;
    }
    smem.setSegmentPosMaskBit(ruleSegmentPosMask);
    smem.setPos(counter);
    nodeTypesInSegment = updateRiaAndTerminalMemory(tupleSource, tupleSource, smem, reteEvaluator, false, nodeTypesInSegment);
    reteEvaluator.getKnowledgeBase().registerSegmentPrototype(segmentRoot, smem);
    return smem;
}
Also used : SegmentMemory(org.drools.core.reteoo.SegmentMemory) BetaNode(org.drools.core.reteoo.BetaNode) Memory(org.drools.core.common.Memory) TimerNodeMemory(org.drools.core.reteoo.TimerNode.TimerNodeMemory) LiaNodeMemory(org.drools.core.reteoo.LeftInputAdapterNode.LiaNodeMemory) BetaMemory(org.drools.core.reteoo.BetaMemory) EvalMemory(org.drools.core.reteoo.EvalConditionNode.EvalMemory) QueryElementNodeMemory(org.drools.core.reteoo.QueryElementNode.QueryElementNodeMemory) SegmentMemory(org.drools.core.reteoo.SegmentMemory) PathMemory(org.drools.core.reteoo.PathMemory) ConditionalBranchMemory(org.drools.core.reteoo.ConditionalBranchNode.ConditionalBranchMemory) RiaNodeMemory(org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory) AccumulateMemory(org.drools.core.reteoo.AccumulateNode.AccumulateMemory) QueryElementNode(org.drools.core.reteoo.QueryElementNode) ConditionalBranchNode(org.drools.core.reteoo.ConditionalBranchNode) QueryNameConstraint(org.drools.core.rule.constraint.QueryNameConstraint) LeftTupleSource(org.drools.core.reteoo.LeftTupleSource) RiaNodeMemory(org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory) LeftTupleSinkNode(org.drools.core.reteoo.LeftTupleSinkNode) ObjectSink(org.drools.core.reteoo.ObjectSink) RightInputAdapterNode(org.drools.core.reteoo.RightInputAdapterNode) LeftInputAdapterNode(org.drools.core.reteoo.LeftInputAdapterNode) PathMemory(org.drools.core.reteoo.PathMemory)

Example 5 with RiaNodeMemory

use of org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory in project drools by kiegroup.

the class SegmentUtilities method processBetaNode.

private static long processBetaNode(BetaNode betaNode, InternalWorkingMemory wm, SegmentMemory smem, long nodePosMask, long allLinkedTestMask, boolean updateNodeBit) {
    BetaMemory bm = NodeTypeEnums.AccumulateNode == betaNode.getType() ? ((AccumulateMemory) smem.createNodeMemory(betaNode, wm)).getBetaMemory() : (BetaMemory) smem.createNodeMemory(betaNode, wm);
    // this must be set first, to avoid recursion as sub networks can be initialised multiple ways
    // and bm.getSegmentMemory == null check can be used to avoid recursion.
    bm.setSegmentMemory(smem);
    if (betaNode.isRightInputIsRiaNode()) {
        RightInputAdapterNode riaNode = createRiaSegmentMemory(betaNode, wm);
        RiaNodeMemory riaMem = wm.getNodeMemory(riaNode);
        bm.setRiaRuleMemory(riaMem.getRiaPathMemory());
        if (updateNodeBit && canBeDisabled(betaNode) && riaMem.getRiaPathMemory().getAllLinkedMaskTest() > 0) {
            // only ria's with reactive subnetworks can be disabled and thus need checking
            allLinkedTestMask = allLinkedTestMask | nodePosMask;
        }
    } else if (updateNodeBit && canBeDisabled(betaNode)) {
        allLinkedTestMask = allLinkedTestMask | nodePosMask;
    }
    bm.setNodePosMaskBit(nodePosMask);
    if (NodeTypeEnums.NotNode == betaNode.getType()) {
        // not nodes start up linked in
        smem.linkNodeWithoutRuleNotify(bm.getNodePosMaskBit());
    }
    return allLinkedTestMask;
}
Also used : RiaNodeMemory(org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory) BetaMemory(org.drools.core.reteoo.BetaMemory) RightInputAdapterNode(org.drools.core.reteoo.RightInputAdapterNode)

Aggregations

RiaNodeMemory (org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory)7 RightInputAdapterNode (org.drools.core.reteoo.RightInputAdapterNode)6 BetaMemory (org.drools.core.reteoo.BetaMemory)5 PathMemory (org.drools.core.reteoo.PathMemory)5 LeftTupleSource (org.drools.core.reteoo.LeftTupleSource)4 ObjectSink (org.drools.core.reteoo.ObjectSink)4 Memory (org.drools.core.common.Memory)3 AccumulateMemory (org.drools.core.reteoo.AccumulateNode.AccumulateMemory)3 SegmentMemory (org.drools.core.reteoo.SegmentMemory)3 InternalWorkingMemory (org.drools.core.common.InternalWorkingMemory)2 BetaNode (org.drools.core.reteoo.BetaNode)2 ConditionalBranchNode (org.drools.core.reteoo.ConditionalBranchNode)2 ConditionalBranchMemory (org.drools.core.reteoo.ConditionalBranchNode.ConditionalBranchMemory)2 EvalMemory (org.drools.core.reteoo.EvalConditionNode.EvalMemory)2 LeftInputAdapterNode (org.drools.core.reteoo.LeftInputAdapterNode)2 LiaNodeMemory (org.drools.core.reteoo.LeftInputAdapterNode.LiaNodeMemory)2 LeftTupleSink (org.drools.core.reteoo.LeftTupleSink)2 LeftTupleSinkNode (org.drools.core.reteoo.LeftTupleSinkNode)2 QueryElementNode (org.drools.core.reteoo.QueryElementNode)2 QueryElementNodeMemory (org.drools.core.reteoo.QueryElementNode.QueryElementNodeMemory)2