Changeset 38

Show
Ignore:
Timestamp:
04/17/08 01:04:15 (4 months ago)
Author:
jordi
Message:

fixed ticket#30; revised code with Java format

Location:
trunk/src/planet
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/planet/simulate/Results.java

    r18 r38  
    219219         *  the lookup and insert times  
    220220         */ 
    221         private static int lookup_number = 0; 
     221        private static int lookupNumber = 0; 
    222222        /** 
    223223         * print total and average hops 
    224224         */ 
    225         public static void printhops() { 
     225        public static void printHops() { 
    226226                Collection keys = hops.keySet(); 
    227227                Iterator  it = keys.iterator(); 
    228                 long total_hops = 0; 
    229                 int lookup_number_temp = 0; 
     228                long totalHops = 0; 
     229                int temp = 0; 
    230230                while (it.hasNext()) { 
    231                         lookup_number_temp++; 
    232                         String id_and_source =(String)it.next(); 
    233                         total_hops += ((Integer)(hops.get(id_and_source))).longValue(); 
    234                         // System.out.println(id_and_source + " " + 
    235                         // hops.get(id_and_source)); 
    236  
    237                 } 
    238                  
    239                 lookup_number = lookup_number_temp; 
     231                        temp++; 
     232                        String idAndSource =(String)it.next(); 
     233                        totalHops += ((Integer)(hops.get(idAndSource))).longValue(); 
     234                } 
     235                 
     236                lookupNumber = temp; 
    240237                Logger.log("************************", Logger.PRINT_LOG); 
    241238                Logger.log("*****Hops Results*******", Logger.PRINT_LOG); 
    242239                Logger.log("************************", Logger.PRINT_LOG); 
    243                 if (lookup_number_temp == 0) { 
     240                if (temp == 0) { 
    244241                        Logger.log("There are no lookup operation", Logger.PRINT_LOG); 
    245242                } else { 
    246                         Logger.log("The total hops in the test is : [" + total_hops 
    247                                         + "] in [" + lookup_number_temp + "] lookup operations", 
     243                        Logger.log("The total hops in the test is : [" + totalHops 
     244                                        + "] in [" + temp + "] lookup operations", 
    248245                                        Logger.PRINT_LOG); 
    249246                        Logger.log("The average hops in the test is : " 
    250                                         + (double) ((double) total_hops / (double) lookup_number_temp), 
     247                                        + (double) ((double) totalHops / (double) temp), 
    251248                                        Logger.PRINT_LOG); 
    252249                } 
     
    255252        } 
    256253 
    257         public static int getLookup_number() { 
    258                 return lookup_number; 
     254        public static int getLookupNumber() { 
     255                return lookupNumber; 
    259256        } 
    260257 
  • trunk/src/planet/test/dht/DHTTest.java

    r34 r38  
    109109          System.out.println ("Keys inserted with ["+steps+"] steps and ["+GenericApp.timeElapsedInSeconds(t1,t2)+"] seconds.\n"); 
    110110           
    111           Results.printhops(); 
    112                         int lookup_number_1 = Results.getLookup_number(); 
     111          Results.printHops(); 
     112                  int lookupNumber1 = Results.getLookupNumber(); 
    113113          //LOOKUP PROCESS 
    114114          t1 = System.currentTimeMillis(); 
     
    128128          System.out.println ("Key lookup finished with ["+steps+"] steps and ["+GenericApp.timeElapsedInSeconds(t1,t2)+"] seconds.\n"); 
    129129           
    130           Results.printhops(); 
    131                         int lookup_number_2 = Results.getLookup_number(); 
    132                         System.out.println("loopup opertions is " + (lookup_number_2 - lookup_number_1)); 
     130          Results.printHops(); 
     131                  int lookupNumber2 = Results.getLookupNumber(); 
     132              System.out.println("loopup opertions is " + (lookupNumber2 - lookupNumber1)); 
    133133 
    134134          //PRINT APPLICATON INFORMATION