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

file stats: | LOC: | 72 |  | Methods: | 8
| NCLOC: | 43 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL

DataPoint.java

50%

82.4%

100%

85.2%

1 |  | /**
2 |  | * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3 |  | */
4 |  | package net.sourceforge.pmd.stat;
5 |  |
6 |  | import net.sourceforge.pmd.ast.SimpleNode;
7 |  |
8 |  | import java.util.Random;
9 |  |
10 |  | /**
11 |  | * @author David Dixon-Peugh
12 |  | * Aug 8, 2002 DataPoint.java
13 |  | */
14 |  | public class DataPoint implements java.lang.Comparable {
15 |  |
16 |  | private SimpleNode node;
17 |  | private int random;
18 |  | private double score;
19 |  | private String message;
20 |  |
21 |  | /**
22 |  | * Constructor for DataPoint.
23 |  | */
24 | 23719 | public DataPoint() {
25 | 23719 | super();
26 |  | // Random number is so that the TreeSet doesn't
27 |  | // whack things with the same score.
28 | 23719 | Random rand = new Random();
29 | 23719 | random = rand.nextInt(11061973);
30 |  | }
31 |  |
32 | 167097 | public int compareTo(Object object) {
33 |  |
34 | 167097 | DataPoint rhs = (DataPoint) object;
35 |  |
36 | 167097 | Double lhsScore = new Double(score);
37 | 167097 | Double rhsScore = new Double(rhs.getScore());
38 |  |
39 | 167097 | if (lhsScore.doubleValue() != rhsScore.doubleValue()) {
40 | 167097 | return lhsScore.compareTo(rhsScore);
41 |  | }
42 |  |
43 | 0 | Integer lhsRand = new Integer(random);
44 | 0 | Integer rhsRand = new Integer(rhs.random);
45 |  |
46 | 0 | return lhsRand.compareTo(rhsRand);
47 |  | }
48 |  |
49 | 2146 | public SimpleNode getNode() {
50 | 2146 | return node;
51 |  | }
52 |  |
53 | 23719 | public void setNode(SimpleNode node) {
54 | 23719 | this.node = node;
55 |  | }
56 |  |
57 | 2146 | public String getMessage() {
58 | 2146 | return message;
59 |  | }
60 |  |
61 | 23719 | public void setMessage(String message) {
62 | 23719 | this.message = message;
63 |  | }
64 |  |
65 | 259889 | public double getScore() {
66 | 259889 | return score;
67 |  | }
68 |  |
69 | 23719 | public void setScore(double score) {
70 | 23719 | this.score = score;
71 |  | }
72 |  | }