Changeset 1493 for trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityDefectDescription.java
- Timestamp:
- 04/11/14 11:21:45 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityDefectDescription.java
r1335 r1493 18 18 import java.io.InputStream; 19 19 import java.util.ArrayList; 20 import java.util.Collection; 20 21 import java.util.List; 21 22 import java.util.Map; … … 33 34 public enum UsabilityDefectDescription { 34 35 35 SCROLL_REQUIRED,36 INEFFICIENT_ACTIONS, 36 37 TEXT_FIELD_INPUT_RATIO, 37 38 TEXT_FIELD_INPUT_REPETITIONS, 38 TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO; 39 TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO, 40 COOCCURENCE_SUCCEED, 41 COOCCURENCE_PRECED, 42 HIGH_EVENT_COVERAGE, 43 HIGH_TARGET_DISTANCE, 44 MISSING_FEEDBACK, 45 UNUSED_GUI_ELEMENTS; 39 46 40 47 /** */ … … 122 129 * 123 130 */ 124 public String toString(Map<String, String> parameters) throws IllegalArgumentException {131 public String toString(Map<String, Object> parameters) throws IllegalArgumentException { 125 132 StringBuffer result = new StringBuffer(); 126 133 … … 131 138 132 139 if (fragment instanceof ParameterFragment) { 133 Stringvalue = null;140 Object value = null; 134 141 if (parameters != null) { 135 142 value = parameters.get(((ParameterFragment) fragment).getParameterName()); … … 137 144 138 145 if (value != null) { 139 result.append(value); 146 if (value instanceof Collection<?>) { 147 int counter = 1; 148 for (Object elem : ((Collection<?>) value)) { 149 result.append('\n'); 150 result.append(counter++); 151 result.append(".: "); 152 result.append(elem); 153 } 154 } 155 else { 156 result.append(value.toString()); 157 } 140 158 } 141 159 else { … … 154 172 } 155 173 174 /** 175 * 176 */ 177 public List<Object> toFragmentList(Map<String, Object> parameters) 178 throws IllegalArgumentException 179 { 180 List<Object> result = new ArrayList<Object>(); 181 182 for (Object fragment : defectDescription.getTextFragmentOrParameterFragment()) { 183 if (fragment instanceof ParameterFragment) { 184 Object value = null; 185 if (parameters != null) { 186 value = parameters.get(((ParameterFragment) fragment).getParameterName()); 187 } 188 189 if (value != null) { 190 result.add(value); 191 } 192 else { 193 throw new IllegalArgumentException 194 ("required parameter \"" + 195 ((ParameterFragment) fragment).getParameterName() + 196 "\" for usability defect description " + this.name() + " not provided"); 197 } 198 } 199 else { 200 result.add(getFragmentString(fragment)); 201 } 202 } 203 204 return result; 205 } 206 207 /** 208 * 209 */ 210 public String getBriefDescription() { 211 return defectDescription.briefText; 212 } 213 156 214 /* 157 215 * (non-Javadoc)
Note: See TracChangeset
for help on using the changeset viewer.