1 |
| |
2 |
| |
3 |
| |
4 |
| package net.sourceforge.pmd.stat; |
5 |
| |
6 |
| import net.sourceforge.pmd.ast.SimpleNode; |
7 |
| |
8 |
| import java.util.Random; |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
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 |
| |
23 |
| |
24 |
23719
| public DataPoint() {
|
25 |
23719
| super();
|
26 |
| |
27 |
| |
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 |
| } |