}
trgTuples = new StagedLeftTuples();
if ( NodeTypeEnums.isBetaNode( node ) ) {
BetaNode betaNode = ( BetaNode )node;
BetaMemory bm = (BetaMemory) nodeMem;
if ( betaNode.isRightInputIsRiaNode() ) {
StagedLeftTuples peerTuples = new StagedLeftTuples();
SegmentPropagator.processPeers( srcTuples, peerTuples, betaNode );
// Make sure subnetwork Segment has tuples to process
SegmentMemory subSmem = bm.getSubnetworkSegmentMemory();
StagedLeftTuples subnetworkStaged = subSmem.getStagedLeftTuples();
subnetworkStaged.addAllDeletes( srcTuples.getDeleteFirst() );
subnetworkStaged.addAllUpdates( srcTuples.getUpdateFirst() );
subnetworkStaged.addAllInserts( srcTuples.getInsertFirst() );
List<RuleMemory> ruleMemories = subSmem.getRuleMemories();
RiaRuleMemory rm = null;
if ( ruleMemories.size() == 1 ) {
rm = ( RiaRuleMemory) ruleMemories.get( 0 ) ;
} else {
for ( int i = 0, size = ruleMemories.size(); i < size; i++ ) {
if ( ruleMemories.get( i ) instanceof RiaRuleMemory ) {
rm = ( RiaRuleMemory) ruleMemories.get( i ) ;
}
}
}
RightInputAdapterNode riaNode = ( RightInputAdapterNode ) betaNode.getRightInput();
// At this point we have the tuples to apply to the left and to the right of the subnetwork root node
StagedLeftTuples riaStagedTuples = eval( subSmem.getRootNode(), subSmem.getNodeMemories().getFirst(), rm.getSegmentMemories(), 0, srcTuples, null, wm );
StagedRightTuples riaStageRight = bm.getStagedRightTuples();
for ( LeftTuple leftTuple = riaStagedTuples.getInsertFirst(); leftTuple != null; leftTuple = leftTuple.getStagedNext() ) {
InternalFactHandle handle = riaNode.createFactHandle( leftTuple, leftTuple.getPropagationContext(), wm );
RightTuple rightTuple = betaNode.createRightTuple( handle, betaNode, leftTuple.getPropagationContext() );
//riaStagedTuples.
}
}