Search in sources :

Example 1 with LeftTupleSink

use of org.drools.core.reteoo.LeftTupleSink 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 2 with LeftTupleSink

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

the class AddRemoveRule method removeNewPaths.

private static void removeNewPaths(InternalWorkingMemory wm, List<PathMemory> pmems) {
    Set<Integer> visitedNodes = new HashSet<Integer>();
    for (PathMemory pmem : pmems) {
        LeftTupleSink tipNode = (LeftTupleSink) pmem.getPathEndNode();
        LeftTupleNode child = tipNode;
        LeftTupleNode parent = tipNode.getLeftTupleSource();
        while (true) {
            if (child.getAssociationsSize() == 1 && NodeTypeEnums.isBetaNode(child)) {
                // If this is a beta node, it'll delete all the right input data
                deleteRightInputData((LeftTupleSink) child, wm);
            }
            if (parent != null && parent.getAssociationsSize() != 1 && child.getAssociationsSize() == 1) {
                // all right input data must be propagated
                if (!visitedNodes.contains(child.getId())) {
                    Memory mem = wm.getNodeMemories().peekNodeMemory(parent);
                    if (mem != null && mem.getSegmentMemory() != null) {
                        SegmentMemory sm = mem.getSegmentMemory();
                        if (sm.getFirst() != null) {
                            SegmentMemory childSm = wm.getNodeMemories().peekNodeMemory(child).getSegmentMemory();
                            sm.remove(childSm);
                        }
                    }
                }
            } else {
                Memory mem = wm.getNodeMemories().peekNodeMemory(child);
                // The root of each segment
                if (mem != null) {
                    SegmentMemory sm = mem.getSegmentMemory();
                    if (sm != null && sm.getPathMemories().contains(pmem)) {
                        mem.getSegmentMemory().removePathMemory(pmem);
                    }
                }
            }
            if (parent == null) {
                break;
            }
            visitedNodes.add(child.getId());
            child = parent;
            parent = parent.getLeftTupleSource();
        }
    }
}
Also used : 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) LeftTupleSink(org.drools.core.reteoo.LeftTupleSink) LeftTupleNode(org.drools.core.reteoo.LeftTupleNode) HashSet(java.util.HashSet) PathMemory(org.drools.core.reteoo.PathMemory)

Example 3 with LeftTupleSink

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

the class LeftTupleIterator method getNextLeftTuple.

