Search in sources :

Example 1 with RiaPathMemory

use of org.drools.core.reteoo.RiaPathMemory in project drools by kiegroup.

the class RuleNetworkEvaluator method doRiaNode.

private void doRiaNode(InternalAgenda agenda, PathMemory pmem, TupleSets<LeftTuple> srcTuples, BetaNode betaNode, LeftTupleSinkNode sink, SegmentMemory[] smems, int smemIndex, Memory nodeMem, BetaMemory bm, LinkedList<StackEntry> stack, RuleExecutor executor) {
    RiaPathMemory pathMem = bm.getRiaRuleMemory();
    SegmentMemory[] subnetworkSmems = pathMem.getSegmentMemories();
    SegmentMemory subSmem = null;
    for (int i = 0; subSmem == null; i++) {
        // segment positions outside of the subnetwork, in the parent chain, are null
        // so we must iterate to find the first non null segment memory
        subSmem = subnetworkSmems[i];
    }
    // Resume the node after the riaNode segment has been processed and the right input memory populated
    StackEntry stackEntry = new StackEntry(betaNode, bm.getNodePosMaskBit(), sink, pmem, nodeMem, smems, smemIndex, srcTuples, false, false);
    stack.add(stackEntry);
    if (log.isTraceEnabled()) {
        int offset = getOffset(betaNode);
        log.trace("{} RiaQueue {} {}", indent(offset), betaNode.toString(), srcTuples.toStringSizes());
    }
    TupleSets<LeftTuple> subLts = subSmem.getStagedLeftTuples().takeAll();
    // node is first in the segment, so bit is 1
    innerEval(pathMem, subSmem.getRootNode(), 1, subSmem.getNodeMemories().getFirst(), subnetworkSmems, subSmem.getPos(), subLts, agenda, stack, true, executor);
}
Also used : SegmentMemory(org.drools.core.reteoo.SegmentMemory) RiaPathMemory(org.drools.core.reteoo.RiaPathMemory) LeftTuple(org.drools.core.reteoo.LeftTuple)

Aggregations

LeftTuple (org.drools.core.reteoo.LeftTuple)1 RiaPathMemory (org.drools.core.reteoo.RiaPathMemory)1 SegmentMemory (org.drools.core.reteoo.SegmentMemory)1