Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into fix/execute_benched
[simgrid.git] / examples / java / dht / kademlia / RoutingTable.java
index 9dc08f8..ed1552e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, 2016. The SimGrid Team.
+/* Copyright (c) 2012-2014, 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -18,7 +18,7 @@ public class RoutingTable {
 
   public RoutingTable(int id) {
     this.id = id;
-    buckets = new Vector<Bucket>();
+    buckets = new Vector<>();
     for (int i = 0; i < Common.IDENTIFIER_SIZE + 1; i++) {
       buckets.add(new Bucket(i));
     }
@@ -67,7 +67,8 @@ public class RoutingTable {
       Msg.debug("Adding " + id + " to my routing table");
       bucket.add(id);
       if (bucket.size() > Common.BUCKET_SIZE)  {
-        //TODO: Ping the least seen guy and remove him if he is offline.
+        // TODO
+        Msg.debug("Should ping the least seen guy and remove him if he is offline.");
       }
     }
   }
@@ -102,12 +103,12 @@ public class RoutingTable {
 
   @Override
   public String toString() {
-    String string = "RoutingTable [ id=" + id + " " ;
+    StringBuilder string = new StringBuilder("RoutingTable [ id=" + id + " ");
     for (int i = 0; i < buckets.size(); i++) {
       if (buckets.get(i).size() > 0) {
-        string += buckets.get(i) + " ";
+        string.append(buckets.get(i) + " ");
       }
     }
-    return string;
+    return string.toString();
   }
 }