Ignore:
Timestamp:
12/11/12 17:24:30 (11 years ago)
Author:
fglaser
Message:
  • autoquest-plugin-jfc subproject was adapted to new naming conventions (GUI element instead of component) were appropriate
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/JFCReplayIDCalculator.java

    r927 r1009  
    7777   /** 
    7878    * 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 a event target 
     79    * @param List of {@link JFCGUIElementSpec}s that represent the path of an event target 
    8080    * for which the replayID should be calculated.  
    8181    * @return replayID 
     
    9191           String title = currentSpec.getName(); 
    9292           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; 
    9797            
    98            // added validator to check if generated component ids are known 
     98           // added validator to check if generated GUI element ids are known 
    9999           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."); 
    102102                   } 
    103103                   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." ); 
    106106                           System.err.println(); 
    107107                   } 
     
    114114           else{ 
    115115                   currentSpec = null; 
    116                    // there are no subcomponents, so we use windowHashCode as hashCode 
    117                    hashCode = windowHashCode; 
     116                   // there are no children of current GUI element, so we use topLevelHashCode as hashCode 
     117                   hashCode = topLevelHashCode; 
    118118           } 
    119119 
    120            // walk through component path and calculate hashcode 
     120           // walk through GUI element path and calculate hashcode 
    121121           while(currentSpec != null){ 
    122122                   long localHashCode = getLocalHashCode(currentSpec); 
     
    124124                   hashCode = (hashCode * 2) & 0xffffffffL; 
    125125                    
    126                    // added validator to check if generated component ids are known 
     126                   // added validator to check if generated GUI element ids are known 
    127127                   if (validator != null){ 
    128128                           if (validator.validateReplayID("w" + hashCode)){ 
    129129                                   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."); 
    131131                           } 
    132132                           else{ 
    133133                                   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."); 
    135135                                   System.err.println(); 
    136136                           } 
     
    183183         
    184184        /** 
    185          * Calculates the hashcode part of a component. 
     185         * Calculates the hashcode part of a GUI element. 
    186186         * @param spec The {@link JFCGUIElementSpec} for which the hashcode should be calculated. 
    187187         * @return the local hashcode 
     
    238238         
    239239        /** 
    240          * Guitar has a special way to deal with window titles when 
    241          * calculating unique widget IDs. This method mimics Guitar's 
     240         * 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 
    242242         * behavior (compare guitar source code: edu.umd.cs.guitar. 
    243243         * model.JFCDefaultIDGeneratorSimple). 
Note: See TracChangeset for help on using the changeset viewer.