Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |

file stats: | LOC: | 40 |  | Methods: | 2
| NCLOC: | 20 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL
ExcessiveLengthRule.java | 100% | 100% | 100% | 100% |

1 |  | /**
2 |  | * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3 |  | */
4 |  | package net.sourceforge.pmd.rules.design;
5 |  |
6 |  | import net.sourceforge.pmd.ast.SimpleJavaNode;
7 |  | import net.sourceforge.pmd.stat.DataPoint;
8 |  | import net.sourceforge.pmd.stat.StatisticalRule;
9 |  |
10 |  | /**
11 |  | * This is a common super class for things which
12 |  | * have excessive length.
13 |  | * <p/>
14 |  | * i.e. LongMethod and LongClass rules.
15 |  | * <p/>
16 |  | * To implement an ExcessiveLength rule, you pass
17 |  | * in the Class of node you want to check, and this
18 |  | * does the rest for you.
19 |  | */
20 |  | public class ExcessiveLengthRule extends StatisticalRule {
21 |  | private Class nodeClass;
22 |  |
23 | 27 | public ExcessiveLengthRule(Class nodeClass) {
24 | 27 | this.nodeClass = nodeClass;
25 |  | }
26 |  |
27 | 644 | public Object visit(SimpleJavaNode node, Object data) {
28 | 644 | if (nodeClass.isInstance(node)) {
29 | 8 | DataPoint point = new DataPoint();
30 | 8 | point.setNode(node);
31 | 8 | point.setScore(1.0 * (node.getEndLine() - node.getBeginLine()));
32 | 8 | point.setMessage(getMessage());
33 | 8 | addDataPoint(point);
34 |  | }
35 |  |
36 | 644 | return node.childrenAccept(this, data);
37 |  | }
38 |  | }
39 |  |
40 |  |