25a98ac48d2e83db533081bb285b71ecdc32e6d2
[IRC.git] / Robust / src / Benchmarks / Distributed / SpamFilter / FilterResult.java
1 /**
2  * A FilterResult encapsulates the result of a filter made by checking a mail.
3  **/
4 public class FilterResult {
5         /**
6          * This value is used if type is ERROR or UNKNOWN.
7          */
8         public double NO_RESULT;
9
10         /**
11          * A result value greater or equal this value indicates that the filter has
12          * decided on spam.
13          */
14         public double SPAM_THRESHOLD;
15         public double ABSOLUTE_SPAM;
16         public double ABSOLUTE_HAM;
17
18     //TODO decide a good way of deciding
19         public double result; // the result, a value between 0 (ham) and 1 (spam), negative values for "error", "unknown" etc.
20
21         //public HashMap<String,String> properties = new HashMap<String,String>(); // additional properties of the filter (mainly for statistics)
22
23         // -----------------------------------------------------------------------------
24
25         public FilterResult(double result) {
26       SPAM_THRESHOLD=0.5;
27       ABSOLUTE_SPAM=1.0;
28       ABSOLUTE_HAM=0.0;
29       NO_RESULT=-1;
30       this.result = result;
31     }
32
33         public double getResult() {
34                 return result;
35         }
36
37         public boolean isSpam() {
38                 return result >= SPAM_THRESHOLD;
39         }
40
41     /*
42         public void addProperty(String key, String value) {
43                 properties.put(key,value);
44         }
45
46         public String getProperty(String key) {
47                 return properties.get(key);
48         }
49
50         public HashMap<String,String> getProperties() {
51                 return properties;
52         }
53     */
54 }