Fix somar complaints in equals methods
[yangtools.git] / yang / rfc6643-parser-support / src / main / java / org / opendaylight / yangtools / rfc6643 / parser / OidEffectiveStatementImpl.java
index 9b3e2a7e2cf3346e227f9fea1f1c09164054b08c..05588f8766c6fd60e5ef6e88eeb67d0d10959f13 100644 (file)
@@ -24,10 +24,11 @@ final class OidEffectiveStatementImpl extends UnknownEffectiveStatementBase<Obje
 
     private final SchemaPath path;
 
-    OidEffectiveStatementImpl(final StmtContext<ObjectIdentifier, OidStatement, ?> ctx,
-            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        super(ctx, substatements);
-        path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
+    OidEffectiveStatementImpl(final OidStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements,
+            final StmtContext<ObjectIdentifier, OidStatement, ?> ctx) {
+        super(declared.argument(), declared, substatements, ctx);
+        path = ctx.coerceParentContext().getSchemaPath().get().createChild(getNodeType());
     }
 
     @Override
@@ -56,22 +57,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