Fix somar complaints in equals methods
[yangtools.git] / yang / rfc6643-parser-support / src / main / java / org / opendaylight / yangtools / rfc6643 / parser / SubIdEffectiveStatementImpl.java
index 650293f299c5854674314ae267ba3aa7c6d8c963..9958da0074bae2397e227bdc3697b24f63bf863f 100644 (file)
@@ -24,15 +24,11 @@ final class SubIdEffectiveStatementImpl extends UnknownEffectiveStatementBase<Ui
 
     private final SchemaPath path;
 
-    SubIdEffectiveStatementImpl(final StmtContext<Uint32, SubIdStatement, ?> ctx,
-            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        super(ctx, substatements);
-        path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
-    }
-
-    @Override
-    public Uint32 getArgument() {
-        return argument();
+    SubIdEffectiveStatementImpl(final SubIdStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements,
+            final StmtContext<Uint32, SubIdStatement, ?> ctx) {
+        super(declared.argument(), declared, substatements, ctx);
+        path = ctx.coerceParentContext().getSchemaPath().get().createChild(getNodeType());
     }
 
     @Override
@@ -41,10 +37,16 @@ final class SubIdEffectiveStatementImpl extends UnknownEffectiveStatementBase<Ui
     }
 
     @Override
+    @Deprecated
     public SchemaPath getPath() {
         return path;
     }
 
+    @Override
+    public SubIdEffectiveStatement asEffectiveStatement() {
+        return this;
+    }
+
     @Override
     public int hashCode() {
         return Objects.hash(path, getNodeType(), getNodeParameter());
@@ -55,22 +57,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);
     }
 }