[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] | 15 | package de.ugoe.cs.autoquest.usability; |
---|
[442] | 16 | |
---|
[1493] | 17 | import java.util.List; |
---|
[442] | 18 | import java.util.Map; |
---|
| 19 | |
---|
| 20 | /** |
---|
| 21 | * TODO comment |
---|
| 22 | * |
---|
| 23 | * @version $Revision: $ $Date: 16.07.2012$ |
---|
| 24 | * @author 2012, last modified by $Author: pharms$ |
---|
| 25 | */ |
---|
[561] | 26 | public class UsabilityDefect { |
---|
[442] | 27 | |
---|
[561] | 28 | /** */ |
---|
| 29 | private UsabilityDefectSeverity severity; |
---|
[442] | 30 | |
---|
[561] | 31 | /** */ |
---|
| 32 | private UsabilityDefectDescription description; |
---|
[442] | 33 | |
---|
[561] | 34 | /** */ |
---|
[1493] | 35 | private Map<String, Object> descriptionParameters; |
---|
[442] | 36 | |
---|
[561] | 37 | /** |
---|
[1301] | 38 | * |
---|
[561] | 39 | */ |
---|
[1493] | 40 | UsabilityDefect(UsabilityDefectSeverity severity, UsabilityDefectDescription description) { |
---|
[561] | 41 | this(severity, description, null); |
---|
| 42 | } |
---|
[442] | 43 | |
---|
[561] | 44 | /** |
---|
[1301] | 45 | * |
---|
[561] | 46 | */ |
---|
[1335] | 47 | UsabilityDefect(UsabilityDefectSeverity severity, |
---|
| 48 | UsabilityDefectDescription description, |
---|
[1493] | 49 | Map<String, Object> parameters) |
---|
[561] | 50 | { |
---|
| 51 | this.severity = severity; |
---|
| 52 | this.description = description; |
---|
| 53 | this.descriptionParameters = parameters; |
---|
| 54 | } |
---|
[442] | 55 | |
---|
[561] | 56 | /** |
---|
| 57 | * |
---|
| 58 | */ |
---|
| 59 | public UsabilityDefectSeverity getSeverity() { |
---|
| 60 | return severity; |
---|
| 61 | } |
---|
[442] | 62 | |
---|
[561] | 63 | /** |
---|
[1301] | 64 | * |
---|
[561] | 65 | */ |
---|
| 66 | public void setSeverity(UsabilityDefectSeverity severity) { |
---|
| 67 | this.severity = severity; |
---|
| 68 | } |
---|
[442] | 69 | |
---|
[561] | 70 | /** |
---|
[1301] | 71 | * |
---|
[561] | 72 | */ |
---|
| 73 | public void setDescription(UsabilityDefectDescription description) { |
---|
| 74 | this.description = description; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | /** |
---|
[1301] | 78 | * |
---|
| 79 | */ |
---|
[561] | 80 | public String getParameterizedDescription() { |
---|
| 81 | return description.toString(descriptionParameters); |
---|
| 82 | } |
---|
[442] | 83 | |
---|
[1493] | 84 | /** |
---|
| 85 | * |
---|
| 86 | */ |
---|
| 87 | public List<Object> getDescriptionFragments() { |
---|
| 88 | return description.toFragmentList(descriptionParameters); |
---|
| 89 | } |
---|
| 90 | |
---|
[561] | 91 | /* |
---|
[1493] | 92 | */ |
---|
| 93 | public String getBriefDescription() { |
---|
| 94 | return description.getBriefDescription(); |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | /* |
---|
[561] | 98 | * (non-Javadoc) |
---|
| 99 | * |
---|
| 100 | * @see java.lang.Object#equals(java.lang.Object) |
---|
| 101 | */ |
---|
| 102 | @Override |
---|
| 103 | public boolean equals(Object obj) { |
---|
| 104 | if (obj instanceof UsabilityDefect) { |
---|
| 105 | return |
---|
| 106 | (severity == ((UsabilityDefect) obj).severity) && |
---|
| 107 | (description == ((UsabilityDefect) obj).description); |
---|
| 108 | } |
---|
| 109 | else { |
---|
| 110 | return false; |
---|
| 111 | } |
---|
[442] | 112 | } |
---|
[561] | 113 | |
---|
| 114 | /* |
---|
| 115 | * (non-Javadoc) |
---|
| 116 | * |
---|
| 117 | * @see java.lang.Object#hashCode() |
---|
| 118 | */ |
---|
| 119 | @Override |
---|
| 120 | public int hashCode() { |
---|
| 121 | return severity.hashCode() + description.hashCode(); |
---|
[442] | 122 | } |
---|
| 123 | |
---|
[561] | 124 | /* |
---|
| 125 | * (non-Javadoc) |
---|
| 126 | * |
---|
| 127 | * @see java.lang.Object#toString() |
---|
| 128 | */ |
---|
| 129 | @Override |
---|
| 130 | public String toString() { |
---|
| 131 | return "UsabilityDefect(" + severity.name() + ", " + description.name() + ")"; |
---|
| 132 | } |
---|
[477] | 133 | |
---|
[442] | 134 | } |
---|