1 package net.sourceforge.pmd.cpd;
2
3 import java.util.ArrayList;
4 import java.util.Iterator;
5 import java.util.List;
6
7 public class Tokens {
8
9 private List tokens = new ArrayList();
10
11 public void add(TokenEntry tokenEntry) {
12 this.tokens.add(tokenEntry);
13 }
14
15 public Iterator iterator() {
16 return tokens.iterator();
17 }
18
19 private TokenEntry get(int index) {
20 return (TokenEntry)tokens.get(index);
21 }
22
23 public int size() {
24 return tokens.size();
25 }
26
27 public int getLineCount(Mark mark, Match match) {
28 TokenEntry endTok = get(mark.getIndexIntoTokenArray() + match.getTokenCount());
29 if (endTok.equals(TokenEntry.EOF)) {
30 endTok = get(mark.getIndexIntoTokenArray() + match.getTokenCount() - 1);
31 }
32 return endTok.getBeginLine() - mark.getBeginLine() - 1;
33 }
34 }
This page was automatically generated by Maven