public LeftTuple getNextLeftTuple(LeftTupleSource source, LeftTupleSink sink, LeftTuple leftTuple, InternalWorkingMemory wm) {
    if (otnIterator != null) {
        LeftTuple leftParent = leftTuple.getLeftParent();
        while (leftTuple != null) {
            leftTuple = leftTuple.getHandleNext();
            for (; leftTuple != null; leftTuple = leftTuple.getHandleNext()) {
                // Iterate to find the next left tuple for this sink, skip tuples for other sinks due to sharing split
                if (leftTuple.getTupleSink() == sink) {
                    return leftTuple;
                }
            }
        }
        // We have a parent LeftTuple so try there next
        if (leftParent != null) {
            // we know it has to be evalNode query element node
            while (leftParent != null) {
                leftParent = getNextLeftTuple(source.getLeftTupleSource(), (LeftTupleSink) source, leftParent, wm);
                if (leftParent != null) {
                    for (leftTuple = leftParent.getFirstChild(); leftTuple != null; leftTuple = leftTuple.getHandleNext()) {
                        if (leftTuple.getTupleSink() == sink) {
                            return leftTuple;
                        }
                    }
                }
            }
            return null;
        }
        // We have exhausted the current FactHandle, now try the next
        while (otnIterator.hasNext()) {
            InternalFactHandle handle = otnIterator.next();
            leftTuple = handle.findFirstLeftTuple(lt -> lt.getTupleSink() == sink);
            if (leftTuple != null) {
                return leftTuple;
            }
        }
        // We've exhausted this OTN so set the iterator to null
        otnIterator = null;
    } else if (source instanceof AccumulateNode) {
        // when using phreak, accumulate result tuples will not link to leftParent, but to parent instead
        BetaMemory memory = ((AccumulateMemory) wm.getNodeMemory((MemoryFactory) source)).getBetaMemory();
        FastIterator localIt = memory.getLeftTupleMemory().fullFastIterator(leftTuple.getParent());
        LeftTuple childLeftTuple = leftTuple;
        leftTuple = childLeftTuple.getParent();
        while (leftTuple != null) {
            if (childLeftTuple == null) {
                childLeftTuple = leftTuple.getFirstChild();
            } else {
                childLeftTuple = childLeftTuple.getHandleNext();
            }
            for (; childLeftTuple != null; childLeftTuple = childLeftTuple.getHandleNext()) {
                if (childLeftTuple.getTupleSink() == sink) {
                    return childLeftTuple;
                }
            }
            leftTuple = (LeftTuple) localIt.next(leftTuple);
        }
    } else if (source instanceof JoinNode || source instanceof NotNode || source instanceof FromNode || source instanceof AccumulateNode) {
        BetaMemory memory;
        FastIterator localIt;
        if (source instanceof FromNode) {
            memory = ((FromMemory) wm.getNodeMemory((MemoryFactory) source)).getBetaMemory();
        } else if (source instanceof AccumulateNode) {
            memory = ((AccumulateMemory) wm.getNodeMemory((MemoryFactory) source)).getBetaMemory();
        } else {
            memory = (BetaMemory) wm.getNodeMemory((MemoryFactory) source);
        }
        localIt = memory.getLeftTupleMemory().fullFastIterator(leftTuple.getLeftParent());
        LeftTuple childLeftTuple = leftTuple;
        leftTuple = childLeftTuple.getLeftParent();
        while (leftTuple != null) {
            if (childLeftTuple == null) {
                childLeftTuple = leftTuple.getFirstChild();
            } else {
                childLeftTuple = childLeftTuple.getHandleNext();
            }
            for (; childLeftTuple != null; childLeftTuple = childLeftTuple.getHandleNext()) {
                if (childLeftTuple.getTupleSink() == sink) {
                    return childLeftTuple;
                }
            }
            leftTuple = (LeftTuple) localIt.next(leftTuple);
        }
    }
    if (source instanceof ExistsNode) {
        BetaMemory memory = (BetaMemory) wm.getNodeMemory((MemoryFactory) source);
        RightTuple rightTuple = leftTuple.getLeftParent().getBlocker();
        FastIterator localIt = memory.getRightTupleMemory().fullFastIterator(rightTuple);
        for (LeftTuple childleftTuple = leftTuple.getHandleNext(); childleftTuple != null; childleftTuple = childleftTuple.getHandleNext()) {
            if (childleftTuple.getTupleSink() == sink) {
                return childleftTuple;
            }
        }
        leftTuple = leftTuple.getLeftParent();
        // now move onto next RightTuple
        while (rightTuple != null) {
            if (rightTuple.getBlocked() != null) {
                if (leftTuple != null) {
                    leftTuple = leftTuple.getBlockedNext();
                } else {
                    leftTuple = rightTuple.getBlocked();
                }
                for (; leftTuple != null; leftTuple = leftTuple.getBlockedNext()) {
                    for (LeftTuple childleftTuple = leftTuple.getFirstChild(); childleftTuple != null; childleftTuple = childleftTuple.getHandleNext()) {
                        if (childleftTuple.getTupleSink() == sink) {
                            return childleftTuple;
                        }
                    }
                }
            }
            rightTuple = (RightTuple) localIt.next(rightTuple);
        }
    } else if (source instanceof EvalConditionNode || source instanceof QueryElementNode) {
        LeftTuple childLeftTuple = leftTuple;
        if (leftTuple != null) {
            leftTuple = leftTuple.getLeftParent();
            while (leftTuple != null) {
                if (childLeftTuple != null) {
                    childLeftTuple = childLeftTuple.getHandleNext();
                } else {
                    childLeftTuple = leftTuple.getFirstChild();
                }
                for (; childLeftTuple != null; childLeftTuple = childLeftTuple.getHandleNext()) {
                    if (childLeftTuple.getTupleSink() == sink) {
                        return childLeftTuple;
                    }
                }
                if (source instanceof EvalConditionNode) {
                    leftTuple = getNextLeftTuple(source.getLeftTupleSource(), (LeftTupleSink) source, leftTuple, wm);
                } else {
                    leftTuple = getNextLeftTuple(source.getLeftTupleSource(), (LeftTupleSink) source, leftTuple, wm);
                }
            }
        }
    }
    return null;
}
Also used : NotNode(org.drools.core.reteoo.NotNode) ExistsNode(org.drools.core.reteoo.ExistsNode) EvalConditionNode(org.drools.core.reteoo.EvalConditionNode) FastIterator(org.drools.core.util.FastIterator) AccumulateNode(org.drools.core.reteoo.AccumulateNode) AccumulateContext(org.drools.core.reteoo.AccumulateNode.AccumulateContext) BetaMemory(org.drools.core.reteoo.BetaMemory) JoinNode(org.drools.core.reteoo.JoinNode) FromNode(org.drools.core.reteoo.FromNode) LeftTuple(org.drools.core.reteoo.LeftTuple) RightTuple(org.drools.core.reteoo.RightTuple) LeftInputAdapterNode(org.drools.core.reteoo.LeftInputAdapterNode) QueryElementNode(org.drools.core.reteoo.QueryElementNode) Tuple(org.drools.core.spi.Tuple) BetaNode(org.drools.core.reteoo.BetaNode) AccumulateMemory(org.drools.core.reteoo.AccumulateNode.AccumulateMemory) FromMemory(org.drools.core.reteoo.FromNode.FromMemory) ObjectSource(org.drools.core.reteoo.ObjectSource) LeftTupleSink(org.drools.core.reteoo.LeftTupleSink) ObjectTypeNode(org.drools.core.reteoo.ObjectTypeNode) Iterator(org.drools.core.util.Iterator) LeftTupleSource(org.drools.core.reteoo.LeftTupleSource) AccumulateMemory(org.drools.core.reteoo.AccumulateNode.AccumulateMemory) NotNode(org.drools.core.reteoo.NotNode) EvalConditionNode(org.drools.core.reteoo.EvalConditionNode) AccumulateNode(org.drools.core.reteoo.AccumulateNode) JoinNode(org.drools.core.reteoo.JoinNode) QueryElementNode(org.drools.core.reteoo.QueryElementNode) LeftTupleSink(org.drools.core.reteoo.LeftTupleSink) BetaMemory(org.drools.core.reteoo.BetaMemory) FromNode(org.drools.core.reteoo.FromNode) LeftTuple(org.drools.core.reteoo.LeftTuple) ExistsNode(org.drools.core.reteoo.ExistsNode) RightTuple(org.drools.core.reteoo.RightTuple) FastIterator(org.drools.core.util.FastIterator)

