1
2
3
4 package net.sourceforge.pmd.stat;
5
6 import java.util.Random;
7
8 import net.sourceforge.pmd.lang.ast.Node;
9 import net.sourceforge.pmd.lang.java.rule.codesize.AbstractNcssCountRule;
10
11
12
13
14
15
16
17 public class DataPoint implements Comparable<DataPoint> {
18
19 private Node node;
20 private int random;
21 private double score;
22 private String message;
23
24
25
26
27 public DataPoint() {
28 super();
29
30
31 Random rand = new Random();
32 random = rand.nextInt(11061973);
33 }
34
35
36
37
38
39
40
41 public int compareTo(DataPoint rhs) {
42 if (score != rhs.getScore()) {
43 return Double.compare(score, rhs.getScore());
44 }
45 return random - rhs.random;
46 }
47
48 public Node getNode() {
49 return node;
50 }
51
52 public void setNode(Node node) {
53 this.node = node;
54 }
55
56 public String getMessage() {
57 return message;
58 }
59
60 public void setMessage(String message) {
61 this.message = message;
62 }
63
64 public double getScore() {
65 return score;
66 }
67
68 public void setScore(double score) {
69 this.score = score;
70 }
71 }