Iterator sources = traceNode.getSourceSet().iterator();
Iterator<Edge> sources = traceNode.getSourceSet().iterator();
    private static void joinInputTrace(InputTraceNode traceNode, boolean init,                                       boolean primepump) {        FilterTraceNode filter = (FilterTraceNode) traceNode.getNext();        // do not generate the switch code if it is not necessary        if (OffChipBuffer.unnecessary(traceNode))            return;        FilterInfo filterInfo = FilterInfo.getFilterInfo(filter);        // calculate the number of items received        int items = filterInfo.totalItemsReceived(init, primepump), iterations, stage = 1, typeSize;        // noting to do for this stage        if (items == 0)            return;        // the stage we are generating code for as used below for        // generateSwitchCode()        if (!init && !primepump)            stage = 2;        typeSize = Util.getTypeSize(filter.getFilter().getInputType());        // the numbers of times we should cycle thru this "joiner"        assert items % traceNode.totalWeights() == 0 : "weights on input trace node does not divide evenly with items received";        iterations = items / traceNode.totalWeights();        StreamingDram[] dest = { IntraTraceBuffer.getBuffer(traceNode, filter)                                 .getDRAM() };                        // generate comments to make the code easier to read when debugging        dest[0].getNeighboringTile().getSwitchCode().appendComment(init || primepump,                                                                   "Start join: This is the dest (" + filter.toString() + ")");        Iterator sources = traceNode.getSourceSet().iterator();        while (sources.hasNext()) {            StreamingDram dram = InterTraceBuffer.getBuffer(                                                            (Edge) sources.next()).getNonRedundant().getDRAM();            dram.getNeighboringTile().getSwitchCode().appendComment(                                                                    init || primepump,                                                                    "Start join: This a source (" + dram.toString() + ")");        }        //generate the switch code...        if (SWITCH_COMP && iterations > SC_THRESHOLD) {            // create a loop to compress the switch code            // find all the tiles used in this join            HashSet tiles = new HashSet();            for (int j = 0; j < traceNode.getWeights().length; j++) {                // get the source buffer, pass thru redundant buffer(s)                StreamingDram source = InterTraceBuffer.getBuffer(                                                                  traceNode.getSources()[j]).getNonRedundant().getDRAM();                tiles.addAll(SwitchCodeStore.getTilesInRoutes(source, dest));            }            // generate the loop header on all tiles involved            HashMap labels = SwitchCodeStore.switchLoopHeader(tiles,                                                              iterations, init, primepump);            // generate the switch instructions            for (int j = 0; j < traceNode.getWeights().length; j++) {                // get the source buffer, pass thru redundant buffer(s)                StreamingDram source = InterTraceBuffer.getBuffer(                                                                  traceNode.getSources()[j]).getNonRedundant().getDRAM();                for (int k = 0; k < traceNode.getWeights()[j]; k++) {                    for (int q = 0; q < typeSize; q++)                        SwitchCodeStore.generateSwitchCode(source, dest, stage);                }            }            // generate the loop trailer            SwitchCodeStore.switchLoopTrailer(labels, init, primepump);        } else {            for (int i = 0; i < iterations; i++) {                for (int j = 0; j < traceNode.getWeights().length; j++) {                    // get the source buffer, pass thru redundant buffer(s)                    StreamingDram source = InterTraceBuffer.getBuffer(                                                                      traceNode.getSources()[j]).getNonRedundant()                        .getDRAM();                    for (int k = 0; k < traceNode.getWeights()[j]; k++) {                        for (int q = 0; q < typeSize; q++)                            SwitchCodeStore.generateSwitchCode(source, dest,                                                               stage);                    }                }            }        }        // because transfers must be cache line size divisible...        // generate dummy values to fill the cache line!        if ((items * typeSize) % RawChip.cacheLineWords != 0            && !(traceNode.isFileOutput() && OffChipBuffer                 .unnecessary(traceNode))) {            int dummy = RawChip.cacheLineWords                - ((items * typeSize) % RawChip.cacheLineWords);            SwitchCodeStore.dummyOutgoing(dest[0], dummy, init || primepump);        }        // disregard remainder of inputs coming from temp offchip buffers        for (int i = 0; i < traceNode.getSources().length; i++) {            Edge edge = traceNode.getSources()[i];            int remainder = ((iterations * typeSize * traceNode.getWeight(edge)) % RawChip.cacheLineWords);            if (remainder > 0                && !(edge.getSrc().isFileInput() && OffChipBuffer                     .unnecessary(edge.getSrc())))                SwitchCodeStore.disregardIncoming(InterTraceBuffer.getBuffer(                                                                             edge).getDRAM(), RawChip.cacheLineWords - remainder,                                                  init || primepump);        }        // generate comments to make the code easier to read when debugging        dest[0].getNeighboringTile().getSwitchCode().appendComment(                                                                   init || primepump,                                                                   "End join: This is the dest (" + filter.toString() + ")");       //generate some comments        sources = traceNode.getSourceSet().iterator();        while (sources.hasNext()) {            StreamingDram dram = InterTraceBuffer.getBuffer(                                                            (Edge) sources.next()).getNonRedundant().getDRAM();            dram.getNeighboringTile().getSwitchCode().appendComment(                                                                    init || primepump,                                                                    "End join: This a source (" + dram.toString() + ")");        }    }