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      	
14          StringBuilder buffer = new StringBuilder(300);
15          
16          for (Match match; matches.hasNext();) {
17              match = matches.next();
18              TokenEntry mark;
19              for (Iterator<TokenEntry> iterator = match.iterator(); iterator.hasNext();) {
20                  mark = iterator.next();
21                  buffer.append(mark.getTokenSrcID());
22                  buffer.append('(').append(mark.getBeginLine()).append("):");
23                  buffer.append(" Between lines " + mark.getBeginLine() + " and " + (mark.getBeginLine()+match.getLineCount()) + PMD.EOL);
24              }
25          }
26          return buffer.toString();
27      }
28  }