Changeset 1009 for trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/JFCReplayIDCalculator.java
- Timestamp:
- 12/11/12 17:24:30 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/JFCReplayIDCalculator.java
r927 r1009 77 77 /** 78 78 * Calculates the replayID of a JFCEvent needed for compatibility with guitar suite 79 * @param List of {@link JFCGUIElementSpec}s that represent the component path of aevent target79 * @param List of {@link JFCGUIElementSpec}s that represent the path of an event target 80 80 * for which the replayID should be calculated. 81 81 * @return replayID … … 91 91 String title = currentSpec.getName(); 92 92 String fuzzyTitle = getFuzzyTitle(title); 93 long windowHashCode = fuzzyTitle.hashCode();94 windowHashCode = (windowHashCode * 2) & 0xffffffffL;95 96 long propagatedHashCode = windowHashCode;93 long topLevelHashCode = fuzzyTitle.hashCode(); 94 topLevelHashCode = (topLevelHashCode * 2) & 0xffffffffL; 95 96 long propagatedHashCode = topLevelHashCode; 97 97 98 // added validator to check if generated component ids are known98 // added validator to check if generated GUI element ids are known 99 99 if (validator != null){ 100 if (validator.validateReplayID("w" + windowHashCode)){101 System.out.println("ID w" + windowHashCode + " is valid.");100 if (validator.validateReplayID("w" + topLevelHashCode)){ 101 System.out.println("ID w" + topLevelHashCode + " is valid."); 102 102 } 103 103 else{ 104 System.err.println(currentSpec + " describes an unknown component.");105 System.err.println("ID w" + windowHashCode + " is unknown." );104 System.err.println(currentSpec + " describes an unknown GUI element."); 105 System.err.println("ID w" + topLevelHashCode + " is unknown." ); 106 106 System.err.println(); 107 107 } … … 114 114 else{ 115 115 currentSpec = null; 116 // there are no subcomponents, so we use windowHashCode as hashCode117 hashCode = windowHashCode;116 // there are no children of current GUI element, so we use topLevelHashCode as hashCode 117 hashCode = topLevelHashCode; 118 118 } 119 119 120 // walk through component path and calculate hashcode120 // walk through GUI element path and calculate hashcode 121 121 while(currentSpec != null){ 122 122 long localHashCode = getLocalHashCode(currentSpec); … … 124 124 hashCode = (hashCode * 2) & 0xffffffffL; 125 125 126 // added validator to check if generated component ids are known126 // added validator to check if generated GUI element ids are known 127 127 if (validator != null){ 128 128 if (validator.validateReplayID("w" + hashCode)){ 129 129 System.out.println("ID w" + hashCode + " is valid."); 130 System.out.println("==> " + currentSpec + " describes a known component.");130 System.out.println("==> " + currentSpec + " describes a known GUI element."); 131 131 } 132 132 else{ 133 133 System.err.println("ID w" + hashCode + " is unknown." ); 134 System.err.println("==> " + currentSpec + " describes an unknown component.");134 System.err.println("==> " + currentSpec + " describes an unknown GUI element."); 135 135 System.err.println(); 136 136 } … … 183 183 184 184 /** 185 * Calculates the hashcode part of a component.185 * Calculates the hashcode part of a GUI element. 186 186 * @param spec The {@link JFCGUIElementSpec} for which the hashcode should be calculated. 187 187 * @return the local hashcode … … 238 238 239 239 /** 240 * Guitar has a special way to deal with window titles when241 * calculating unique widget IDs. This method mimics Guitar's240 * Guitar has a special way to deal with top level GUI elements (window) 241 * titles when calculating unique widget IDs. This method mimics Guitar's 242 242 * behavior (compare guitar source code: edu.umd.cs.guitar. 243 243 * model.JFCDefaultIDGeneratorSimple).
Note: See TracChangeset
for help on using the changeset viewer.