|
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 |
23738
| public DataPoint() {
|
|
25 |
23738
| super();
|
|
26 |
| |
|
27 |
| |
|
28 |
23738
| Random rand = new Random();
|
|
29 |
23738
| random = rand.nextInt(11061973);
|
|
30 |
| } |
|
31 |
| |
|
32 |
170146
| public int compareTo(Object object) {
|
|
33 |
| |
|
34 |
170146
| DataPoint rhs = (DataPoint) object;
|
|
35 |
| |
|
36 |
170146
| Double lhsScore = new Double(score);
|
|
37 |
170146
| Double rhsScore = new Double(rhs.getScore());
|
|
38 |
| |
|
39 |
170146
| if (lhsScore.doubleValue() != rhsScore.doubleValue()) {
|
|
40 |
170146
| 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 |
2240
| public SimpleNode getNode() {
|
|
50 |
2240
| return node;
|
|
51 |
| } |
|
52 |
| |
|
53 |
23738
| public void setNode(SimpleNode node) {
|
|
54 |
23738
| this.node = node;
|
|
55 |
| } |
|
56 |
| |
|
57 |
2233
| public String getMessage() {
|
|
58 |
2233
| return message;
|
|
59 |
| } |
|
60 |
| |
|
61 |
23738
| public void setMessage(String message) {
|
|
62 |
23738
| this.message = message;
|
|
63 |
| } |
|
64 |
| |
|
65 |
236516
| public double getScore() {
|
|
66 |
236516
| return score;
|
|
67 |
| } |
|
68 |
| |
|
69 |
23738
| public void setScore(double score) {
|
|
70 |
23738
| this.score = score;
|
|
71 |
| } |
|
72 |
| } |