Merge branch 'master' of https://github.uci.edu/rtrimana/smart_home_traffic
[pingpong.git] / Code / Projects / SmartPlugDetector / src / main / java / edu / uci / iotproject / comparison / AbstractPatternComparisonResult.java
1 package edu.uci.iotproject.comparison;
2
3 import edu.uci.iotproject.Conversation;
4 import edu.uci.iotproject.FlowPattern;
5
6 /**
7  * Models the result of comparing a {@link Conversation} and a {@link FlowPattern}.
8  *
9  * @param <T> The type of the result; can be something as simple as a {@code Boolean} for a complete match comparison or
10  *           or a complex data type for more sophisticated comparisons.
11  */
12 public abstract class AbstractPatternComparisonResult<T> {
13
14     /**
15      * The result of the comparison.
16      */
17     private final T mResult;
18
19     /**
20      * The {@code Conversation} that was compared against {@link #mFlowPattern}.
21      */
22     protected final Conversation mConversation;
23
24     /**
25      * The {@code FlowPattern} that {@link #mConversation} was compared against.
26      */
27     protected final FlowPattern mFlowPattern;
28
29     public AbstractPatternComparisonResult(Conversation conversation, FlowPattern flowPattern, T result) {
30         this.mResult = result;
31         this.mConversation = conversation;
32         this.mFlowPattern = flowPattern;
33     }
34
35     /**
36      * Gets the result of the comparison.
37      * @return the result of the comparison
38      */
39     public T getResult() {
40         return mResult;
41     }
42
43     /**
44      * Get a textual description of the comparison result suitable for output on std.out.
45      * @returna a textual description of the comparison result suitable for output on std.out.
46      */
47     abstract public String getTextualDescription();
48
49 }