Search in sources :

Example 66 with TupleMemory

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

the class NotTest method getBlockerFactHandle.

private InternalFactHandle getBlockerFactHandle(KieSession ksession) {
    ObjectTypeNode otn = getObjectTypeNode(ksession.getKieBase(), Person.class);
    BetaNode notNode = (BetaNode) ((AlphaNode) otn.getSinks()[0]).getSinks()[0];
    StatefulKnowledgeSessionImpl ksessionImpl = (StatefulKnowledgeSessionImpl) ksession;
    NodeMemories nodeMemories = ksessionImpl.getNodeMemories();
    BetaMemory betaMemory = (BetaMemory) nodeMemories.getNodeMemory(notNode, ksessionImpl);
    TupleMemory rightTupleMemory = betaMemory.getRightTupleMemory();
    Tuple[] tuples = (Tuple[]) rightTupleMemory.toArray();
    for (int i = 0; i < tuples.length; i++) {
        RightTupleImpl tuple = (RightTupleImpl) tuples[i];
        if (tuple.getBlocked() != null) {
            return tuple.getFactHandle();
        }
    }
    fail("Cannot find blocker in BetaMemory");
    return null;
}
Also used : BetaNode(org.drools.core.reteoo.BetaNode) StatefulKnowledgeSessionImpl(org.drools.kiesession.session.StatefulKnowledgeSessionImpl) ObjectTypeNode(org.drools.core.reteoo.ObjectTypeNode) NodeMemories(org.drools.core.common.NodeMemories) BetaMemory(org.drools.core.reteoo.BetaMemory) RightTupleImpl(org.drools.core.reteoo.RightTupleImpl) AlphaNode(org.drools.core.reteoo.AlphaNode) TupleMemory(org.drools.core.reteoo.TupleMemory) Tuple(org.drools.core.spi.Tuple)

Aggregations

TupleMemory (org.drools.core.reteoo.TupleMemory)66 LeftTuple (org.drools.core.reteoo.LeftTuple)59 RightTuple (org.drools.core.reteoo.RightTuple)52 FastIterator (org.drools.core.util.FastIterator)40 BetaConstraints (org.drools.core.common.BetaConstraints)36 ContextEntry (org.drools.core.rule.ContextEntry)36 PhreakJoinNode.updateChildLeftTuple (org.drools.core.phreak.PhreakJoinNode.updateChildLeftTuple)23 BetaMemory (org.drools.core.reteoo.BetaMemory)23 Accumulate (org.drools.core.rule.Accumulate)12 Tuple (org.drools.core.spi.Tuple)9 AccumulateContext (org.drools.core.reteoo.AccumulateNode.AccumulateContext)8 ArrayList (java.util.ArrayList)6 BetaNode (org.drools.core.reteoo.BetaNode)6 InternalFactHandle (org.drools.core.common.InternalFactHandle)5 InternalWorkingMemory (org.drools.core.common.InternalWorkingMemory)5 BaseAccumulation (org.drools.core.reteoo.AccumulateNode.BaseAccumulation)5 ObjectTypeNode (org.drools.core.reteoo.ObjectTypeNode)5 PhreakPropagationContext (org.drools.core.common.PhreakPropagationContext)4 AccumulateContextEntry (org.drools.core.reteoo.AccumulateNode.AccumulateContextEntry)4 LeftInputAdapterNode (org.drools.core.reteoo.LeftInputAdapterNode)4