private LeftTupleSets doRiaNode(InternalWorkingMemory wm,
LeftTupleSets srcTuples,
BetaNode betaNode,
BetaMemory bm) {
SegmentMemory subSmem = bm.getSubnetworkSegmentMemory();
if ( betaNode.getLeftTupleSource().getSinkPropagator().size() == 2 ) {
// sub network is not part of share split, so need to handle propagation
// this ensures the first LeftTuple is actually the subnetwork node
// and the main outer network now receives the peer, notice the swap at the end "srcTuples == peerTuples"
LeftTupleSets peerTuples = new LeftTupleSets();
SegmentPropagator.processPeers( srcTuples, peerTuples, betaNode );
// Make sure subnetwork Segment has tuples to process
LeftTupleSets subnetworkStaged = subSmem.getStagedLeftTuples();
subnetworkStaged.addAll( srcTuples );
srcTuples.resetAll();
srcTuples = peerTuples;
}
RightInputAdapterNode riaNode = ( RightInputAdapterNode ) betaNode.getRightInput();
RiaNodeMemory riaNodeMemory = ( RiaNodeMemory ) wm.getNodeMemory( (MemoryFactory) betaNode.getRightInput() );
LeftTupleSets riaStagedTuples = eval( ( LeftTupleSink ) subSmem.getRootNode(), subSmem.getNodeMemories().getFirst(), riaNodeMemory.getRiaRuleMemory().getSegmentMemories(), subSmem.getPos(), subSmem.getStagedLeftTuples(), null, wm );
for ( LeftTuple leftTuple = riaStagedTuples.getInsertFirst(); leftTuple != null; ) {
LeftTuple next = leftTuple.getStagedNext();
InternalFactHandle handle = riaNode.createFactHandle( leftTuple, leftTuple.getPropagationContext(), wm );