SONAR suggestion - implement equals() whenever compareTo() is implmented
Change-Id: I1eee6f8fd76ac9d7555612a56f84ef16fef9f90d
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/PortAuthTracker.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/PortAuthTracker.java
index 627ca7d..2127019 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/PortAuthTracker.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/PortAuthTracker.java
@@ -17,6 +17,7 @@
package org.onosproject.segmentrouting;
+import com.google.common.base.Objects;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
@@ -333,5 +334,24 @@
int result = Comparators.ELEMENT_ID_COMPARATOR.compare(d, o.d);
return (result != 0) ? result : Long.signum(p.toLong() - o.p.toLong());
}
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final PortAuthTracker.PortAuthState that = (PortAuthTracker.PortAuthState) obj;
+
+ return Comparators.ELEMENT_ID_COMPARATOR.compare(this.d, that.d) == 0 &&
+ p.toLong() == that.p.toLong();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(this.d, this.p);
+ }
}
}
diff --git a/core/api/src/main/java/org/onosproject/ui/lion/LionBundle.java b/core/api/src/main/java/org/onosproject/ui/lion/LionBundle.java
index 56fc4bc..619b99c 100644
--- a/core/api/src/main/java/org/onosproject/ui/lion/LionBundle.java
+++ b/core/api/src/main/java/org/onosproject/ui/lion/LionBundle.java
@@ -17,6 +17,7 @@
package org.onosproject.ui.lion;
+import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.ImmutableSortedSet;
@@ -206,6 +207,24 @@
return key.compareTo(o.key);
}
+ @Override
+ public boolean equals(Object obj) {
+
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final LionBundle.LionItem that = (LionBundle.LionItem) obj;
+ return Objects.equal(this.key, that.key);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(this.key);
+ }
+
/**
* Returns the key.
*
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/lion/LionConfig.java b/web/gui/src/main/java/org/onosproject/ui/impl/lion/LionConfig.java
index d1a2bb2..e6d73d3 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/lion/LionConfig.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/lion/LionConfig.java
@@ -17,6 +17,7 @@
package org.onosproject.ui.impl.lion;
+import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.io.CharStreams;
@@ -337,6 +338,24 @@
public int compareTo(CmdAlias o) {
return alias.compareTo(o.alias);
}
+
+ @Override
+ public boolean equals(Object obj) {
+
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final CmdAlias that = (CmdAlias) obj;
+ return Objects.equal(this.alias, that.alias);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(this.alias);
+ }
}
/**
@@ -392,6 +411,24 @@
return rawRes.compareTo(o.rawRes);
}
+ @Override
+ public boolean equals(Object obj) {
+
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final CmdFrom that = (CmdFrom) obj;
+ return Objects.equal(this.rawRes, that.rawRes);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(this.rawRes);
+ }
+
/**
* Returns the resource bundle name from which to import things.
*