4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
SuggestionLogEntry.java
Go to the documentation of this file.
1 /*
2  * Project: Server for annotations sharing
3  * Author: Ing. Jaroslav Dytrych idytrych@fit.vutbr.cz
4  * File: SuggestionLogEntry.java
5  * Description: Class representing suggested annotation with informations about
6  * suggestion
7  */
8 
9 /**
10  * @file SuggestionLogEntry.java
11  *
12  * @brief Suggested annotation with informations about suggestion
13  */
14 
15 package cz.vutbr.fit.knot.annotations.comet;
16 
18 
19 /**
20  * Class representing suggested annotation with informations about suggestion
21  *
22  * @brief Suggested annotation with informations about suggestion
23  * @author idytrych
24  */
25 public class SuggestionLogEntry {
26  /** Temporary id of suggested annotation */
27  String tmpId;
28  /** Suggested annotation */
30  /** Confirmed version of suggested annotation */
32  /** Number of refuse method (how annotation was refused) */
33  Integer refuseMethod;
34  /** Number of confirmation method (how annotation was confirmed) */
35  Integer confirmMethod;
36  /** Percentage of confidence with annotation */
37  Integer confidence;
38 
39  /**
40  * Constructor of reference objects for searching purposes - no initialization
41  * needed
42  *
43  * @param tmpId Temporary id of suggested annotation
44  */
45  public SuggestionLogEntry(String tmpId) {
46  this.tmpId = tmpId;
47  }
48 
49  /**
50  * Constructor which creates suggestion with annotation reference
51  *
52  * @param suggestion Suggested annotation
53  * @param confidence Percentage of confidence with annotation
54  */
56  this.suggestion = suggestion;
57  this.confidence = confidence;
58  }
59 
60  /**
61  * Constructor
62  *
63  * @param tmpId Temporary id of suggested annotation
64  * @param suggestion Suggested annotation
65  * @param confidence Percentage of confidence with annotation
66  */
68  this.tmpId = tmpId;
69  this.suggestion = suggestion;
70  this.confidence = confidence;
71  }
72 
73  /**
74  * Gets temporary id of annotation
75  *
76  * @return Returns temporary id of annotation
77  */
78  public String getTmpId() {
79  return tmpId;
80  }
81 
82  /**
83  * Sets temporary id of annotation
84  *
85  * @param tmpId Temporary id of annotation
86  */
87  public void setTmpId(String tmpId) {
88  this.tmpId = tmpId;
89  }
90 
91  /**
92  * Gets number of confirmation method (how annotation was confirmed)
93  *
94  * @return Returns number of confirmation method (how annotation was confirmed), or null, if annotation wasn't confirmed
95  */
96  public Integer getConfirmMethod() {
97  return confirmMethod;
98  }
99 
100  /**
101  * Sets number of confirmation method (how annotation was confirmed)
102  *
103  * @param confirmMethod Number of confirmation method (how annotation was confirmed)
104  */
105  public void setConfirmMethod(Integer confirmMethod) {
106  this.confirmMethod = confirmMethod;
107  }
108 
109  /**
110  * Gets confirmed version of annotation
111  *
112  * @return Returns confirmed version of annotation
113  */
115  return confirmedVersion;
116  }
117 
118  /**
119  * Sets confirmed version of annotation
120  *
121  * @param confirmedVersion Confirmed version of annotation
122  */
124  this.confirmedVersion = confirmedVersion;
125  }
126 
127  /**
128  * Gets number of refuse method (how annotation was refused)
129  *
130  * @return Returns number of refuse method (how annotation was confirmed), or null, if annotation wasn't refused
131  */
132  public Integer getRefuseMethod() {
133  return refuseMethod;
134  }
135 
136  /**
137  * Sets number of refuse method (how annotation was refused)
138  *
139  * @param refuseMethod Number of refuse method (how annotation was refused)
140  */
141  public void setRefuseMethod(Integer refuseMethod) {
142  this.refuseMethod = refuseMethod;
143  }
144 
145  /**
146  * Gets suggested annotation
147  *
148  * @return Returns suggested annotation
149  */
151  return suggestion;
152  }
153 
154  /**
155  * Sets suggested annotation
156  *
157  * @param suggestion Suggested annotation
158  */
160  this.suggestion = suggestion;
161  }
162 
163  /**
164  * Gets percentage of confidence with annotation
165  *
166  * @return Returns percentage of confidence with annotation
167  */
168  public Integer getConfidence() {
169  return confidence;
170  }
171 
172  /**
173  * Sets percentage of confidence with annotation
174  *
175  * @param confidence Percentage of confidence with annotation
176  */
177  public void setConfidence(Integer confidence) {
178  this.confidence = confidence;
179  }
180 
181  /**
182  * Compares this with other object and returns, whether objects are same type
183  * and have same temporary id.
184  *
185  * @param obj Object to compare with
186  * @return If object is same type and have same temporary id, returns true, false otherwise
187  */
188  @Override
189  public boolean equals(Object obj) {
190  if (obj == null) {
191  return false;
192  }
193  if (getClass() != obj.getClass()) {
194  return false;
195  }
196  final SuggestionLogEntry other = (SuggestionLogEntry) obj;
197  if (this.tmpId != other.tmpId && (this.tmpId == null || !this.tmpId.equals(other.tmpId))) {
198  return false;
199  }
200  return true;
201  }
202 
203  /**
204  * Returns hash code of this object.
205  *
206  * @return Hash code
207  */
208  @Override
209  public int hashCode() {
210  int hash = 7;
211  hash = 59 * hash + (this.tmpId != null ? this.tmpId.hashCode() : 0);
212  return hash;
213  }
214 
215  /**
216  * Converts this object to string.
217  *
218  * @return String with this object.
219  */
220  @Override
221  public String toString() {
222  return "SuggestionLogEntry{" + "tmpId=" + tmpId + "suggestion=" + suggestion + "confirmedVersion=" + confirmedVersion + "refuseMethod=" + refuseMethod + "confirmMethod=" + confirmMethod + "confidence=" + confidence + '}';
223  }
224 
225  /**
226  * Returns serialized informations about suggested annotation in XML
227  *
228  * @param proto11 If true, protocol version is greather then 1.0
229  * @return Returns serialized informations about suggested annotation in XML
230  */
231  public String toXMLString(boolean proto11) {
232  String attrs = " tmpId=\"" + tmpId + "\" confidence=\"" + confidence + "\"";
233  return suggestion.toXMLString(true, attrs, proto11, true);
234  }
235 
236 } // class SuggestionLogEntry
Suggested annotation with informations about suggestion.
SuggestionLogEntry(Annotation suggestion, int confidence)
SuggestionLogEntry(String tmpId, Annotation suggestion, int confidence)