public int evaluateNetwork(InternalWorkingMemory wm) {
SegmentMemory[] smems = rmem.getSegmentMemories();
int smemIndex = 0;
SegmentMemory smem = smems[smemIndex]; // 0
LeftInputAdapterNode liaNode = (LeftInputAdapterNode) smem.getRootNode();
LinkedList<Memory> nodeMemories = smem.getNodeMemories();
LiaNodeMemory liaNodeMemory = (LiaNodeMemory) nodeMemories.getFirst();
StagedLeftTuples trgTuples = new StagedLeftTuples();
StagedLeftTuples srcTuples = smem.getStagedLeftTuples();
pLiaNode.doNode( liaNode, liaNodeMemory, wm, srcTuples, trgTuples );
LeftTupleSource node = null;
Memory nodeMem = null;
if ( liaNode == smem.getTipNode() ) {
// Segment only contains LiaNode, so need to propagate peers
SegmentPropagator.propagate( smem, trgTuples, wm );
smem = smems[smemIndex]; // 1
nodeMem = smem.getNodeMemories().getFirst();
node = smem.getRootNode();
} else {
node = (LeftTupleSource) liaNode.getSinkPropagator().getFirstLeftTupleSink(); // we know it can only have one child
nodeMem = liaNodeMemory.getNext();
}
eval( node, nodeMem, smems, smemIndex, trgTuples, null, wm);