Просмотр исходного кода

Add equals to AutoCommand

Change-Id: I5dd31b61c579539580b9f944e2da6252d97afa90
Reviewed-on: http://gerrit.dmdirc.com/3996
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
pull/1/head
Greg Holmes 9 лет назад
Родитель
Сommit
ad57b542e3
1 измененных файлов: 20 добавлений и 0 удалений
  1. 20
    0
      src/com/dmdirc/commandparser/auto/AutoCommand.java

+ 20
- 0
src/com/dmdirc/commandparser/auto/AutoCommand.java Просмотреть файл

@@ -67,6 +67,26 @@ public class AutoCommand {
67 67
         return response;
68 68
     }
69 69
 
70
+    public boolean equals(final Object object) {
71
+        if (object == null) {
72
+            return false;
73
+        }
74
+        if (getClass() != object.getClass()) {
75
+            return false;
76
+        }
77
+        final AutoCommand command = (AutoCommand) object;
78
+        return  Objects.equal(server, command.getServer())
79
+                && Objects.equal(network, command.getNetwork())
80
+                && Objects.equal(profile, command.getProfile())
81
+                && Objects.equal(response, command.getResponse());
82
+
83
+    }
84
+
85
+    @Override
86
+    public int hashCode() {
87
+        return Objects.hashCode(server, network, profile, response);
88
+    }
89
+
70 90
     public String toString() {
71 91
         return Objects.toStringHelper(this)
72 92
                 .add("Connection", server)

Загрузка…
Отмена
Сохранить