1 /***
2 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3 */
4 package net.sourceforge.pmd.cpd;
5
6 import net.sourceforge.pmd.PMD;
7
8 import java.util.Iterator;
9
10 public class CSVRenderer implements Renderer {
11
12 public String render(Iterator matches) {
13 StringBuffer rpt = new StringBuffer();
14 rpt.append("lines,tokens,occurances" + PMD.EOL);
15 while (matches.hasNext()) {
16 Match match = (Match) matches.next();
17 rpt.append(match.getLineCount() + "," + match.getTokenCount() + "," + match.getMarkCount() + ",");
18 for (Iterator marks = match.iterator(); marks.hasNext();) {
19 TokenEntry mark = (TokenEntry) marks.next();
20 rpt.append(mark.getBeginLine() + "," + mark.getTokenSrcID());
21 if (marks.hasNext()) {
22 rpt.append(",");
23 }
24 }
25 rpt.append(PMD.EOL);
26 }
27 return rpt.toString();
28 }
29 }
This page was automatically generated by Maven