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

Last change on this file was 2162, checked in by pharms, 7 years ago
  • changes for first VR oriented usability evaluation
File size: 5.3 KB
RevLine 
[927]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
[922]15package de.ugoe.cs.autoquest.usability;
[442]16
[2162]17import java.io.Serializable;
18import java.util.Collections;
19import java.util.LinkedList;
[1493]20import java.util.List;
[442]21import java.util.Map;
22
[1918]23import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
24
[442]25/**
26 * TODO comment
27 *
28 * @version $Revision: $ $Date: 16.07.2012$
29 * @author 2012, last modified by $Author: pharms$
30 */
[2162]31public class UsabilitySmell implements Serializable {
[442]32
[2162]33    /**  */
34    private static final long serialVersionUID = 1L;
35
[561]36    /** */
[1918]37    private ITask smellingTask;
38   
39    /** */
40    private UsabilitySmellIntensity intensity;
[442]41
[561]42    /** */
[1918]43    private UsabilitySmellDescription description;
[442]44
[561]45    /** */
[1493]46    private Map<String, Object> descriptionParameters;
[2162]47   
48    /** */
49    private List<String> tags;
50   
51    /** */
52    private ManualLabel manualLabel = ManualLabel.UNCHECKED;
[442]53
[561]54    /**
[1301]55     *
[561]56     */
[1918]57    UsabilitySmell(UsabilitySmellIntensity intensity, UsabilitySmellDescription description) {
58        this(intensity, description, null);
[561]59    }
[1918]60   
61    /**
62     *
63     */
64    UsabilitySmell(ITask                     smellingTask,
65                   UsabilitySmellIntensity   intensity,
66                   UsabilitySmellDescription description)
67    {
68        this(intensity, description, null);
69    }
[442]70
[561]71    /**
[1301]72     *
[561]73     */
[1918]74    UsabilitySmell(UsabilitySmellIntensity   intensity,
75                   UsabilitySmellDescription description,
76                   Map<String, Object>       parameters)
[561]77    {
[1918]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;
[561]91        this.description = description;
92        this.descriptionParameters = parameters;
93    }
[442]94
[561]95    /**
96     *
97     */
[1918]98    public ITask getSmellingTask() {
99        return smellingTask;
[561]100    }
[442]101
[561]102    /**
[1918]103     *
104     */
105    public UsabilitySmellIntensity getIntensity() {
106        return intensity;
107    }
108
109    /**
[1301]110     *
[561]111     */
[1918]112    public void setIntensity(UsabilitySmellIntensity intensity) {
113        this.intensity = intensity;
[561]114    }
[442]115
[561]116    /**
[1301]117     *
[561]118     */
[1918]119    public void setDescription(UsabilitySmellDescription description) {
[561]120        this.description = description;
121    }
122
123    /**
[1301]124     *
125     */
[561]126    public String getParameterizedDescription() {
127        return description.toString(descriptionParameters);
128    }
[442]129
[1493]130    /**
131     *
132     */
133    public List<Object> getDescriptionFragments() {
134        return description.toFragmentList(descriptionParameters);
135    }
136
[561]137    /*
[2162]138     *
[1493]139     */
140    public String getBriefDescription() {
141        return description.getBriefDescription();
142    }
143
[2162]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
[1493]192    /*
[561]193     * (non-Javadoc)
194     *
195     * @see java.lang.Object#equals(java.lang.Object)
196     */
197    @Override
198    public boolean equals(Object obj) {
[1918]199        if (obj instanceof UsabilitySmell) {
200            return description.equals(((UsabilitySmell) obj).description);
[561]201        }
202        else {
203            return false;
204        }
[442]205    }
[561]206
207    /*
208     * (non-Javadoc)
209     *
210     * @see java.lang.Object#hashCode()
211     */
212    @Override
213    public int hashCode() {
[1918]214        return description.hashCode();
[442]215    }
216
[561]217    /*
218     * (non-Javadoc)
219     *
220     * @see java.lang.Object#toString()
221     */
222    @Override
223    public String toString() {
[1918]224        if (smellingTask == null) {
225            return "UsabilitySmell(" + intensity + ", " + description.name() + ")";
226        }
227        else {
228            return "UsabilitySmell(" + smellingTask + ", " + intensity + ", " +
229                description.name() + ")";
230        }
[561]231    }
[477]232
[2162]233    /** */
234    public static enum ManualLabel {
235        UNCHECKED, TRUE_POSITIVE, FALSE_POSITIVE;
236    }
[442]237}
Note: See TracBrowser for help on using the repository browser.