Example 4 with LeftTupleSink

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

the class PhreakActivationIterator method processLeftTuples.

public static void processLeftTuples(LeftTupleSource node, List<AgendaItem> agendaItems, Set<RuleTerminalNode> nodeSet, InternalWorkingMemory wm) {
    LeftTupleSource node1 = node;
    while (NodeTypeEnums.LeftInputAdapterNode != node1.getType()) {
        node1 = node1.getLeftTupleSource();
    }
    int maxShareCount = node1.getAssociationsSize();
    while (NodeTypeEnums.LeftInputAdapterNode != node.getType()) {
        Memory memory = wm.getNodeMemory((MemoryFactory) node);
        if (memory.getSegmentMemory() == null) {
            // segment has never been initialized, which means the rule has never been linked.
            return;
        }
        if (node.getAssociationsSize() == maxShareCount) {
            // the recurse must start from the first split node, otherwise we get partial overlaps in propagations
            if (NodeTypeEnums.isBetaNode(node)) {
                BetaMemory bm;
                if (NodeTypeEnums.AccumulateNode == node.getType()) {
                    AccumulateMemory am = (AccumulateMemory) memory;
                    bm = am.getBetaMemory();
                    FastIterator it = bm.getLeftTupleMemory().fullFastIterator();
                    Tuple lt = BetaNode.getFirstTuple(bm.getLeftTupleMemory(), it);
                    for (; lt != null; lt = (LeftTuple) it.next(lt)) {
                        AccumulateContext accctx = (AccumulateContext) lt.getContextObject();
                        collectFromPeers(accctx.getResultLeftTuple(), agendaItems, nodeSet, wm);
                    }
                } else if (NodeTypeEnums.ExistsNode == node.getType()) {
                    bm = (BetaMemory) wm.getNodeMemory((MemoryFactory) node);
                    // done off the RightTupleMemory, as exists only have unblocked tuples on the left side
                    FastIterator it = bm.getRightTupleMemory().fullFastIterator();
                    RightTuple rt = (RightTuple) BetaNode.getFirstTuple(bm.getRightTupleMemory(), it);
                    for (; rt != null; rt = (RightTuple) it.next(rt)) {
                        for (LeftTuple lt = rt.getBlocked(); lt != null; lt = lt.getBlockedNext()) {
                            if (lt.getFirstChild() != null) {
                                collectFromPeers(lt.getFirstChild(), agendaItems, nodeSet, wm);
                            }
                        }
                    }
                } else {
                    bm = (BetaMemory) wm.getNodeMemory((MemoryFactory) node);
                    FastIterator it = bm.getLeftTupleMemory().fullFastIterator();
                    Tuple lt = BetaNode.getFirstTuple(bm.getLeftTupleMemory(), it);
                    for (; lt != null; lt = (LeftTuple) it.next(lt)) {
                        if (lt.getFirstChild() != null) {
                            collectFromLeftInput(lt.getFirstChild(), agendaItems, nodeSet, wm);
                        }
                    }
                }
                return;
            } else if (NodeTypeEnums.FromNode == node.getType()) {
                FromMemory fm = (FromMemory) wm.getNodeMemory((MemoryFactory) node);
                TupleMemory ltm = fm.getBetaMemory().getLeftTupleMemory();
                FastIterator it = ltm.fullFastIterator();
                for (LeftTuple lt = (LeftTuple) ltm.getFirst(null); lt != null; lt = (LeftTuple) it.next(lt)) {
                    if (lt.getFirstChild() != null) {
                        collectFromLeftInput(lt.getFirstChild(), agendaItems, nodeSet, wm);
                    }
                }
                return;
            }
        }
        node = node.getLeftTupleSource();
    }
    // No beta or from nodes, so must retrieve LeftTuples from the LiaNode.
    // This is done by scanning all the LeftTuples referenced from the FactHandles in the ObjectTypeNode
    LeftInputAdapterNode lian = (LeftInputAdapterNode) node;
    Memory memory = wm.getNodeMemory((MemoryFactory) node);
    if (memory.getSegmentMemory() == null) {
        // segment has never been initialized, which means the rule has never been linked.
        return;
    }
    ObjectSource os = lian.getObjectSource();
    while (os.getType() != NodeTypeEnums.ObjectTypeNode) {
        os = os.getParentObjectSource();
    }
    ObjectTypeNode otn = (ObjectTypeNode) os;
    final ObjectTypeNodeMemory omem = wm.getNodeMemory(otn);
    LeftTupleSink firstLiaSink = lian.getSinkPropagator().getFirstLeftTupleSink();
    java.util.Iterator<InternalFactHandle> it = omem.iterator();
    while (it.hasNext()) {
        InternalFactHandle fh = it.next();
        fh.forEachLeftTuple(lt -> {
            if (lt.getTupleSink() == firstLiaSink) {
                collectFromLeftInput(lt, agendaItems, nodeSet, wm);
            }
        });
    }
}
Also used : AccumulateMemory(org.drools.core.reteoo.AccumulateNode.AccumulateMemory) TupleMemory(org.drools.core.reteoo.TupleMemory) BetaMemory(org.drools.core.reteoo.BetaMemory) FromMemory(org.drools.core.reteoo.FromNode.FromMemory) ObjectTypeNodeMemory(org.drools.core.reteoo.ObjectTypeNode.ObjectTypeNodeMemory) AccumulateMemory(org.drools.core.reteoo.AccumulateNode.AccumulateMemory) ObjectTypeNode(org.drools.core.reteoo.ObjectTypeNode) LeftTupleSink(org.drools.core.reteoo.LeftTupleSink) BetaMemory(org.drools.core.reteoo.BetaMemory) RightTuple(org.drools.core.reteoo.RightTuple) LeftTuple(org.drools.core.reteoo.LeftTuple) WorkingMemoryEntryPoint(org.drools.core.WorkingMemoryEntryPoint) TupleMemory(org.drools.core.reteoo.TupleMemory) ObjectTypeNodeMemory(org.drools.core.reteoo.ObjectTypeNode.ObjectTypeNodeMemory) LeftTupleSource(org.drools.core.reteoo.LeftTupleSource) FromMemory(org.drools.core.reteoo.FromNode.FromMemory) ObjectSource(org.drools.core.reteoo.ObjectSource) FastIterator(org.drools.core.util.FastIterator) LeftTuple(org.drools.core.reteoo.LeftTuple) RightTuple(org.drools.core.reteoo.RightTuple) Tuple(org.drools.core.spi.Tuple) AccumulateContext(org.drools.core.reteoo.AccumulateNode.AccumulateContext) LeftInputAdapterNode(org.drools.core.reteoo.LeftInputAdapterNode)

