Fix somar complaints in equals methods 75/94175/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 11 Dec 2020 00:56:29 +0000 (01:56 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 11 Dec 2020 00:56:29 +0000 (01:56 +0100)
Sonar does not like if/else chains, simplify equals to simple
expressions.

Change-Id: I27087e85514a70bd3becde2fb5d41bcc11f6b8e3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/AliasEffectiveStatementImpl.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/DefValEffectiveStatementImpl.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/DisplayHintEffectiveStatementImpl.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/ImpliedEffectiveStatementImpl.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/MaxAccessEffectiveStatementImpl.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/OidEffectiveStatementImpl.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/SubIdEffectiveStatementImpl.java

index 96315e2ed9a1e5b5d43f6e489d8c8a01e694bf6f..8cfb6506f4070896b643c89b3d7ecc8d946ead9e 100644 (file)
@@ -56,22 +56,11 @@ final class AliasEffectiveStatementImpl extends UnknownEffectiveStatementBase<St
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (!(obj instanceof AliasEffectiveStatementImpl)) {
             return false;
         }
         final AliasEffectiveStatementImpl other = (AliasEffectiveStatementImpl) obj;
-        if (!Objects.equals(path, other.path)) {
-            return false;
-        }
-        if (!Objects.equals(getNodeType(), other.getNodeType())) {
-            return false;
-        }
-        if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
-            return false;
-        }
-        return true;
+        return Objects.equals(getNodeType(), other.getNodeType())
+            && Objects.equals(getNodeParameter(), other.getNodeParameter()) && Objects.equals(path, other.path);
     }
 }
index 95fafe0c12045edb05bab06ce239f86ab980b8d3..61f580ad101ec1fb22a0b3ef70d1023278c9ffea 100644 (file)
@@ -56,22 +56,11 @@ final class DefValEffectiveStatementImpl extends UnknownEffectiveStatementBase<S
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (!(obj instanceof DefValEffectiveStatementImpl)) {
             return false;
         }
         final DefValEffectiveStatementImpl other = (DefValEffectiveStatementImpl) obj;
-        if (!Objects.equals(path, other.path)) {
-            return false;
-        }
-        if (!Objects.equals(getNodeType(), other.getNodeType())) {
-            return false;
-        }
-        if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
-            return false;
-        }
-        return true;
+        return Objects.equals(getNodeType(), other.getNodeType())
+            && Objects.equals(getNodeParameter(), other.getNodeParameter()) && Objects.equals(path, other.path);
     }
 }
index 8b6e4597e43e5f2c08b6c7b7889c3537b6dc4a99..061ae83cc8c0e598208302d22b8bbd342d4a0291 100644 (file)
@@ -56,22 +56,11 @@ final class DisplayHintEffectiveStatementImpl extends UnknownEffectiveStatementB
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (!(obj instanceof DisplayHintEffectiveStatementImpl)) {
             return false;
         }
         final DisplayHintEffectiveStatementImpl other = (DisplayHintEffectiveStatementImpl) obj;
-        if (!Objects.equals(path, other.path)) {
-            return false;
-        }
-        if (!Objects.equals(getNodeType(), other.getNodeType())) {
-            return false;
-        }
-        if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
-            return false;
-        }
-        return true;
+        return Objects.equals(getNodeType(), other.getNodeType())
+            && Objects.equals(getNodeParameter(), other.getNodeParameter()) && Objects.equals(path, other.path);
     }
 }
index fbde8f615010c7894912d421515b2df0a726e49d..d0057f847e2a990bdb37b62c844b7fa1ae2ac081 100644 (file)
@@ -57,22 +57,11 @@ final class ImpliedEffectiveStatementImpl extends UnknownEffectiveStatementBase<
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (!(obj instanceof ImpliedEffectiveStatementImpl)) {
             return false;
         }
         final ImpliedEffectiveStatementImpl other = (ImpliedEffectiveStatementImpl) obj;
-        if (!Objects.equals(path, other.path)) {
-            return false;
-        }
-        if (!Objects.equals(getNodeType(), other.getNodeType())) {
-            return false;
-        }
-        if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
-            return false;
-        }
-        return true;
+        return Objects.equals(getNodeType(), other.getNodeType())
+            && Objects.equals(getNodeParameter(), other.getNodeParameter()) && Objects.equals(path, other.path);
     }
 }
index 5eea6d75d293dfe3aef692edfca110ae75993c76..c8c9b6eb05ac367347e9a7001a9eee44fa279ad4 100644 (file)
@@ -62,22 +62,11 @@ final class MaxAccessEffectiveStatementImpl extends UnknownEffectiveStatementBas
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (!(obj instanceof MaxAccessEffectiveStatementImpl)) {
             return false;
         }
         final MaxAccessEffectiveStatementImpl other = (MaxAccessEffectiveStatementImpl) obj;
-        if (!Objects.equals(path, other.path)) {
-            return false;
-        }
-        if (!Objects.equals(getNodeType(), other.getNodeType())) {
-            return false;
-        }
-        if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
-            return false;
-        }
-        return true;
+        return Objects.equals(getNodeType(), other.getNodeType())
+            && Objects.equals(getNodeParameter(), other.getNodeParameter()) && Objects.equals(path, other.path);
     }
 }
index ea14bcc008fbb69318cddc2c07215fcc9be358d3..f7504201703b68c1203f8cfaebd0416a0b9ef0e6 100644 (file)
@@ -58,22 +58,11 @@ final class OidEffectiveStatementImpl extends UnknownEffectiveStatementBase<Obje
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (!(obj instanceof OidEffectiveStatementImpl)) {
             return false;
         }
         final OidEffectiveStatementImpl other = (OidEffectiveStatementImpl) obj;
-        if (!Objects.equals(path, other.path)) {
-            return false;
-        }
-        if (!Objects.equals(getNodeType(), other.getNodeType())) {
-            return false;
-        }
-        if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
-            return false;
-        }
-        return true;
+        return Objects.equals(getNodeType(), other.getNodeType())
+            && Objects.equals(getNodeParameter(), other.getNodeParameter()) && Objects.equals(path, other.path);
     }
 }
\ No newline at end of file
index 3e7577353988f86902f848a7242b7e868e117e04..7384cceb11ae99d3233d009d2749fa9b3e85dd0a 100644 (file)
@@ -58,22 +58,11 @@ final class SubIdEffectiveStatementImpl extends UnknownEffectiveStatementBase<Ui
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (!(obj instanceof SubIdEffectiveStatementImpl)) {
             return false;
         }
         final SubIdEffectiveStatementImpl other = (SubIdEffectiveStatementImpl) obj;
-        if (!Objects.equals(path, other.path)) {
-            return false;
-        }
-        if (!Objects.equals(getNodeType(), other.getNodeType())) {
-            return false;
-        }
-        if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
-            return false;
-        }
-        return true;
+        return Objects.equals(getNodeType(), other.getNodeType())
+            && Objects.equals(getNodeParameter(), other.getNodeParameter()) && Objects.equals(path, other.path);
     }
 }