Changeset 1265 for trunk/autoquest-plugin-html/src
- Timestamp:
- 07/25/13 14:54:32 (11 years ago)
- Location:
- trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/AbstractDefaultLogParser.java
r1247 r1265 23 23 import java.util.Collection; 24 24 import java.util.HashMap; 25 import java.util.Iterator; 25 26 import java.util.LinkedList; 26 27 import java.util.List; … … 129 130 public AbstractDefaultLogParser() { 130 131 sequences = new LinkedList<List<Event>>(); 131 guiElementTree = new GUIElementTree<String>( );132 guiElementTree = new GUIElementTree<String>(new GUIModel(false)); 132 133 guiElementBuffer = new LinkedList<BufferEntry>(); 133 134 eventBuffer = new LinkedList<BufferEntry>(); … … 192 193 } 193 194 195 // we parse a new file. So clear the buffers. 196 guiElementBuffer.clear(); 197 eventBuffer.clear(); 198 194 199 if (inputSource != null) { 195 200 inputSource.setSystemId("file://" + file.getAbsolutePath()); … … 219 224 } 220 225 } 226 227 if (guiElementBuffer.size() > 0) { 228 Console.println(guiElementBuffer.size() + " GUI elements not processed"); 229 } 230 231 if (eventBuffer.size() > 0) { 232 Console.printerrln(eventBuffer.size() + " events not processed"); 233 } 221 234 } 222 235 … … 300 313 } 301 314 else if (qName.equals("component") && (currentGUIElementId != null)) { 302 guiElementBuffer.add( new BufferEntry(currentGUIElementId, currentParameters));315 guiElementBuffer.add(0, new BufferEntry(currentGUIElementId, currentParameters)); 303 316 304 317 processGUIElements(); … … 385 398 do { 386 399 processedElement = false; 387 // search for the next GUI element that can be processed 388 for (int i = 0; i < guiElementBuffer.size(); i++) { 389 BufferEntry entry = guiElementBuffer.get(i); 400 401 // search for the next GUI element that can be processed (use an iterator on the 402 // linked list, as this is most effective) 403 Iterator<BufferEntry> iterator = guiElementBuffer.iterator(); 404 while (iterator.hasNext()) { 405 BufferEntry entry = iterator.next(); 390 406 processedElement = handleGUIElement(entry.id, entry.parameters); 407 391 408 if (processedElement) { 392 guiElementBuffer.remove(i);409 iterator.remove(); 393 410 processedElements++; 394 411 break; … … 421 438 422 439 if ((entry != null) && (entry.id != null) && (entry.parameters != null)) { 440 423 441 processedEvent = handleEvent(entry.id, entry.parameters); 442 424 443 if (processedEvent) { 425 444 eventBuffer.remove(0); -
trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/HTMLLogTextInputPseudomizer.java
r1246 r1265 222 222 EventEntry newEvent = new EventEntry(type, parameters, timestamp); 223 223 224 boolean added = false; 225 for (int i = 0; i < sortedEvents.size(); i++) { 226 if (sortedEvents.get(i).timestamp > newEvent.timestamp) { 227 sortedEvents.add(i, newEvent); 228 added = true; 224 int start = 0; 225 int end = sortedEvents.size(); 226 int center = 0; 227 long centerTimestamp; 228 229 while (start != end) { 230 center = start + ((end - start) / 2); 231 232 if ((center != start) || (center != end)) { 233 centerTimestamp = sortedEvents.get(center).timestamp; 234 235 if (centerTimestamp < newEvent.timestamp) { 236 start = Math.max(center, start + 1); 237 } 238 else if (centerTimestamp > newEvent.timestamp) { 239 end = Math.min(center, end - 1); 240 } 241 else { 242 // add the event directly where the center is, as the timestamps of the center 243 // and the new event are equal 244 start = end = center; 245 break; 246 } 247 } 248 else { 249 // add the event to the position denoted by the add index 229 250 break; 230 251 } 231 252 } 232 253 233 if (!added) { 234 sortedEvents.add(newEvent); 235 } 254 sortedEvents.add(start, newEvent); 236 255 237 256 if ("onchange".equals(type)) {
Note: See TracChangeset
for help on using the changeset viewer.