View Javadoc

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 VSRenderer implements Renderer {
11  
12      public String render(Iterator<Match> matches) {
13          StringBuffer buffer = new StringBuffer(300);
14          for (Match match; matches.hasNext();) {
15              match = matches.next();
16              TokenEntry mark;
17              for (Iterator<TokenEntry> iterator = match.iterator(); iterator.hasNext();) {
18                  mark = iterator.next();
19                  buffer.append(mark.getTokenSrcID());
20                  buffer.append("(" + mark.getBeginLine() +"):");
21                  buffer.append(" Between lines " + mark.getBeginLine() + " and " + (mark.getBeginLine()+match.getLineCount()) + PMD.EOL);
22              }
23          }
24          return buffer.toString();
25      }
26  }