Example 5 with LeftTupleSink

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

the class FromTest method testFromSharingWithPropertyReactive.

@Test
public void testFromSharingWithPropertyReactive() {
    // As above but with property reactive as default
    String drl = "import " + ListsContainer.class.getCanonicalName() + "\n" + "global java.util.List output1;\n" + "global java.util.List output2;\n" + "rule R1 when\n" + "    ListsContainer( $list : list1 )\n" + "    $s : String( length == 2 ) from $list\n" + "then\n" + "    output1.add($s);\n" + "end\n" + "rule R2 when\n" + "    ListsContainer( $list : list2 )\n" + "    $s : String( length == 2 ) from $list\n" + "then\n" + "    output2.add($s);\n" + "end\n" + "rule R3 when\n" + "    ListsContainer( $list : list2 )\n" + "    $s : String( length == 2 ) from $list\n" + "then\n" + "    output2.add($s);\n" + "end\n";
    // property reactive as default:
    KieBase kbase = new KieHelper().addContent(drl, ResourceType.DRL).build();
    KieSession ksession = kbase.newKieSession();
    ReteDumper.dumpRete(kbase);
    List<String> output1 = new ArrayList<String>();
    ksession.setGlobal("output1", output1);
    List<String> output2 = new ArrayList<String>();
    ksession.setGlobal("output2", output2);
    FactHandle fh = ksession.insert(new ListsContainer());
    ksession.fireAllRules();
    assertEquals("bb", output1.get(0));
    assertEquals("22", output2.get(0));
    assertEquals("22", output2.get(1));
    EntryPointNode epn = ((InternalKnowledgeBase) kbase).getRete().getEntryPointNodes().values().iterator().next();
    ObjectTypeNode otn = epn.getObjectTypeNodes().get(new ClassObjectType(ListsContainer.class));
    // There are 2 LIAs, one for the list1 and the other for the list2
    assertEquals(2, otn.getObjectSinkPropagator().size());
    LeftInputAdapterNode lia0 = (LeftInputAdapterNode) otn.getObjectSinkPropagator().getSinks()[0];
    // There are only 2 FromNodes since R2 and R3 are sharing the second From
    // The first FROM node has R1 has sink
    LeftTupleSink[] sinks0 = lia0.getSinkPropagator().getSinks();
    assertEquals(1, sinks0.length);
    assertEquals(1, sinks0[0].getSinkPropagator().size());
    // The second FROM node has both R2 and R3 as sinks
    LeftInputAdapterNode lia1 = (LeftInputAdapterNode) otn.getObjectSinkPropagator().getSinks()[1];
    LeftTupleSink[] sinks1 = lia1.getSinkPropagator().getSinks();
    assertEquals(1, sinks1.length);
    assertEquals(2, sinks1[0].getSinkPropagator().size());
}
Also used : ClassObjectType(org.drools.core.base.ClassObjectType) FactHandle(org.kie.api.runtime.rule.FactHandle) ArrayList(java.util.ArrayList) ObjectTypeNode(org.drools.core.reteoo.ObjectTypeNode) LeftTupleSink(org.drools.core.reteoo.LeftTupleSink) KieHelper(org.kie.internal.utils.KieHelper) EntryPointNode(org.drools.core.reteoo.EntryPointNode) KieBase(org.kie.api.KieBase) KieSession(org.kie.api.runtime.KieSession) InternalKnowledgeBase(org.drools.core.impl.InternalKnowledgeBase) LeftInputAdapterNode(org.drools.core.reteoo.LeftInputAdapterNode) Test(org.junit.Test)

