ServiceAddressMap: add getEntrySet()
authorTJ <hacker@iam.tj>
Mon, 4 May 2015 17:04:24 +0000 (18:04 +0100)
committerTJ <hacker@iam.tj>
Mon, 4 May 2015 17:04:24 +0000 (18:04 +0100)
Provides for iterating over the map, and make access to LastSeenHost
fields public.

src/uk/ac/ntu/n0521366/wsyd/libs/net/ServiceAddressMap.java

index bed4f64..80e825f 100644 (file)
@@ -53,9 +53,9 @@ public class ServiceAddressMap {
          */
         public static enum STATE {STATIC, DYNAMIC}
         
-        final STATE state;
-        final long timeInMillis;
-        final InetSocketAddress address;
+        public final STATE state;
+        public final long timeInMillis;
+        public final InetSocketAddress address;
         
         /**
          * Constructs a new instance of a host.
@@ -209,4 +209,13 @@ public class ServiceAddressMap {
     public boolean containsService(String service) {
         return this._serviceToAddressMap.containsKey(service);
     }
+    
+    /**
+     * Return a Set backed by the Map so it can be iterated over.
+     * @return Set containing the Map key,value entries
+     */
+    public java.util.Set<java.util.Map.Entry<String, LastSeenHost>> getEntrySet() {
+    return _serviceToAddressMap.entrySet();
+
+    }
 }