Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |
file stats: | LOC: | 42 |  | Methods: | 6
| NCLOC: | 29 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
Tokens.java | 50% | 77.8% | 83.3% | 76.5% |

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 java.util.ArrayList;
7 |  | import java.util.Iterator;
8 |  | import java.util.List;
9 |  |
10 |  | public class Tokens {
11 |  |
12 |  | private List tokens = new ArrayList();
13 |  |
14 | 243 | public void add(TokenEntry tokenEntry) {
15 | 243 | this.tokens.add(tokenEntry);
16 |  | }
17 |  |
18 | 0 | public Iterator iterator() {
19 | 0 | return tokens.iterator();
20 |  | }
21 |  |
22 | 5 | private TokenEntry get(int index) {
23 | 5 | return (TokenEntry) tokens.get(index);
24 |  | }
25 |  |
26 | 9 | public int size() {
27 | 9 | return tokens.size();
28 |  | }
29 |  |
30 | 5 | public int getLineCount(TokenEntry mark, Match match) {
31 | 5 | TokenEntry endTok = get(mark.getIndex() + match.getTokenCount() - 1);
32 | 5 | if (endTok == TokenEntry.EOF) {
33 | 0 | endTok = get(mark.getIndex() + match.getTokenCount() - 2);
34 |  | }
35 | 5 | return endTok.getBeginLine() - mark.getBeginLine() + 1;
36 |  | }
37 |  |
38 | 2 | public List getTokens() {
39 | 2 | return tokens;
40 |  | }
41 |  |
42 |  | }