Aggregations

LeftTupleSink (org.drools.core.reteoo.LeftTupleSink)15 ObjectTypeNode (org.drools.core.reteoo.ObjectTypeNode)11 LeftInputAdapterNode (org.drools.core.reteoo.LeftInputAdapterNode)9 Test (org.junit.Test)8 KieBase (org.kie.api.KieBase)7 AccumulateMemory (org.drools.core.reteoo.AccumulateNode.AccumulateMemory)6 BetaMemory (org.drools.core.reteoo.BetaMemory)6 FromMemory (org.drools.core.reteoo.FromNode.FromMemory)6 KieSession (org.kie.api.runtime.KieSession)6 KieHelper (org.kie.internal.utils.KieHelper)5 ArrayList (java.util.ArrayList)4 ClassObjectType (org.drools.core.base.ClassObjectType)4 InternalWorkingMemory (org.drools.core.common.InternalWorkingMemory)4 Memory (org.drools.core.common.Memory)4 InternalKnowledgeBase (org.drools.core.impl.InternalKnowledgeBase)4 BetaNode (org.drools.core.reteoo.BetaNode)4 LeftTuple (org.drools.core.reteoo.LeftTuple)4 PathMemory (org.drools.core.reteoo.PathMemory)4 RightInputAdapterNode (org.drools.core.reteoo.RightInputAdapterNode)4 TupleMemory (org.drools.core.reteoo.TupleMemory)4