Search in sources :

Example 1 with AbstractTerminalNode

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

the class AddRemoveRule method forceFlushLeftTuple.

public static void forceFlushLeftTuple(PathMemory pmem, SegmentMemory sm, InternalWorkingMemory wm, TupleSets<LeftTuple> leftTupleSets) {
    SegmentMemory[] smems = pmem.getSegmentMemories();
    LeftTupleNode node;
    Memory mem;
    long bit = 1;
    if (sm.getRootNode().getType() == NodeTypeEnums.LeftInputAdapterNode && sm.getTipNode().getType() != NodeTypeEnums.LeftInputAdapterNode) {
        // The segment is the first and it has the lian shared with other nodes, the lian must be skipped, so adjust the bit and sink
        node = sm.getRootNode().getSinkPropagator().getFirstLeftTupleSink();
        mem = sm.getNodeMemories().get(1);
        // adjust bit to point to next node
        bit = 2;
    } else {
        node = sm.getRootNode();
        mem = sm.getNodeMemories().get(0);
    }
    PathMemory rtnPmem = NodeTypeEnums.isTerminalNode(pmem.getPathEndNode()) ? pmem : wm.getNodeMemory((AbstractTerminalNode) pmem.getPathEndNode().getPathEndNodes()[0]);
    InternalAgenda agenda = pmem.getActualAgenda(wm);
    new RuleNetworkEvaluator().outerEval(pmem, node, bit, mem, smems, sm.getPos(), leftTupleSets, agenda, new LinkedList<StackEntry>(), true, rtnPmem.getOrCreateRuleAgendaItem(agenda).getRuleExecutor());
}
Also used : AbstractTerminalNode(org.drools.core.reteoo.AbstractTerminalNode) InternalAgenda(org.drools.core.common.InternalAgenda) SegmentMemory(org.drools.core.reteoo.SegmentMemory) Memory(org.drools.core.common.Memory) PathMemory(org.drools.core.reteoo.PathMemory) InternalWorkingMemory(org.drools.core.common.InternalWorkingMemory) SegmentNodeMemory(org.drools.core.reteoo.SegmentNodeMemory) ObjectTypeNodeMemory(org.drools.core.reteoo.ObjectTypeNode.ObjectTypeNodeMemory) RiaNodeMemory(org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory) AccumulateMemory(org.drools.core.reteoo.AccumulateNode.AccumulateMemory) TupleMemory(org.drools.core.reteoo.TupleMemory) BetaMemory(org.drools.core.reteoo.BetaMemory) SegmentMemory(org.drools.core.reteoo.SegmentMemory) FromMemory(org.drools.core.reteoo.FromNode.FromMemory) LeftTupleNode(org.drools.core.reteoo.LeftTupleNode) PathMemory(org.drools.core.reteoo.PathMemory)

Aggregations

InternalAgenda (org.drools.core.common.InternalAgenda)1 InternalWorkingMemory (org.drools.core.common.InternalWorkingMemory)1 Memory (org.drools.core.common.Memory)1 AbstractTerminalNode (org.drools.core.reteoo.AbstractTerminalNode)1 AccumulateMemory (org.drools.core.reteoo.AccumulateNode.AccumulateMemory)1 BetaMemory (org.drools.core.reteoo.BetaMemory)1 FromMemory (org.drools.core.reteoo.FromNode.FromMemory)1 LeftTupleNode (org.drools.core.reteoo.LeftTupleNode)1 ObjectTypeNodeMemory (org.drools.core.reteoo.ObjectTypeNode.ObjectTypeNodeMemory)1 PathMemory (org.drools.core.reteoo.PathMemory)1 RiaNodeMemory (org.drools.core.reteoo.RightInputAdapterNode.RiaNodeMemory)1 SegmentMemory (org.drools.core.reteoo.SegmentMemory)1 SegmentNodeMemory (org.drools.core.reteoo.SegmentNodeMemory)1 TupleMemory (org.drools.core.reteoo.TupleMemory)1