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;
}
Aggregations