1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
2 | // |
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
4 | // you may not use this file except in compliance with the License. |
---|
5 | // You may obtain a copy of the License at |
---|
6 | // |
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
8 | // |
---|
9 | // Unless required by applicable law or agreed to in writing, software |
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
12 | // See the License for the specific language governing permissions and |
---|
13 | // limitations under the License. |
---|
14 | |
---|
15 | package de.ugoe.cs.autoquest.usability; |
---|
16 | |
---|
17 | import java.util.Map; |
---|
18 | |
---|
19 | /** |
---|
20 | * TODO comment |
---|
21 | * |
---|
22 | * @version $Revision: $ $Date: 16.07.2012$ |
---|
23 | * @author 2012, last modified by $Author: pharms$ |
---|
24 | */ |
---|
25 | public class UsabilityDefect { |
---|
26 | |
---|
27 | /** */ |
---|
28 | private UsabilityDefectSeverity severity; |
---|
29 | |
---|
30 | /** */ |
---|
31 | private UsabilityDefectDescription description; |
---|
32 | |
---|
33 | /** */ |
---|
34 | private Map<String, String> descriptionParameters; |
---|
35 | |
---|
36 | /** |
---|
37 | * |
---|
38 | */ |
---|
39 | public UsabilityDefect(UsabilityDefectSeverity severity, UsabilityDefectDescription description) |
---|
40 | { |
---|
41 | this(severity, description, null); |
---|
42 | } |
---|
43 | |
---|
44 | /** |
---|
45 | * |
---|
46 | */ |
---|
47 | public UsabilityDefect(UsabilityDefectSeverity severity, |
---|
48 | UsabilityDefectDescription description, |
---|
49 | Map<String, String> parameters) |
---|
50 | { |
---|
51 | this.severity = severity; |
---|
52 | this.description = description; |
---|
53 | this.descriptionParameters = parameters; |
---|
54 | } |
---|
55 | |
---|
56 | /** |
---|
57 | * |
---|
58 | */ |
---|
59 | public UsabilityDefectSeverity getSeverity() { |
---|
60 | return severity; |
---|
61 | } |
---|
62 | |
---|
63 | /** |
---|
64 | * |
---|
65 | */ |
---|
66 | public void setSeverity(UsabilityDefectSeverity severity) { |
---|
67 | this.severity = severity; |
---|
68 | } |
---|
69 | |
---|
70 | /** |
---|
71 | * |
---|
72 | */ |
---|
73 | public void setDescription(UsabilityDefectDescription description) { |
---|
74 | this.description = description; |
---|
75 | } |
---|
76 | |
---|
77 | /** |
---|
78 | * |
---|
79 | */ |
---|
80 | public String getParameterizedDescription() { |
---|
81 | return description.toString(descriptionParameters); |
---|
82 | } |
---|
83 | |
---|
84 | /* |
---|
85 | * (non-Javadoc) |
---|
86 | * |
---|
87 | * @see java.lang.Object#equals(java.lang.Object) |
---|
88 | */ |
---|
89 | @Override |
---|
90 | public boolean equals(Object obj) { |
---|
91 | if (obj instanceof UsabilityDefect) { |
---|
92 | return |
---|
93 | (severity == ((UsabilityDefect) obj).severity) && |
---|
94 | (description == ((UsabilityDefect) obj).description); |
---|
95 | } |
---|
96 | else { |
---|
97 | return false; |
---|
98 | } |
---|
99 | } |
---|
100 | |
---|
101 | /* |
---|
102 | * (non-Javadoc) |
---|
103 | * |
---|
104 | * @see java.lang.Object#hashCode() |
---|
105 | */ |
---|
106 | @Override |
---|
107 | public int hashCode() { |
---|
108 | return severity.hashCode() + description.hashCode(); |
---|
109 | } |
---|
110 | |
---|
111 | /* |
---|
112 | * (non-Javadoc) |
---|
113 | * |
---|
114 | * @see java.lang.Object#toString() |
---|
115 | */ |
---|
116 | @Override |
---|
117 | public String toString() { |
---|
118 | return "UsabilityDefect(" + severity.name() + ", " + description.name() + ")"; |
---|
119 | } |
---|
120 | |
---|
121 | } |
---|