Ignore:
Timestamp:
02/20/12 11:54:55 (12 years ago)
Author:
sherbold
Message:
  • all hashValues are now only computed once, stored and only recomputed when something changes.
  • de.ugoe.cs.eventbench.jfc.data.JFCTargetComparator now allows precomputation of equalities
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/jfc/data/JFCEvent.java

    r380 r390  
    4545         */ 
    4646        private Map<String, String> parentParameters; 
     47         
     48        private boolean targetChanged = false; 
     49         
     50        private int targetHash = -1; 
    4751 
    4852        /** 
     
    145149                        target += "." + extension; 
    146150                } 
     151                targetChanged = true; 
    147152        } 
    148153 
     
    187192        @Override 
    188193        protected int targetHashCode() { 
    189                 int hashCode = 0; 
    190                 int multiplier = 29; 
    191                 if (target != null) { 
    192                         String[] targetParts = target.split("\\]\\.\\["); 
    193                         if (targetParts.length == 0) { 
    194                                 hashCode = widgetHashCode(target); 
    195                         } else { 
    196                                 for (String widgetString : targetParts) { 
    197                                         hashCode = hashCode * multiplier 
    198                                                         + widgetHashCode(widgetString); 
     194                if( targetChanged || targetHash==-1 ) { 
     195                        targetHash = 0; 
     196                        int multiplier = 29; 
     197                        if (target != null) { 
     198                                String[] targetParts = target.split("\\]\\.\\["); 
     199                                if (targetParts.length == 0) { 
     200                                        targetHash = widgetHashCode(target); 
     201                                } else { 
     202                                        for (String widgetString : targetParts) { 
     203                                                targetHash = targetHash * multiplier 
     204                                                                + widgetHashCode(widgetString); 
     205                                        } 
    199206                                } 
    200207                        } 
     208                        targetChanged = false; 
    201209                } 
    202  
    203                 return hashCode; 
     210                return targetHash; 
    204211        } 
    205212 
     
    221228                        hashCode = hashCode * multiplier + widgetInfo[1].hashCode(); 
    222229                        hashCode = hashCode * multiplier + widgetInfo[2].hashCode(); 
    223                         hashCode = hashCode * multiplier + widgetInfo[3].hashCode(); 
     230                        //hashCode = hashCode * multiplier + widgetInfo[3].hashCode(); 
    224231                } 
    225232                return hashCode; 
Note: See TracChangeset for help on using the changeset viewer.