Changeset 1492 for trunk/autoquest-plugin-html/src/main/java/de/ugoe
- Timestamp:
- 04/07/14 08:44:19 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/commands/CMDcondenseHTMLGUIModel.java
r1491 r1492 17 17 import java.util.ArrayList; 18 18 import java.util.Arrays; 19 import java.util.Collection;20 19 import java.util.Comparator; 21 20 import java.util.HashSet; 22 import java.util.IdentityHashMap;23 21 import java.util.LinkedList; 24 22 import java.util.List; 25 import java.util.Map;26 23 import java.util.Set; 27 24 import java.util.logging.Level; 28 25 29 26 import de.ugoe.cs.autoquest.CommandHelpers; 30 import de.ugoe.cs.autoquest.SequenceInstanceOf;31 import de.ugoe.cs.autoquest.eventcore.Event;32 27 import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel; 33 28 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; … … 130 125 GUIModel model = (GUIModel) dataObject; 131 126 132 // >>>>>>>>>>>>>>>>>>>>>>>>>>>> Just to test the distance measure133 134 System.out.println("checking distance measure correctness");135 Collection<List<Event>> sequences = null;136 dataObject = GlobalDataContainer.getInstance().getData(sequencesName);137 if (dataObject == null) {138 CommandHelpers.objectNotFoundMessage(sequencesName);139 return;140 }141 if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) {142 CommandHelpers.objectNotType(sequencesName, "Collection<List<Event<?>>>");143 return;144 }145 146 sequences = (Collection<List<Event>>) dataObject;147 148 Map<IGUIElement, IGUIElement> guiElements = new IdentityHashMap<IGUIElement, IGUIElement>();149 150 for (List<Event> sequence : sequences) {151 for (Event event : sequence) {152 guiElements.put((IGUIElement) event.getTarget(), (IGUIElement) event.getTarget());153 }154 }155 156 System.out.println("got " + guiElements.size() + " utilized GUI elements");157 158 IGUIElement[] guiElementArray =159 guiElements.keySet().toArray(new IGUIElement[guiElements.size()]);160 161 Arrays.sort(guiElementArray, new Comparator<IGUIElement>() {162 @Override163 public int compare(IGUIElement o1, IGUIElement o2) {164 return o1.getStringIdentifier().compareTo(o2.getStringIdentifier());165 }166 167 });168 169 int checkSize = Math.min(guiElements.size() * guiElements.size(), 100000000);170 double[] expectedDistances = new double[checkSize];171 int index = 0;172 173 OUTER:174 for (int i = 0; i < guiElementArray.length; i++) {175 for (int j = 0; j < guiElementArray.length; j++) {176 if (i == j) {177 continue;178 }179 180 if (index == 1703) {181 System.out.println("blub");182 }183 184 expectedDistances[index++] = guiElementArray[i].getDistanceTo(guiElementArray[j]);185 186 if (index == checkSize) {187 break OUTER;188 }189 }190 }191 192 System.out.println("calculated " + expectedDistances.length + " distances");193 194 // <<<<<<<<<<<<<<<<<<<<<<<<<<<< Just to test the distance measure195 196 127 for (IGUIElement root : model.getRootElements()) { 197 128 if (root instanceof HTMLServer) { … … 206 137 } 207 138 } 208 209 // >>>>>>>>>>>>>>>>>>>>>>>>>>>> Just to test the distance measure210 index = 0;211 212 System.out.println("checking, if distances are still the same");213 OUTER:214 for (int i = 0; i < guiElementArray.length; i++) {215 for (int j = 0; j < guiElementArray.length; j++) {216 if (i == j) {217 continue;218 }219 220 if (index == 1703) {221 System.out.println("blub");222 }223 224 double newDistance = guiElementArray[i].getDistanceTo(guiElementArray[j]);225 if ((expectedDistances[index] != newDistance) &&226 (expectedDistances[index] != 0.5) && (newDistance != 0.2))227 {228 System.out.println((index ) + ": distance between " + guiElementArray[i] +229 " and " + guiElementArray[j] + " changed due to condense. " +230 "Was " + expectedDistances[index] + " and is now " +231 guiElementArray[i].getDistanceTo(guiElementArray[j]) + ".");232 }233 234 index++;235 236 if (index == checkSize) {237 break OUTER;238 }239 }240 }241 // <<<<<<<<<<<<<<<<<<<<<<<<<<<< Just to test the distance measure242 243 139 } 244 140
Note: See TracChangeset
for help on using the changeset viewer.