Make a bot deliver all its packs when it’s being iterated over.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 9 Apr 2013 04:59:18 +0000 (06:59 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 9 Apr 2013 04:59:18 +0000 (06:59 +0200)
src/main/java/net/pterodactylus/xdcc/data/Bot.java

index 33bec20..46bca18 100644 (file)
@@ -18,6 +18,7 @@
 package net.pterodactylus.xdcc.data;
 
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.Map;
 
 import com.beust.jcommander.internal.Maps;
@@ -28,7 +29,7 @@ import com.beust.jcommander.internal.Maps;
  *
  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
-public class Bot {
+public class Bot implements Iterable<Pack> {
 
        /** The network this bot is on. */
        private final Network network;
@@ -111,6 +112,15 @@ public class Bot {
        }
 
        //
+       // ITERABLE METHODS
+       //
+
+       @Override
+       public Iterator<Pack> iterator() {
+               return packs.values().iterator();
+       }
+
+       //
        // OBJECT METHODS
        //