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.List; |
---|
18 | import java.util.Map; |
---|
19 | |
---|
20 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
21 | |
---|
22 | /** |
---|
23 | * TODO comment |
---|
24 | * |
---|
25 | * @version $Revision: $ $Date: 16.07.2012$ |
---|
26 | * @author 2012, last modified by $Author: pharms$ |
---|
27 | */ |
---|
28 | public class UsabilitySmell { |
---|
29 | |
---|
30 | /** */ |
---|
31 | private ITask smellingTask; |
---|
32 | |
---|
33 | /** */ |
---|
34 | private UsabilitySmellIntensity intensity; |
---|
35 | |
---|
36 | /** */ |
---|
37 | private UsabilitySmellDescription description; |
---|
38 | |
---|
39 | /** */ |
---|
40 | private Map<String, Object> descriptionParameters; |
---|
41 | |
---|
42 | /** |
---|
43 | * |
---|
44 | */ |
---|
45 | UsabilitySmell(UsabilitySmellIntensity intensity, UsabilitySmellDescription description) { |
---|
46 | this(intensity, description, null); |
---|
47 | } |
---|
48 | |
---|
49 | /** |
---|
50 | * |
---|
51 | */ |
---|
52 | UsabilitySmell(ITask smellingTask, |
---|
53 | UsabilitySmellIntensity intensity, |
---|
54 | UsabilitySmellDescription description) |
---|
55 | { |
---|
56 | this(intensity, description, null); |
---|
57 | } |
---|
58 | |
---|
59 | /** |
---|
60 | * |
---|
61 | */ |
---|
62 | UsabilitySmell(UsabilitySmellIntensity intensity, |
---|
63 | UsabilitySmellDescription description, |
---|
64 | Map<String, Object> parameters) |
---|
65 | { |
---|
66 | this(null, intensity, description, parameters); |
---|
67 | } |
---|
68 | |
---|
69 | /** |
---|
70 | * |
---|
71 | */ |
---|
72 | UsabilitySmell(ITask smellingTask, |
---|
73 | UsabilitySmellIntensity intensity, |
---|
74 | UsabilitySmellDescription description, |
---|
75 | Map<String, Object> parameters) |
---|
76 | { |
---|
77 | this.smellingTask = smellingTask; |
---|
78 | this.intensity = intensity; |
---|
79 | this.description = description; |
---|
80 | this.descriptionParameters = parameters; |
---|
81 | } |
---|
82 | |
---|
83 | /** |
---|
84 | * |
---|
85 | */ |
---|
86 | public ITask getSmellingTask() { |
---|
87 | return smellingTask; |
---|
88 | } |
---|
89 | |
---|
90 | /** |
---|
91 | * |
---|
92 | */ |
---|
93 | public UsabilitySmellIntensity getIntensity() { |
---|
94 | return intensity; |
---|
95 | } |
---|
96 | |
---|
97 | /** |
---|
98 | * |
---|
99 | */ |
---|
100 | public void setIntensity(UsabilitySmellIntensity intensity) { |
---|
101 | this.intensity = intensity; |
---|
102 | } |
---|
103 | |
---|
104 | /** |
---|
105 | * |
---|
106 | */ |
---|
107 | public void setDescription(UsabilitySmellDescription description) { |
---|
108 | this.description = description; |
---|
109 | } |
---|
110 | |
---|
111 | /** |
---|
112 | * |
---|
113 | */ |
---|
114 | public String getParameterizedDescription() { |
---|
115 | return description.toString(descriptionParameters); |
---|
116 | } |
---|
117 | |
---|
118 | /** |
---|
119 | * |
---|
120 | */ |
---|
121 | public List<Object> getDescriptionFragments() { |
---|
122 | return description.toFragmentList(descriptionParameters); |
---|
123 | } |
---|
124 | |
---|
125 | /* |
---|
126 | */ |
---|
127 | public String getBriefDescription() { |
---|
128 | return description.getBriefDescription(); |
---|
129 | } |
---|
130 | |
---|
131 | /* |
---|
132 | * (non-Javadoc) |
---|
133 | * |
---|
134 | * @see java.lang.Object#equals(java.lang.Object) |
---|
135 | */ |
---|
136 | @Override |
---|
137 | public boolean equals(Object obj) { |
---|
138 | if (obj instanceof UsabilitySmell) { |
---|
139 | return description.equals(((UsabilitySmell) obj).description); |
---|
140 | } |
---|
141 | else { |
---|
142 | return false; |
---|
143 | } |
---|
144 | } |
---|
145 | |
---|
146 | /* |
---|
147 | * (non-Javadoc) |
---|
148 | * |
---|
149 | * @see java.lang.Object#hashCode() |
---|
150 | */ |
---|
151 | @Override |
---|
152 | public int hashCode() { |
---|
153 | return description.hashCode(); |
---|
154 | } |
---|
155 | |
---|
156 | /* |
---|
157 | * (non-Javadoc) |
---|
158 | * |
---|
159 | * @see java.lang.Object#toString() |
---|
160 | */ |
---|
161 | @Override |
---|
162 | public String toString() { |
---|
163 | if (smellingTask == null) { |
---|
164 | return "UsabilitySmell(" + intensity + ", " + description.name() + ")"; |
---|
165 | } |
---|
166 | else { |
---|
167 | return "UsabilitySmell(" + smellingTask + ", " + intensity + ", " + |
---|
168 | description.name() + ")"; |
---|
169 | } |
---|
170 | } |
---|
171 | |
---|
172 | } |
---|