Changeset 806 for trunk/quest-plugin-jfc/src/main/java/de/ugoe/cs
- Timestamp:
- 09/10/12 20:52:49 (12 years ago)
- Location:
- trunk/quest-plugin-jfc/src/main/java/de/ugoe/cs/quest/plugin/jfc
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-plugin-jfc/src/main/java/de/ugoe/cs/quest/plugin/jfc/JFCReplayIDCalculator.java
r796 r806 30 30 31 31 static final int prime = 31; 32 private JFCReplayIDValidator validator; 33 34 public JFCReplayIDCalculator() { 35 this.validator = null; 36 } 37 38 public JFCReplayIDCalculator(JFCReplayIDValidator validator){ 39 this.validator = validator; 40 } 32 41 33 42 /** … … 73 82 long propagatedHashCode = windowHashCode; 74 83 75 // construct looks complicated but avoids going back and force through path 84 // added validator to check if generated component ids are known 85 if (validator != null){ 86 if (validator.validateReplayID("w" + windowHashCode)){ 87 System.out.println("ID w" + windowHashCode + " is valid."); 88 } 89 else{ 90 System.err.println(currentSpec + " describes an unknown component."); 91 System.err.println("ID w" + windowHashCode + " is unknown." ); 92 System.err.println(); 93 } 94 95 } 96 97 // construct looks complicated but avoids going back and forth through path 76 98 if (iterator.hasNext()) 77 99 currentSpec = iterator.next(); 78 else 100 else{ 79 101 currentSpec = null; 102 // there are no subcomponents, so we use windowHashCode as hashCode 103 hashCode = windowHashCode; 104 } 80 105 81 106 // walk through component path and calculate hashcode … … 84 109 hashCode = propagatedHashCode * prime + localHashCode; 85 110 hashCode = (hashCode * 2) & 0xffffffffL; 111 112 // added validator to check if generated component ids are known 113 if (validator != null){ 114 if (validator.validateReplayID("w" + hashCode)){ 115 System.out.println("ID w" + hashCode + " is valid."); 116 } 117 else{ 118 System.err.println(currentSpec + " describes an unknown component."); 119 System.err.println("ID w" + hashCode + " is unknown." ); 120 System.err.println(); 121 } 122 } 86 123 87 124 if (iterator.hasNext()){ … … 111 148 112 149 IEventTarget target = event.getTarget(); 113 JFCGUIElement jfcTarget = (JFCGUIElement) target; 150 if (!target.getPlatform().equals("JFC")){ 151 throw new IllegalArgumentException("Event target must be of type JFC."); 152 } 153 154 JFCGUIElement currentTarget = (JFCGUIElement) target; 114 155 115 156 // extract element path 116 JFCGUIElement currentTarget = jfcTarget;117 157 while (currentTarget != null){ 118 158 JFCGUIElementSpec currentSpec = (JFCGUIElementSpec) currentTarget.getSpecification(); 159 160 // new specification must be inserted at the beginning of the list 119 161 guiElementPath.add(0, currentSpec); 120 162 currentTarget = (JFCGUIElement) currentTarget.getParent();
Note: See TracChangeset
for help on using the changeset viewer.