package net.pterodactylus.xdcc.data;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
-import com.beust.jcommander.internal.Maps;
+import com.google.common.collect.Maps;
/**
* A bot is a client in a {@link Network} that carries {@link Pack}s which are
*
* @param network
* The network the bot is on
+ * @param name
+ * The name of the bot
*/
- public Bot(Network network) {
- this.network = network;
+ public Bot(Network network, String name) {
+ this.network = checkNotNull(network, "network must not be null");
+ this.name = checkNotNull(name, "name must not be null");
}
//
* @return This bot
*/
public Bot name(String name) {
- this.name = name;
+ this.name = checkNotNull(name, "name must not be null");
return this;
}
//
@Override
+ public boolean equals(Object object) {
+ if (!(object instanceof Bot)) {
+ return false;
+ }
+ Bot bot = (Bot) object;
+ return network().equals(bot.network()) && name().equals(bot.name());
+ }
+
+ @Override
+ public int hashCode() {
+ return network().hashCode() ^ name().hashCode();
+ }
+
+ @Override
public String toString() {
return String.format("%s/%s", name(), network().name());
}