private static LeftTuple insertPeerLeftTuple(LeftTuple lt, LeftTupleSinkNode node, InternalWorkingMemory wm) {
        LeftInputAdapterNode.LiaNodeMemory liaMem = null;
        if ( node.getLeftTupleSource().getType() == NodeTypeEnums.LeftInputAdapterNode ) {
            liaMem = wm.getNodeMemory(((LeftInputAdapterNode) node.getLeftTupleSource()));
        }

        LeftTuple peer = node.createPeer(lt);
        Memory memory = wm.getNodeMemories().peekNodeMemory(node);
        if (memory == null || memory.getSegmentMemory() == null) {
            throw new IllegalStateException("Defensive Programming: this should not be possilbe, as the addRule code should init child segments if they are needed ");
        }

        if ( liaMem == null) {
            memory.getSegmentMemory().getStagedLeftTuples().addInsert(peer);
        } else {
            // If parent is Lian, then this must be called, so that any linking or unlinking can be done.
            LeftInputAdapterNode.doInsertSegmentMemory(wm, true, liaMem, memory.getSegmentMemory(), peer, node.getLeftTupleSource().isStreamMode());
        }

        return peer;
    }
private static LeftTuple insertPeerLeftTuple ( LeftTuple lt , LeftTupleSinkNode node , InternalWorkingMemory wm ) { LeftInputAdapterNode . LiaNodeMemory liaMem = null ; if ( node . getLeftTupleSource ( ) . getType ( ) == NodeTypeEnums . LeftInputAdapterNode ) { liaMem = wm . getNodeMemory ( ( ( LeftInputAdapterNode ) node . getLeftTupleSource ( ) ) ) ; } LeftTuple peer = node . createPeer ( lt ) ; Memory memory = wm . getNodeMemories ( ) . peekNodeMemory ( node ) ; if ( memory == null || memory . getSegmentMemory ( ) == null ) { throw new IllegalStateException ( "Defensive Programming: this should not be possilbe, as the addRule code should init child segments if they are needed " ) ; } if ( liaMem == null ) { memory . getSegmentMemory ( ) . getStagedLeftTuples ( ) . addInsert ( peer ) ; } else { LeftInputAdapterNode . doInsertSegmentMemory ( wm , true , liaMem , memory . getSegmentMemory ( ) , peer , node . getLeftTupleSource ( ) . isStreamMode ( ) ) ; } return peer ; }
Create all missing peers