Update year in copyright lines
[Sone.git] / src / main / java / net / pterodactylus / sone / freenet / wot / event / IdentityEvent.java
index 2727226..8a23ae1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - IdentityEvent.java - Copyright © 2013 David Roden
+ * Sone - IdentityEvent.java - Copyright © 2013–2019 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,8 +22,6 @@ import net.pterodactylus.sone.freenet.wot.OwnIdentity;
 
 /**
  * Base class for {@link Identity} events.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
 public abstract class IdentityEvent {
 
@@ -68,4 +66,18 @@ public abstract class IdentityEvent {
                return identity;
        }
 
+       @Override
+       public int hashCode() {
+               return ownIdentity().hashCode() ^ identity().hashCode();
+       }
+
+       @Override
+       public boolean equals(Object object) {
+               if ((object == null) || !object.getClass().equals(getClass())) {
+                       return false;
+               }
+               IdentityEvent identityEvent = (IdentityEvent) object;
+               return ownIdentity().equals(identityEvent.ownIdentity()) && identity().equals(identityEvent.identity());
+       }
+
 }