source: trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/UsabilitySmell.java @ 2162

Last change on this file since 2162 was 2162, checked in by pharms, 7 years ago
  • changes for first VR oriented usability evaluation
File size: 5.3 KB
Line 
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
15package de.ugoe.cs.autoquest.usability;
16
17import java.io.Serializable;
18import java.util.Collections;
19import java.util.LinkedList;
20import java.util.List;
21import java.util.Map;
22
23import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
24
25/**
26 * TODO comment
27 *
28 * @version $Revision: $ $Date: 16.07.2012$
29 * @author 2012, last modified by $Author: pharms$
30 */
31public class UsabilitySmell implements Serializable {
32
33    /**  */
34    private static final long serialVersionUID = 1L;
35
36    /** */
37    private ITask smellingTask;
38   
39    /** */
40    private UsabilitySmellIntensity intensity;
41
42    /** */
43    private UsabilitySmellDescription description;
44
45    /** */
46    private Map<String, Object> descriptionParameters;
47   
48    /** */
49    private List<String> tags;
50   
51    /** */
52    private ManualLabel manualLabel = ManualLabel.UNCHECKED;
53
54    /**
55     *
56     */
57    UsabilitySmell(UsabilitySmellIntensity intensity, UsabilitySmellDescription description) {
58        this(intensity, description, null);
59    }
60   
61    /**
62     *
63     */
64    UsabilitySmell(ITask                     smellingTask,
65                   UsabilitySmellIntensity   intensity,
66                   UsabilitySmellDescription description)
67    {
68        this(intensity, description, null);
69    }
70
71    /**
72     *
73     */
74    UsabilitySmell(UsabilitySmellIntensity   intensity,
75                   UsabilitySmellDescription description,
76                   Map<String, Object>       parameters)
77    {
78        this(null, intensity, description, parameters);
79    }
80
81    /**
82     *
83     */
84    UsabilitySmell(ITask                     smellingTask,
85                   UsabilitySmellIntensity   intensity,
86                   UsabilitySmellDescription description,
87                   Map<String, Object>       parameters)
88    {
89        this.smellingTask = smellingTask;
90        this.intensity = intensity;
91        this.description = description;
92        this.descriptionParameters = parameters;
93    }
94
95    /**
96     *
97     */
98    public ITask getSmellingTask() {
99        return smellingTask;
100    }
101
102    /**
103     *
104     */
105    public UsabilitySmellIntensity getIntensity() {
106        return intensity;
107    }
108
109    /**
110     *
111     */
112    public void setIntensity(UsabilitySmellIntensity intensity) {
113        this.intensity = intensity;
114    }
115
116    /**
117     *
118     */
119    public void setDescription(UsabilitySmellDescription description) {
120        this.description = description;
121    }
122
123    /**
124     *
125     */
126    public String getParameterizedDescription() {
127        return description.toString(descriptionParameters);
128    }
129
130    /**
131     *
132     */
133    public List<Object> getDescriptionFragments() {
134        return description.toFragmentList(descriptionParameters);
135    }
136
137    /*
138     *
139     */
140    public String getBriefDescription() {
141        return description.getBriefDescription();
142    }
143
144    /**
145     *
146     */
147    public void addTag(String tag) {
148        if (this.tags == null) {
149            this.tags = new LinkedList<>();
150        }
151       
152        if (!this.tags.contains(tag)) {
153            this.tags.add(tag);
154        }
155    }
156
157    /**
158     *
159     */
160    public void removeTag(String tag) {
161        if (this.tags != null) {
162            this.tags.remove(tag);
163        }
164    }
165
166    /**
167     * @param manualLabel the manualLabel to set
168     */
169    public void setManualLabel(ManualLabel manualLabel) {
170        this.manualLabel = manualLabel;
171    }
172
173    /**
174     * @return the tags
175     */
176    public List<String> getTags() {
177        if (tags != null) {
178            return Collections.unmodifiableList(tags);
179        }
180        else {
181            return Collections.emptyList();
182        }
183    }
184
185    /**
186     * @return the manualLabel
187     */
188    public ManualLabel getManualLabel() {
189        return manualLabel;
190    }
191
192    /*
193     * (non-Javadoc)
194     *
195     * @see java.lang.Object#equals(java.lang.Object)
196     */
197    @Override
198    public boolean equals(Object obj) {
199        if (obj instanceof UsabilitySmell) {
200            return description.equals(((UsabilitySmell) obj).description);
201        }
202        else {
203            return false;
204        }
205    }
206
207    /*
208     * (non-Javadoc)
209     *
210     * @see java.lang.Object#hashCode()
211     */
212    @Override
213    public int hashCode() {
214        return description.hashCode();
215    }
216
217    /*
218     * (non-Javadoc)
219     *
220     * @see java.lang.Object#toString()
221     */
222    @Override
223    public String toString() {
224        if (smellingTask == null) {
225            return "UsabilitySmell(" + intensity + ", " + description.name() + ")";
226        }
227        else {
228            return "UsabilitySmell(" + smellingTask + ", " + intensity + ", " +
229                description.name() + ")";
230        }
231    }
232
233    /** */
234    public static enum ManualLabel {
235        UNCHECKED, TRUE_POSITIVE, FALSE_POSITIVE;
236    }
237}
Note: See TracBrowser for help on using the repository browser.