Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 52 |  | Methods: | 3
| NCLOC: | 37 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
CSVRenderer.java | 0% | 0% | 0% | 0% |

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 |  |
11 |  | public class CSVRenderer implements Renderer {
12 |  |
13 |  | private char separator;
14 |  |
15 |  | public static final char defaultSeparator = ',';
16 |  |
17 | 0 | public CSVRenderer() {
18 | 0 | this(defaultSeparator);
19 |  | }
20 |  |
21 | 0 | public CSVRenderer(char separatorChar) {
22 | 0 | separator = separatorChar;
23 |  | }
24 |  |
25 | 0 | public String render(Iterator matches) {
26 | 0 | StringBuffer rpt = new StringBuffer(1000);
27 | 0 | rpt.append("lines").append(separator);
28 | 0 | rpt.append("tokens").append(separator);
29 | 0 | rpt.append("occurrences");
30 | 0 | rpt.append(PMD.EOL);
31 |  |
32 | 0 | Match match;
33 | 0 | TokenEntry mark;
34 |  |
35 | 0 | while (matches.hasNext()) {
36 | 0 | match = (Match) matches.next();
37 | 0 | rpt.append(match.getLineCount()).append(separator);
38 | 0 | rpt.append(match.getTokenCount()).append(separator);
39 | 0 | rpt.append(match.getMarkCount()).append(separator);
40 | 0 | for (Iterator marks = match.iterator(); marks.hasNext();) {
41 | 0 | mark = (TokenEntry) marks.next();
42 | 0 | rpt.append(mark.getBeginLine()).append(separator);
43 | 0 | rpt.append(mark.getTokenSrcID());
44 | 0 | if (marks.hasNext()) {
45 | 0 | rpt.append(separator);
46 |  | }
47 |  | }
48 | 0 | rpt.append(PMD.EOL);
49 |  | }
50 | 0 | return rpt.toString();
51 |  | }
52 |  | }