1 package org.kit.furia;
2
3 import java.text.DecimalFormat;
4 import java.text.NumberFormat;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 public class ResultCandidate implements Comparable<ResultCandidate>{
34
35 private static NumberFormat f = new DecimalFormat("0.000");
36
37
38
39
40
41 private String documentName;
42
43
44
45
46 private float score;
47
48
49
50
51
52 private int mSetFragmentsCount;
53
54
55
56
57 private int mSetFoundFragments;
58
59
60
61
62 private int setFragmentsCount;
63
64
65
66
67 private int setFoundFragments;
68
69 public String getDocumentName() {
70 return documentName;
71 }
72
73 public float getScore(){
74 return score;
75 }
76
77
78
79
80
81 public float getNaiveScoreMSet(){
82 return ((float)mSetFoundFragments ) / ((float) mSetFragmentsCount);
83 }
84
85
86
87
88
89 public float getNaiveScoreSet(){
90 return ((float)setFoundFragments ) / ((float) setFragmentsCount);
91 }
92
93 public ResultCandidate(String documentName, float score, int mSetFoundFragments, int mSetFragmentsCount, int setFoundFragments, int setFragmentsCount) {
94 super();
95 this.documentName = documentName;
96 this.score = score;
97 this.mSetFoundFragments = mSetFoundFragments;
98 this.mSetFragmentsCount = mSetFragmentsCount;
99 this.setFoundFragments = setFoundFragments;
100 this.setFragmentsCount = setFragmentsCount;
101 }
102
103 public int getMSetFragmentsCount() {
104 return mSetFragmentsCount;
105 }
106
107 public int getMSetFoundFragments() {
108 return mSetFoundFragments;
109 }
110
111 public int getSetFoundFragments() {
112 return setFoundFragments;
113 }
114
115 public int getSetFragmentsCount() {
116 return setFragmentsCount;
117 }
118
119
120 public int compareTo(ResultCandidate w) {
121 int res = 0;
122 if (score < w.score) {
123 res = -1;
124 } else if (score > w.score) {
125 res = 1;
126 }
127 return res * -1;
128 }
129
130 public String toString(){
131 return documentName
132 + " " + f.format(getScore())
133 + " " + f.format(getNaiveScoreMSet())
134
135
136 + " " + f.format(getNaiveScoreSet())
137
138 + " " + getMSetFragmentsCount()
139 + " " + getSetFragmentsCount();
140 }
141
142 }