Use Objects.equals() in effective statements 03/27503/3
authorRobert Varga <rovarga@cisco.com>
Sun, 27 Sep 2015 15:34:02 +0000 (17:34 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 28 Sep 2015 07:26:36 +0000 (07:26 +0000)
This simplifies equals() method implementations and performs various
obvious cleanups:
- boolean assignement via trigraph
- explicit isEmpty() before ImmutableList.copyOf()
- private fields

And adds a couple of FIXMEs for follow-up.

Change-Id: Id591cef7f777efaa02e0cb77d47245762a103363
Signed-off-by: Robert Varga <rovarga@cisco.com>
92 files changed:
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AnyXmlEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ArgumentEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AugmentEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BaseEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BelongsEffectiveToStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/CaseEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/CaseShorthandImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ChoiceEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ConfigEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ContactEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ContainerEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DefaultEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DescriptionEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DeviateEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DeviationEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/EffectiveConstraintDefinitionImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/EffectiveSchemaContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/EffectiveStatementBase.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/EffectiveStmtUtils.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ErrorAppTagEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ErrorMessageEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ExtendedTypeEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ExtensionEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/FeatureEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/FractionDigitsEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/GroupingEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IdentityEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IfFeatureEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ImportEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IncludeEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/InputEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/KeyEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafListEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ListEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MandatoryEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MaxElementsEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MinElementsEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ModuleEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MustEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/NamespaceEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/NotificationEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OrderedByEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OrganizationEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OutputEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PathEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PositionEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PrefixEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PresenceEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ReferenceEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RefineEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RequireInstanceEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RevisionDateEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RevisionEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RpcEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/StatusEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/SubmoduleEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/TypeDefEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/UnitsEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/UnknownEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/UsesEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ValueEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/WhenEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/YangVersionEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/YinElementEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/BinaryEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/BitEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/BitsSpecificationEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/BooleanEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/Decimal64SpecificationEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/EmptyEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/EnumEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/EnumSpecificationEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/Int16EffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/Int32EffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/Int64EffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/Int8EffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/IntegerEffectiveImplBase.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/LeafrefSpecificationEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/LengthConstraintEffectiveImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/LengthEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/PatternConstraintEffectiveImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/PatternEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/RangeConstraintEffectiveImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/RangeEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/StringEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/StringRestrictionsEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/UInt16EffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/UInt32EffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/UInt64EffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/UInt8EffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/UnsignedIntegerEffectiveImplBase.java

index 98d65f0e8c50f497e44dacec6ecc34aabebb8018..ed95f87455b6f29c982c95cbeea1e9a56f9c27a4 100644 (file)
@@ -17,10 +17,10 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.AnyxmlStatement;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.AnyxmlStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.TypeOfCopy;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
@@ -40,7 +40,7 @@ public class AnyXmlEffectiveStatementImpl extends
     ImmutableList<UnknownSchemaNode> unknownNodes;
 
     public AnyXmlEffectiveStatementImpl(
-            StmtContext<QName, AnyxmlStatement, EffectiveStatement<QName, AnyxmlStatement>> ctx) {
+            final StmtContext<QName, AnyxmlStatement, EffectiveStatement<QName, AnyxmlStatement>> ctx) {
         super(ctx);
         this.qname = ctx.getStatementArgument();
         this.path = Utils.getSchemaPath(ctx);
@@ -51,7 +51,7 @@ public class AnyXmlEffectiveStatementImpl extends
     }
 
     private void initCopyType(
-            StmtContext<QName, AnyxmlStatement, EffectiveStatement<QName, AnyxmlStatement>> ctx) {
+            final StmtContext<QName, AnyxmlStatement, EffectiveStatement<QName, AnyxmlStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
 
@@ -141,70 +141,29 @@ public class AnyXmlEffectiveStatementImpl extends
         return result;
     }
 
-    private boolean checkQname(AnyXmlEffectiveStatementImpl other) {
-      if (qname == null) {
-        if (other.qname != null) {
-          return false;
-        }
-      } else if (!qname.equals(other.qname)) {
-        return false;
-      }
-      return true;
-    }
-
-    private boolean checkPath(AnyXmlEffectiveStatementImpl other) {
-      if (path == null) {
-        if (other.path != null) {
-            return false;
-        }
-      } else if (!path.equals(other.path)) {
-        return false;
-      }
-      return true;
-    }
-
-    private boolean checkObject(final Object obj) {
-      if (obj == null) {
-        return false;
-      }
-      if (getClass() != obj.getClass()) {
-        return false;
-      }
-      return true;
-    }
-
     @Override
     public boolean equals(final Object obj) {
         if (this == obj) {
             return true;
         }
-
-        if (!checkObject(obj)) {
-          return false;
-        }
-
-        AnyXmlEffectiveStatementImpl other = (AnyXmlEffectiveStatementImpl) obj;
-
-        if (!checkQname(other)) {
+        if (obj == null) {
             return false;
         }
-
-        if (!checkPath(other)) {
+        if (getClass() != obj.getClass()) {
             return false;
         }
 
-        return true;
+        AnyXmlEffectiveStatementImpl other = (AnyXmlEffectiveStatementImpl) obj;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder(
-                AnyXmlEffectiveStatementImpl.class.getSimpleName());
+        StringBuilder sb = new StringBuilder(AnyXmlEffectiveStatementImpl.class.getSimpleName());
         sb.append("[");
         sb.append("qname=").append(qname);
         sb.append(", path=").append(path);
         sb.append("]");
         return sb.toString();
     }
-
 }
index 609bf9ca5b4f3dddb197b21cd707003b3a52e2bf..2fda2ff6da1fb2685ac089d8ec75a559c6543812 100644 (file)
@@ -11,12 +11,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.stmt.ArgumentStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class ArgumentEffectiveStatementImpl extends
-        EffectiveStatementBase<QName, ArgumentStatement> {
-
-    public ArgumentEffectiveStatementImpl(
-            StmtContext<QName, ArgumentStatement, ?> ctx) {
+public class ArgumentEffectiveStatementImpl extends EffectiveStatementBase<QName, ArgumentStatement> {
+    public ArgumentEffectiveStatementImpl(final StmtContext<QName, ArgumentStatement, ?> ctx) {
         super(ctx);
     }
-
 }
\ No newline at end of file
index 0d004df4b13296325f6cb56a11f9bdc333350edf..365c461fdb5aa843cdfb44579a25c4fecb462a8e 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import java.net.URI;
@@ -21,13 +20,13 @@ import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.NamespaceRevisionAware;
 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.AugmentStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
@@ -35,20 +34,17 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 public class AugmentEffectiveStatementImpl
         extends
         AbstractEffectiveDocumentedDataNodeContainer<SchemaNodeIdentifier, AugmentStatement>
-        implements AugmentationSchema, NamespaceRevisionAware,
-        Comparable<AugmentEffectiveStatementImpl> {
-    private final int order;
+        implements AugmentationSchema, NamespaceRevisionAware, Comparable<AugmentEffectiveStatementImpl> {
     private final SchemaPath targetPath;
-    RevisionAwareXPath whenCondition;
-
-    URI namespace;
-    Date revision;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private final URI namespace;
+    private final Date revision;
+    private final int order;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
+    private RevisionAwareXPath whenCondition;
     private AugmentationSchema copyOf;
 
     public AugmentEffectiveStatementImpl(
-            StmtContext<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> ctx){
-
+            final StmtContext<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> ctx) {
         super(ctx);
 
         SchemaNodeIdentifier schemaNodeIdentifier = ctx.getStatementArgument();
@@ -67,7 +63,7 @@ public class AugmentEffectiveStatementImpl
     }
 
     private void initCopyOf(
-            StmtContext<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> ctx) {
+            final StmtContext<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> ctx) {
         StatementContextBase<?, ?, ?> originalCtx = ctx.getOriginalCtx();
         if (originalCtx != null) {
             this.copyOf = (AugmentationSchema) originalCtx.buildEffective();
@@ -151,18 +147,10 @@ public class AugmentEffectiveStatementImpl
             return false;
         }
         AugmentEffectiveStatementImpl other = (AugmentEffectiveStatementImpl) obj;
-        if (targetPath == null) {
-            if (other.targetPath != null) {
-                return false;
-            }
-        } else if (!targetPath.equals(other.targetPath)) {
+        if (!Objects.equals(targetPath, other.targetPath)) {
             return false;
         }
-        if (whenCondition == null) {
-            if (other.whenCondition != null) {
-                return false;
-            }
-        } else if (!whenCondition.equals(other.whenCondition)) {
+        if (!Objects.equals(whenCondition, other.whenCondition)) {
             return false;
         }
         if (!getChildNodes().equals(other.getChildNodes())) {
@@ -186,8 +174,7 @@ public class AugmentEffectiveStatementImpl
     public int compareTo(final AugmentEffectiveStatementImpl o) {
         checkNotNull(o);
         Iterator<QName> thisIt = this.targetPath.getPathFromRoot().iterator();
-        Iterator<QName> otherIt = o.getTargetPath().getPathFromRoot()
-                .iterator();
+        Iterator<QName> otherIt = o.getTargetPath().getPathFromRoot().iterator();
         while (thisIt.hasNext()) {
             if (otherIt.hasNext()) {
                 int comp = thisIt.next().compareTo(otherIt.next());
index 95e32a6b97ee8801d0ed6c6c15a89890f7261136..478bab9ccefb63367e873fbda4aa3b1d1dfd922f 100644 (file)
@@ -11,10 +11,9 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.stmt.BaseStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class BaseEffectiveStatementImpl extends
-        EffectiveStatementBase<QName, BaseStatement> {
+public class BaseEffectiveStatementImpl extends EffectiveStatementBase<QName, BaseStatement> {
 
-    public BaseEffectiveStatementImpl(StmtContext<QName, BaseStatement, ?> ctx) {
+    public BaseEffectiveStatementImpl(final StmtContext<QName, BaseStatement, ?> ctx) {
         super(ctx);
     }
 
index 7080bb742d72707484b2b819f41aae5d71431387..74e8fb936c481d552a75447ae7615080d6de3226 100644 (file)
@@ -10,12 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class BelongsEffectiveToStatementImpl extends
-        EffectiveStatementBase<String, BelongsToStatement> {
-
-    public BelongsEffectiveToStatementImpl(
-            StmtContext<String, BelongsToStatement, ?> ctx) {
+public class BelongsEffectiveToStatementImpl extends EffectiveStatementBase<String, BelongsToStatement> {
+    public BelongsEffectiveToStatementImpl(final StmtContext<String, BelongsToStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index 46ba0c292db6fca48bdd9ac492217b6fc3323532..7430466832ea88639156f51410bd1394ab654264 100644 (file)
@@ -21,30 +21,28 @@ import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.CaseStatement;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.CaseStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.TypeOfCopy;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
-public class CaseEffectiveStatementImpl extends
-        AbstractEffectiveDocumentedDataNodeContainer<QName, CaseStatement>
+public class CaseEffectiveStatementImpl extends AbstractEffectiveDocumentedDataNodeContainer<QName, CaseStatement>
         implements ChoiceCaseNode, DerivableSchemaNode {
     private final QName qname;
     private final SchemaPath path;
+    private final ConstraintDefinition constraints;
 
-    boolean augmenting;
-    boolean addedByUses;
-    ChoiceCaseNode original;
-    ConstraintDefinition constraints;
-
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private boolean augmenting;
+    private boolean addedByUses;
+    private ChoiceCaseNode original;
+    private ImmutableSet<AugmentationSchema> augmentations;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
 
     public CaseEffectiveStatementImpl(
-            StmtContext<QName, CaseStatement, EffectiveStatement<QName, CaseStatement>> ctx) {
+            final StmtContext<QName, CaseStatement, EffectiveStatement<QName, CaseStatement>> ctx) {
         super(ctx);
         this.qname = ctx.getStatementArgument();
         this.path = Utils.getSchemaPath(ctx);
@@ -55,7 +53,7 @@ public class CaseEffectiveStatementImpl extends
     }
 
     private void initCopyType(
-            StmtContext<QName, CaseStatement, EffectiveStatement<QName, CaseStatement>> ctx) {
+            final StmtContext<QName, CaseStatement, EffectiveStatement<QName, CaseStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
 
@@ -161,32 +159,16 @@ public class CaseEffectiveStatementImpl extends
             return false;
         }
         CaseEffectiveStatementImpl other = (CaseEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder(
-                CaseEffectiveStatementImpl.class.getSimpleName());
+        StringBuilder sb = new StringBuilder(CaseEffectiveStatementImpl.class.getSimpleName());
         sb.append("[");
         sb.append("qname=");
         sb.append(qname);
         sb.append("]");
         return sb.toString();
     }
-
 }
index aaa78c178eb4ab7db5bc2efe9a9fe228e48e14b6..e5aec1f44775a5e2424222d3e5ccd867eab7a5e7 100644 (file)
@@ -42,17 +42,18 @@ public class CaseShorthandImpl implements ChoiceCaseNode, DerivableSchemaNode {
 
     private final boolean augmenting;
     private final boolean addedByUses;
-    ConstraintDefinition constraints;
+    private final ConstraintDefinition constraints;
     private ChoiceCaseNode original;
 
     ImmutableList<UnknownSchemaNode> unknownNodes;
 
-    public CaseShorthandImpl(DataSchemaNode caseShorthandNode) {
+    public CaseShorthandImpl(final DataSchemaNode caseShorthandNode) {
         this.caseShorthandNode = caseShorthandNode;
         this.qName = caseShorthandNode.getQName();
 
         SchemaPath caseShorthandNodePath = caseShorthandNode.getPath();
         Iterable<QName> pathFromRoot = caseShorthandNodePath.getPathFromRoot();
+        // FIXME: cacheShorthandNodePath.getParent() should be enough
         this.path = SchemaPath
                 .create(Iterables.limit(pathFromRoot,
                         Iterables.size(pathFromRoot) - 1),
@@ -134,7 +135,7 @@ public class CaseShorthandImpl implements ChoiceCaseNode, DerivableSchemaNode {
     }
 
     @Override
-    public DataSchemaNode getDataChildByName(QName name) {
+    public DataSchemaNode getDataChildByName(final QName name) {
         if (qName.equals(name)) {
             return caseShorthandNode;
         } else {
@@ -143,7 +144,7 @@ public class CaseShorthandImpl implements ChoiceCaseNode, DerivableSchemaNode {
     }
 
     @Override
-    public DataSchemaNode getDataChildByName(String name) {
+    public DataSchemaNode getDataChildByName(final String name) {
         if (qName.getLocalName().equals(name)) {
             return caseShorthandNode;
         } else {
@@ -187,32 +188,16 @@ public class CaseShorthandImpl implements ChoiceCaseNode, DerivableSchemaNode {
             return false;
         }
         CaseShorthandImpl other = (CaseShorthandImpl) obj;
-        if (qName == null) {
-            if (other.qName != null) {
-                return false;
-            }
-        } else if (!qName.equals(other.qName)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qName, other.qName) && Objects.equals(path, other.path);
     }
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder(
-                CaseShorthandImpl.class.getSimpleName());
+        StringBuilder sb = new StringBuilder(CaseShorthandImpl.class.getSimpleName());
         sb.append("[");
         sb.append("qname=");
         sb.append(qName);
         sb.append("]");
         return sb.toString();
     }
-
 }
index 0be4b49db80041f5e7d488ab0fd99b77a4924410..1cca6d070f032713ef2d2e51fcf567c60117fd2c 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
@@ -45,16 +46,16 @@ public class ChoiceEffectiveStatementImpl extends
     private final QName qname;
     private final SchemaPath path;
 
-    boolean augmenting;
-    boolean addedByUses;
-    ChoiceSchemaNode original;
-    boolean configuration = true;
-    ConstraintDefinition constraints;
-    String defaultCase;
+    private boolean augmenting;
+    private boolean addedByUses;
+    private ChoiceSchemaNode original;
+    private boolean configuration = true;
+    private final ConstraintDefinition constraints;
+    private String defaultCase;
 
-    ImmutableSet<ChoiceCaseNode> cases;
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private ImmutableSet<ChoiceCaseNode> cases;
+    private ImmutableSet<AugmentationSchema> augmentations;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
 
     public ChoiceEffectiveStatementImpl(
             final StmtContext<QName, ChoiceStatement, EffectiveStatement<QName, ChoiceStatement>> ctx) {
@@ -79,8 +80,7 @@ public class ChoiceEffectiveStatementImpl extends
         if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
             addedByUses = true;
         }
-        if (copyTypesFromOriginal
-                .contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
             addedByUses = augmenting = true;
         }
 
@@ -118,22 +118,19 @@ public class ChoiceEffectiveStatementImpl extends
                     || effectiveStatement instanceof LeafSchemaNode) {
 
                 DataSchemaNode dataSchemaNode = (DataSchemaNode) effectiveStatement;
-                ChoiceCaseNode shorthandCase = new CaseShorthandImpl(
-                        dataSchemaNode);
+                ChoiceCaseNode shorthandCase = new CaseShorthandImpl(dataSchemaNode);
                 casesInit.add(shorthandCase);
 
                 if (dataSchemaNode.isAugmenting() && !this.augmenting) {
                     resetAugmenting(dataSchemaNode);
                 }
             }
-            if (!configurationInit
-                    && effectiveStatement instanceof ConfigEffectiveStatementImpl) {
+            if (!configurationInit && effectiveStatement instanceof ConfigEffectiveStatementImpl) {
                 ConfigEffectiveStatementImpl configStmt = (ConfigEffectiveStatementImpl) effectiveStatement;
                 this.configuration = configStmt.argument();
                 configurationInit = true;
             }
-            if (!defaultInit
-                    && effectiveStatement instanceof DefaultEffectiveStatementImpl) {
+            if (!defaultInit && effectiveStatement instanceof DefaultEffectiveStatementImpl) {
                 DefaultEffectiveStatementImpl defaultCaseStmt = (DefaultEffectiveStatementImpl) effectiveStatement;
                 this.defaultCase = defaultCaseStmt.argument();
                 defaultInit = true;
@@ -216,10 +213,8 @@ public class ChoiceEffectiveStatementImpl extends
 
     @Override
     public ChoiceCaseNode getCaseNodeByName(final QName name) {
-        if (name == null) {
-            throw new IllegalArgumentException(
-                    "Choice Case QName cannot be NULL!");
-        }
+        Preconditions.checkArgument(name != null, "Choice Case QName cannot be NULL!");
+
         for (final ChoiceCaseNode caseNode : cases) {
             if (caseNode != null && name.equals(caseNode.getQName())) {
                 return caseNode;
@@ -230,10 +225,8 @@ public class ChoiceEffectiveStatementImpl extends
 
     @Override
     public ChoiceCaseNode getCaseNodeByName(final String name) {
-        if (name == null) {
-            throw new IllegalArgumentException(
-                    "Choice Case string Name cannot be NULL!");
-        }
+        Preconditions.checkArgument(name != null, "Choice Case string Name cannot be NULL!");
+
         for (final ChoiceCaseNode caseNode : cases) {
             if (caseNode != null && (caseNode.getQName() != null)
                     && name.equals(caseNode.getQName().getLocalName())) {
@@ -269,31 +262,15 @@ public class ChoiceEffectiveStatementImpl extends
             return false;
         }
         ChoiceEffectiveStatementImpl other = (ChoiceEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder(
-                ChoiceEffectiveStatementImpl.class.getSimpleName());
+        StringBuilder sb = new StringBuilder(ChoiceEffectiveStatementImpl.class.getSimpleName());
         sb.append("[");
         sb.append("qname=").append(qname);
         sb.append("]");
         return sb.toString();
     }
-
 }
index 57f78017b64a12308fd5c097825309f392347214..db661bffba9d6f3874bb7f36c227cff4e7685764 100644 (file)
@@ -10,12 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.ConfigStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class ConfigEffectiveStatementImpl extends
-        EffectiveStatementBase<Boolean, ConfigStatement> {
-
-    public ConfigEffectiveStatementImpl(
-            StmtContext<Boolean, ConfigStatement, ?> ctx) {
+public class ConfigEffectiveStatementImpl extends EffectiveStatementBase<Boolean, ConfigStatement> {
+    public ConfigEffectiveStatementImpl(final StmtContext<Boolean, ConfigStatement, ?> ctx) {
         super(ctx);
-
     }
 }
index 6a2ae09ec88131613937e02c91ed0ecc35236845..378d3faaf00666aaee16fca0c00924a27a35417c 100644 (file)
@@ -10,12 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.ContactStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class ContactEffectiveStatementImpl extends
-        EffectiveStatementBase<String, ContactStatement> {
-
-    public ContactEffectiveStatementImpl(
-            StmtContext<String, ContactStatement, ?> ctx) {
+public class ContactEffectiveStatementImpl extends EffectiveStatementBase<String, ContactStatement> {
+    public ContactEffectiveStatementImpl(final StmtContext<String, ContactStatement, ?> ctx) {
         super(ctx);
-
     }
 }
index f91c1ce5775109d7520cfe295b84da34c3bdf471..4842358382d13ee09d69387de295dcfe08272436 100644 (file)
@@ -21,10 +21,10 @@ import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.ContainerStatement;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ContainerStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.TypeOfCopy;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
@@ -37,17 +37,19 @@ public class ContainerEffectiveStatementImpl extends
     private final SchemaPath path;
 
     private boolean presence;
+
+    // FIXME: should be private
     boolean augmenting;
     private boolean addedByUses;
     private boolean configuration = true;
     private ContainerSchemaNode original;
-    private ConstraintDefinition constraints;
+    private final ConstraintDefinition constraints;
 
     private ImmutableSet<AugmentationSchema> augmentations;
     private ImmutableList<UnknownSchemaNode> unknownNodes;
 
     public ContainerEffectiveStatementImpl(
-            StmtContext<QName, ContainerStatement, EffectiveStatement<QName, ContainerStatement>> ctx) {
+            final StmtContext<QName, ContainerStatement, EffectiveStatement<QName, ContainerStatement>> ctx) {
         super(ctx);
 
         qname = ctx.getStatementArgument();
@@ -59,17 +61,17 @@ public class ContainerEffectiveStatementImpl extends
     }
 
     private void initCopyType(
-            StmtContext<QName, ContainerStatement, EffectiveStatement<QName, ContainerStatement>> ctx) {
+            final StmtContext<QName, ContainerStatement, EffectiveStatement<QName, ContainerStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
 
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
             augmenting = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
             addedByUses = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
             addedByUses = augmenting = true;
         }
 
@@ -97,8 +99,7 @@ public class ContainerEffectiveStatementImpl extends
             if (effectiveSubstatement instanceof PresenceEffectiveStatementImpl) {
                 presence = true;
             }
-            if (!configurationInit
-                    && effectiveSubstatement instanceof ConfigEffectiveStatementImpl) {
+            if (!configurationInit && effectiveSubstatement instanceof ConfigEffectiveStatementImpl) {
                 ConfigEffectiveStatementImpl configStmt = (ConfigEffectiveStatementImpl) effectiveSubstatement;
                 this.configuration = configStmt.argument();
                 configurationInit = true;
@@ -180,21 +181,7 @@ public class ContainerEffectiveStatementImpl extends
             return false;
         }
         ContainerEffectiveStatementImpl other = (ContainerEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
index 26084a65f1280b8b30a8a77d26d0077f12f03531..56aab3eef37eadd9ad3b438d438fbe75bf9046f1 100644 (file)
@@ -10,12 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class DefaultEffectiveStatementImpl extends
-        EffectiveStatementBase<String, DefaultStatement> {
-
-    public DefaultEffectiveStatementImpl(
-            StmtContext<String, DefaultStatement, ?> ctx) {
+public class DefaultEffectiveStatementImpl extends EffectiveStatementBase<String, DefaultStatement> {
+    public DefaultEffectiveStatementImpl(final StmtContext<String, DefaultStatement, ?> ctx) {
         super(ctx);
     }
-
 }
\ No newline at end of file
index 1d640ac0421099a6d975995cb7817c5079776bec..837df34841cf58b5e5e00479221e3dd6d29f90d9 100644 (file)
@@ -7,16 +7,11 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class DescriptionEffectiveStatementImpl extends
-        EffectiveStatementBase<String, DescriptionStatement> {
-
-    public DescriptionEffectiveStatementImpl(
-            StmtContext<String, DescriptionStatement, ?> ctx) {
+public class DescriptionEffectiveStatementImpl extends EffectiveStatementBase<String, DescriptionStatement> {
+    public DescriptionEffectiveStatementImpl(final StmtContext<String, DescriptionStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index 6365a71552387f0312718cbc70df80b828b512b9..13dd2627923fdcea3563b60deb2cbee6bea9c819 100644 (file)
@@ -11,10 +11,8 @@ import org.opendaylight.yangtools.yang.model.api.Deviation;
 import org.opendaylight.yangtools.yang.model.api.stmt.DeviateStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class DeviateEffectiveStatementImpl extends
-        EffectiveStatementBase<Deviation.Deviate, DeviateStatement> {
-    public DeviateEffectiveStatementImpl(
-            StmtContext<Deviation.Deviate, DeviateStatement, ?> ctx) {
+public class DeviateEffectiveStatementImpl extends EffectiveStatementBase<Deviation.Deviate, DeviateStatement> {
+    public DeviateEffectiveStatementImpl(final StmtContext<Deviation.Deviate, DeviateStatement, ?> ctx) {
         super(ctx);
     }
 }
\ No newline at end of file
index 88684db129bb70629539c2e99909b77ccfb59251..2b439a13e91f9a0830c031fd24c551f1c585cbf6 100644 (file)
@@ -23,12 +23,12 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 public class DeviationEffectiveStatementImpl extends EffectiveStatementBase<SchemaNodeIdentifier, DeviationStatement>
         implements Deviation, Immutable {
 
-    private SchemaPath targetPath;
+    private final SchemaPath targetPath;
     private Deviate deviate;
     private String reference;
-    private ImmutableList<UnknownSchemaNode> unknownSchemaNodes;
+    private final ImmutableList<UnknownSchemaNode> unknownSchemaNodes;
 
-    public DeviationEffectiveStatementImpl(StmtContext<SchemaNodeIdentifier, DeviationStatement, ?> ctx) {
+    public DeviationEffectiveStatementImpl(final StmtContext<SchemaNodeIdentifier, DeviationStatement, ?> ctx) {
         super(ctx);
 
         List<UnknownSchemaNode> unknownSchemaNodesInit = new LinkedList<>();
@@ -82,7 +82,7 @@ public class DeviationEffectiveStatementImpl extends EffectiveStatementBase<Sche
     }
 
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (this == obj) {
             return true;
         }
@@ -93,25 +93,13 @@ public class DeviationEffectiveStatementImpl extends EffectiveStatementBase<Sche
             return false;
         }
         DeviationEffectiveStatementImpl other = (DeviationEffectiveStatementImpl) obj;
-        if (targetPath == null) {
-            if (other.targetPath != null) {
-                return false;
-            }
-        } else if (!targetPath.equals(other.targetPath)) {
+        if (!Objects.equals(targetPath, other.targetPath)) {
             return false;
         }
-        if (deviate == null) {
-            if (other.deviate != null) {
-                return false;
-            }
-        } else if (!deviate.equals(other.deviate)) {
+        if (!Objects.equals(deviate, other.deviate)) {
             return false;
         }
-        if (reference == null) {
-            if (other.reference != null) {
-                return false;
-            }
-        } else if (!reference.equals(other.reference)) {
+        if (!Objects.equals(reference, other.reference)) {
             return false;
         }
         return true;
index 3036302b4127734688a152209fc4fccc1f86e394..258f44250ace01348fdf32becd6b029d3ecae609 100644 (file)
@@ -22,7 +22,7 @@ public class EffectiveConstraintDefinitionImpl implements ConstraintDefinition {
     private final Integer minElements;
     private final Integer maxElements;
 
-    public EffectiveConstraintDefinitionImpl(EffectiveStatementBase<?, ?> parent) {
+    public EffectiveConstraintDefinitionImpl(final EffectiveStatementBase<?, ?> parent) {
 
         MandatoryEffectiveStatementImpl firstMandatoryStmt = parent
                 .firstEffective(MandatoryEffectiveStatementImpl.class);
@@ -97,35 +97,19 @@ public class EffectiveConstraintDefinitionImpl implements ConstraintDefinition {
             return false;
         }
         EffectiveConstraintDefinitionImpl other = (EffectiveConstraintDefinitionImpl) obj;
-        if (whenCondition == null) {
-            if (other.whenCondition != null) {
-                return false;
-            }
-        } else if (!whenCondition.equals(other.whenCondition)) {
+        if (!mandatory.equals(other.mandatory)) {
             return false;
         }
-        if (mustConstraints == null) {
-            if (other.mustConstraints != null) {
-                return false;
-            }
-        } else if (!mustConstraints.equals(other.mustConstraints)) {
+        if (!Objects.equals(whenCondition, other.whenCondition)) {
             return false;
         }
-        if (!mandatory.equals(other.mandatory)) {
+        if (!Objects.equals(mustConstraints, other.mustConstraints)) {
             return false;
         }
-        if (minElements == null) {
-            if (other.minElements != null) {
-                return false;
-            }
-        } else if (!minElements.equals(other.minElements)) {
+        if (!Objects.equals(minElements, other.minElements)) {
             return false;
         }
-        if (maxElements == null) {
-            if (other.maxElements != null) {
-                return false;
-            }
-        } else if (!maxElements.equals(other.maxElements)) {
+        if (!Objects.equals(maxElements, other.maxElements)) {
             return false;
         }
         return true;
@@ -133,8 +117,7 @@ public class EffectiveConstraintDefinitionImpl implements ConstraintDefinition {
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder(
-                EffectiveConstraintDefinitionImpl.class.getSimpleName());
+        StringBuilder sb = new StringBuilder(EffectiveConstraintDefinitionImpl.class.getSimpleName());
         sb.append("[");
         sb.append("whenCondition=").append(whenCondition);
         sb.append(", mustConstraints=").append(mustConstraints);
index 031d4cb87911c0eee8805356e7b4de65cb281db1..3de0b1eafaff9c621d82d4d122da1388f8dba6fe 100644 (file)
@@ -7,28 +7,27 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
-import java.util.HashMap;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-import com.google.common.collect.ImmutableMap;
-import java.util.LinkedHashMap;
-import org.opendaylight.yangtools.yang.parser.util.ModuleDependencySort;
-import java.util.HashSet;
 import com.google.common.collect.ImmutableList;
-import java.util.List;
-import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ImmutableSetMultimap;
 import com.google.common.collect.Multimaps;
 import com.google.common.collect.SetMultimap;
 import java.net.URI;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.util.ModuleDependencySort;
 
 public class EffectiveSchemaContext extends AbstractEffectiveSchemaContext {
 
@@ -40,13 +39,10 @@ public class EffectiveSchemaContext extends AbstractEffectiveSchemaContext {
     private final ImmutableList<DeclaredStatement<?>> rootDeclaredStatements;
     private final ImmutableList<EffectiveStatement<?, ?>> rootEffectiveStatements;
 
-    public EffectiveSchemaContext(
-            List<DeclaredStatement<?>> rootDeclaredStatements,
-            List<EffectiveStatement<?, ?>> rootEffectiveStatements) {
-        this.rootDeclaredStatements = ImmutableList
-                .copyOf(rootDeclaredStatements);
-        this.rootEffectiveStatements = ImmutableList
-                .copyOf(rootEffectiveStatements);
+    public EffectiveSchemaContext(final List<DeclaredStatement<?>> rootDeclaredStatements,
+            final List<EffectiveStatement<?, ?>> rootEffectiveStatements) {
+        this.rootDeclaredStatements = ImmutableList.copyOf(rootDeclaredStatements);
+        this.rootEffectiveStatements = ImmutableList.copyOf(rootEffectiveStatements);
 
         Set<Module> modulesInit = new HashSet<>();
         for (EffectiveStatement<?, ?> rootEffectiveStatement : rootEffectiveStatements) {
@@ -130,31 +126,26 @@ public class EffectiveSchemaContext extends AbstractEffectiveSchemaContext {
 
     @Override
     protected Map<ModuleIdentifier, String> getIdentifiersToSources() {
-
         return identifiersToSources;
     }
 
     @Override
     public Set<Module> getModules() {
-
         return modules;
     }
 
     @Override
     protected SetMultimap<URI, Module> getNamespaceToModules() {
-
         return namespaceToModules;
     }
 
     @Override
     protected SetMultimap<String, Module> getNameToModules() {
-
         return nameToModules;
     }
 
     @Override
     public String toString() {
-
         return String.format("SchemaContextImpl{modules=%s}", modules);
     }
 }
index cebfc0d924f04fd6f74d8ad5e8bf79969cb9e5d8..b07669b1cc9b05c723a30ea0f76d49d0c29250ef 100644 (file)
@@ -28,16 +28,13 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
 
-abstract public class EffectiveStatementBase<A, D extends DeclaredStatement<A>>
-        implements EffectiveStatement<A, D> {
-
+abstract public class EffectiveStatementBase<A, D extends DeclaredStatement<A>> implements EffectiveStatement<A, D> {
     private final StmtContext<A, D, ?> stmtCtx;
     private final ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
     private final StatementSource statementSource;
     private final StatementDefinition statementDefinition;
-    private D declaredInstance;
-
     private final A argument;
+    private D declaredInstance;
 
     public EffectiveStatementBase(final StmtContext<A, D, ?> ctx) {
 
@@ -46,10 +43,8 @@ abstract public class EffectiveStatementBase<A, D extends DeclaredStatement<A>>
         this.argument = ctx.getStatementArgument();
         this.statementSource = ctx.getStatementSource();
 
-        Collection<StatementContextBase<?, ?, ?>> declaredSubstatements = ctx
-                .declaredSubstatements();
-        Collection<StatementContextBase<?, ?, ?>> effectiveSubstatements = ctx
-                .effectiveSubstatements();
+        Collection<StatementContextBase<?, ?, ?>> declaredSubstatements = ctx.declaredSubstatements();
+        Collection<StatementContextBase<?, ?, ?>> effectiveSubstatements = ctx.effectiveSubstatements();
 
         Collection<StatementContextBase<?, ?, ?>> substatementsInit = new LinkedList<>();
 
@@ -94,14 +89,12 @@ abstract public class EffectiveStatementBase<A, D extends DeclaredStatement<A>>
     }
 
     @Override
-    public <K, V, N extends IdentifierNamespace<K, V>> V get(
-            final Class<N> namespace, final K identifier) {
+    public <K, V, N extends IdentifierNamespace<K, V>> V get(final Class<N> namespace, final K identifier) {
         return stmtCtx.getFromNamespace(namespace, identifier);
     }
 
     @Override
-    public <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(
-            final Class<N> namespace) {
+    public <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(final Class<N> namespace) {
         return stmtCtx.getAllFromNamespace(namespace);
     }
 
@@ -114,12 +107,10 @@ abstract public class EffectiveStatementBase<A, D extends DeclaredStatement<A>>
         return stmtCtx;
     }
 
-    protected final <S extends EffectiveStatement<?, ?>> S firstEffective(
-            final Class<S> type) {
+    protected final <S extends EffectiveStatement<?, ?>> S firstEffective(final Class<S> type) {
         S result = null;
         try {
-            result = type.cast(Iterables.find(substatements,
-                    Predicates.instanceOf(type)));
+            result = type.cast(Iterables.find(substatements, Predicates.instanceOf(type)));
         } catch (NoSuchElementException e) {
             result = null;
         }
@@ -129,8 +120,7 @@ abstract public class EffectiveStatementBase<A, D extends DeclaredStatement<A>>
     protected final <S extends SchemaNode> S firstSchemaNode(final Class<S> type) {
         S result = null;
         try {
-            result = type.cast(Iterables.find(substatements,
-                    Predicates.instanceOf(type)));
+            result = type.cast(Iterables.find(substatements, Predicates.instanceOf(type)));
         } catch (NoSuchElementException e) {
             result = null;
         }
@@ -138,13 +128,11 @@ abstract public class EffectiveStatementBase<A, D extends DeclaredStatement<A>>
     }
 
     @SuppressWarnings("unchecked")
-    protected final <T> Collection<T> allSubstatementsOfType(
-            final Class<T> type) {
+    protected final <T> Collection<T> allSubstatementsOfType(final Class<T> type) {
         Collection<T> result = null;
 
         try {
-            result = Collection.class.cast(Collections2.filter(substatements,
-                    Predicates.instanceOf(type)));
+            result = Collection.class.cast(Collections2.filter(substatements, Predicates.instanceOf(type)));
         } catch (NoSuchElementException e) {
             result = Collections.emptyList();
         }
@@ -154,26 +142,21 @@ abstract public class EffectiveStatementBase<A, D extends DeclaredStatement<A>>
     protected final <T> T firstSubstatementOfType(final Class<T> type) {
         T result = null;
         try {
-            result = type.cast(Iterables.find(substatements,
-                    Predicates.instanceOf(type)));
+            result = type.cast(Iterables.find(substatements, Predicates.instanceOf(type)));
         } catch (NoSuchElementException e) {
             result = null;
         }
         return result;
     }
 
-    protected final <R> R firstSubstatementOfType(final Class<?> type,
-            final Class<R> returnType) {
+    protected final <R> R firstSubstatementOfType(final Class<?> type, final Class<R> returnType) {
         R result = null;
         try {
-            result = returnType.cast(Iterables.find(
-                    substatements,
-                    Predicates.and(Predicates.instanceOf(type),
-                            Predicates.instanceOf(returnType))));
+            result = returnType.cast(Iterables.find(substatements,
+                    Predicates.and(Predicates.instanceOf(type), Predicates.instanceOf(returnType))));
         } catch (NoSuchElementException e) {
             result = null;
         }
         return result;
     }
-
 }
index a26d2c14d9deb0f663f1c9f5e910d4996aa306d7..725dc742ff21883058c67f2b77f2f725512d3ab2 100644 (file)
@@ -9,19 +9,17 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
 public class EffectiveStmtUtils {
 
-    private EffectiveStmtUtils(){
+    private EffectiveStmtUtils() {
         throw new UnsupportedOperationException("Utility class");
     }
 
-    public static final SourceException createNameCollisionSourceException(
-            final StmtContext<?, ?, ?> ctx,
-            EffectiveStatement<?, ?> effectiveStatement) {
+    public static final SourceException createNameCollisionSourceException(final StmtContext<?, ?, ?> ctx,
+            final EffectiveStatement<?, ?> effectiveStatement) {
         return new SourceException("Error in module '"
                 + ctx.getRoot().getStatementArgument()
                 + "': can not add '"
index fbd7efde7b044d24be8e80d62deced7fbb3e3160..1d46cc1613ad80c9f10c471d0f7d0f9b887c8312 100644 (file)
@@ -10,13 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class ErrorAppTagEffectiveStatementImpl extends
-        EffectiveStatementBase<String, ErrorAppTagStatement> {
-
-    public ErrorAppTagEffectiveStatementImpl(
-            StmtContext<String, ErrorAppTagStatement, ?> ctx) {
+public class ErrorAppTagEffectiveStatementImpl extends EffectiveStatementBase<String, ErrorAppTagStatement> {
+    public ErrorAppTagEffectiveStatementImpl(final StmtContext<String, ErrorAppTagStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 6f2a749bdb1ce7fda85e0c7c9a72f48829d2c376..acf6763a9e6ba11c7906fd2ae4ac78f6e5a3c95b 100644 (file)
@@ -10,13 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class ErrorMessageEffectiveStatementImpl extends
-        EffectiveStatementBase<String, ErrorMessageStatement> {
-
-    public ErrorMessageEffectiveStatementImpl(
-            StmtContext<String, ErrorMessageStatement, ?> ctx) {
+public class ErrorMessageEffectiveStatementImpl extends EffectiveStatementBase<String, ErrorMessageStatement> {
+    public ErrorMessageEffectiveStatementImpl(final StmtContext<String, ErrorMessageStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 9c067fbea0a7eefaea08d55b71f2eefdb8203ff9..ba1a9ad6753e332235cf2017b253f52393660bce 100644 (file)
@@ -73,8 +73,8 @@ public class ExtendedTypeEffectiveStatementImpl extends EffectiveStatementBase<S
         this.isExtended = isExtended;
         qName = initQName(ctx, isExtended);
 
-        final StmtContext<?, TypedefStatement, EffectiveStatement<QName, TypedefStatement>> typeStmt = ctx
-                .getFromNamespace(TypeNamespace.class, qName);
+        final StmtContext<?, TypedefStatement, EffectiveStatement<QName, TypedefStatement>> typeStmt =
+                ctx.getFromNamespace(TypeNamespace.class, qName);
         if (typeStmt == null) {
             path = Utils.getSchemaPath(ctx);
         } else {
index 51f4bec5d1927da36a1fed29a5a0289b65020537..a73b90404147ca848f4d533fbc97698b70979c8b 100644 (file)
@@ -14,25 +14,24 @@ import java.util.List;
 import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.ExtensionStatement;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ExtensionStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
-public class ExtensionEffectiveStatementImpl extends
-        AbstractEffectiveDocumentedNode<QName, ExtensionStatement> implements
-        ExtensionDefinition {
+public class ExtensionEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<QName, ExtensionStatement>
+        implements ExtensionDefinition {
     private final QName qname;
-    String argument;
+    private String argument;
     private final SchemaPath schemaPath;
 
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-    boolean yin;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
+    private boolean yin;
 
     public ExtensionEffectiveStatementImpl(
-            StmtContext<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> ctx) {
+            final StmtContext<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> ctx) {
         super(ctx);
 
         this.qname = ctx.getStatementArgument();
@@ -40,7 +39,6 @@ public class ExtensionEffectiveStatementImpl extends
 
         initSubstatementCollections();
         initFields();
-
     }
 
     private void initFields() {
@@ -121,27 +119,12 @@ public class ExtensionEffectiveStatementImpl extends
             return false;
         }
         ExtensionEffectiveStatementImpl other = (ExtensionEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(schemaPath, other.schemaPath);
     }
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder(
-                ExtensionEffectiveStatementImpl.class.getSimpleName());
+        StringBuilder sb = new StringBuilder(ExtensionEffectiveStatementImpl.class.getSimpleName());
         sb.append("[");
         sb.append("argument=").append(argument);
         sb.append(", qname=").append(qname);
index a30457a2682f0368f3cb2c049bf6443045265cba..40aae1d7c96bed8ad0cfeec76795ba1a9ac7cf9d 100644 (file)
@@ -13,25 +13,25 @@ import java.util.List;
 import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.stmt.FeatureStatement;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.FeatureStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
 public class FeatureEffectiveStatementImpl extends EffectiveStatementBase<QName, FeatureStatement> implements
         FeatureDefinition {
 
-    private QName qName;
-    private SchemaPath path;
+    private final QName qName;
+    private final SchemaPath path;
     private List<UnknownSchemaNode> unknownSchemaNodes;
     private String description;
     private String reference;
     private Status status;
 
-    public FeatureEffectiveStatementImpl(StmtContext<QName, FeatureStatement, ?> ctx) {
+    public FeatureEffectiveStatementImpl(final StmtContext<QName, FeatureStatement, ?> ctx) {
         super(ctx);
 
         this.qName = ctx.getStatementArgument();
@@ -114,21 +114,7 @@ public class FeatureEffectiveStatementImpl extends EffectiveStatementBase<QName,
             return false;
         }
         FeatureEffectiveStatementImpl other = (FeatureEffectiveStatementImpl) obj;
-        if (qName == null) {
-            if (other.qName != null) {
-                return false;
-            }
-        } else if (!qName.equals(other.qName)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qName, other.qName) && Objects.equals(path, other.path);
     }
 
     @Override
index 910952dcbfb6346132a760fd8096382e99eb085e..67d568d1c5ac1fd2e82610c41b0f16cb991201d6 100644 (file)
@@ -10,13 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class FractionDigitsEffectiveStatementImpl extends
-        EffectiveStatementBase<Integer, FractionDigitsStatement> {
-
-    public FractionDigitsEffectiveStatementImpl(
-            StmtContext<Integer, FractionDigitsStatement, ?> ctx) {
+public class FractionDigitsEffectiveStatementImpl extends EffectiveStatementBase<Integer, FractionDigitsStatement> {
+    public FractionDigitsEffectiveStatementImpl(final StmtContext<Integer, FractionDigitsStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 9a337d271390e871c34f0d446c9898179e34ee92..b5c95cd82e954b8702fdf95e340b1bf071e8af2b 100644 (file)
@@ -31,7 +31,7 @@ public class GroupingEffectiveStatementImpl extends
     private List<UnknownSchemaNode> unknownNodes;
 
     public GroupingEffectiveStatementImpl(
-            StmtContext<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> ctx) {
+            final StmtContext<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> ctx) {
         super(ctx);
 
         qname = ctx.getStatementArgument();
@@ -42,11 +42,11 @@ public class GroupingEffectiveStatementImpl extends
     }
 
     private void initCopyType(
-            StmtContext<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> ctx) {
+            final StmtContext<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
 
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
             addedByUses = true;
         }
     }
@@ -62,7 +62,6 @@ public class GroupingEffectiveStatementImpl extends
                 unknownNodes.add(unknownNode);
             }
         }
-
     }
 
     @Override
@@ -106,21 +105,7 @@ public class GroupingEffectiveStatementImpl extends
             return false;
         }
         final GroupingEffectiveStatementImpl other = (GroupingEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
index b4434853808fbf5913526e4ff41d259918624623..4228e9482db02b44e4b5ac801987cd8b5d0b39d9 100644 (file)
@@ -18,26 +18,24 @@ import java.util.Objects;
 import java.util.Set;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.IdentityStatement;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IdentityStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.DerivedIdentitiesNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
-public class IdentityEffectiveStatementImpl extends
-        AbstractEffectiveDocumentedNode<QName, IdentityStatement> implements
-        IdentitySchemaNode {
+public class IdentityEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<QName, IdentityStatement>
+        implements IdentitySchemaNode {
     private final QName qname;
     private final SchemaPath path;
-    IdentitySchemaNode baseIdentity;
+    private IdentitySchemaNode baseIdentity;
     private ImmutableSet<IdentitySchemaNode> derivedIdentities;
-
-    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
 
     public IdentityEffectiveStatementImpl(
-            StmtContext<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> ctx) {
+            final StmtContext<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> ctx) {
         super(ctx);
 
         this.qname = ctx.getStatementArgument();
@@ -48,13 +46,13 @@ public class IdentityEffectiveStatementImpl extends
     }
 
     private void initDerivedIdentities(
-            StmtContext<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> ctx) {
+            final StmtContext<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> ctx) {
 
         Set<IdentitySchemaNode> derivedIdentitiesInit = new HashSet<IdentitySchemaNode>();
         List<StmtContext<?, ?, ?>> derivedIdentitiesCtxList = ctx.getFromNamespace(
                 DerivedIdentitiesNamespace.class, ctx.getStatementArgument());
 
-        if(derivedIdentitiesCtxList == null) {
+        if (derivedIdentitiesCtxList == null) {
             this.derivedIdentities = ImmutableSet.of();
             return;
         }
@@ -68,7 +66,7 @@ public class IdentityEffectiveStatementImpl extends
         this.derivedIdentities = ImmutableSet.copyOf(derivedIdentitiesInit);
     }
 
-    private void initBaseIdentity(IdentityEffectiveStatementImpl baseIdentity) {
+    private void initBaseIdentity(final IdentityEffectiveStatementImpl baseIdentity) {
         this.baseIdentity = baseIdentity;
     }
 
@@ -133,21 +131,7 @@ public class IdentityEffectiveStatementImpl extends
             return false;
         }
         IdentityEffectiveStatementImpl other = (IdentityEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
index 70d3e9cdd7465e45af04c62543fb926eccfcad75..903d55f5e44609bef403679ddf4156ab20ea2f0e 100644 (file)
@@ -11,13 +11,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class IfFeatureEffectiveStatementImpl extends
-        EffectiveStatementBase<QName, IfFeatureStatement> {
-
-    public IfFeatureEffectiveStatementImpl(
-            StmtContext<QName, IfFeatureStatement, ?> ctx) {
+public class IfFeatureEffectiveStatementImpl extends EffectiveStatementBase<QName, IfFeatureStatement> {
+    public IfFeatureEffectiveStatementImpl(final StmtContext<QName, IfFeatureStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index c9a2d2c3590293445a050860ea1489be176c9ef1..4462819ef6e6a65d9b441f4a910e3d1af78e3201 100644 (file)
@@ -7,10 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
-
 import java.util.Date;
 import java.util.Objects;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ImportStatement;
@@ -19,11 +18,11 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 public class ImportEffectiveStatementImpl extends EffectiveStatementBase<String, ImportStatement> implements
         ModuleImport {
 
-    private String moduleName;
+    private final String moduleName;
     private Date revision;
     private String prefix;
 
-    public ImportEffectiveStatementImpl(StmtContext<String, ImportStatement, ?> ctx) {
+    public ImportEffectiveStatementImpl(final StmtContext<String, ImportStatement, ?> ctx) {
         super(ctx);
 
         moduleName = ctx.getStatementArgument();
@@ -65,7 +64,7 @@ public class ImportEffectiveStatementImpl extends EffectiveStatementBase<String,
     }
 
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (this == obj) {
             return true;
         }
@@ -76,25 +75,13 @@ public class ImportEffectiveStatementImpl extends EffectiveStatementBase<String,
             return false;
         }
         ImportEffectiveStatementImpl other = (ImportEffectiveStatementImpl) obj;
-        if (getModuleName() == null) {
-            if (other.getModuleName() != null) {
-                return false;
-            }
-        } else if (!getModuleName().equals(other.getModuleName())) {
+        if (!Objects.equals(getModuleName(), other.getModuleName())) {
             return false;
         }
-        if (getRevision() == null) {
-            if (other.getRevision() != null) {
-                return false;
-            }
-        } else if (!getRevision().equals(other.getRevision())) {
+        if (!Objects.equals(getRevision(), other.getRevision())) {
             return false;
         }
-        if (getPrefix() == null) {
-            if (other.getPrefix() != null) {
-                return false;
-            }
-        } else if (!getPrefix().equals(other.getPrefix())) {
+        if (!Objects.equals(getPrefix(), other.getPrefix())) {
             return false;
         }
         return true;
index addb6047c5b3e9ffc492ab0e813b619fd3b085f4..b68bd5a8908118d3cbd0f09ad714b8e10c12fb04 100644 (file)
@@ -10,12 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class IncludeEffectiveStatementImpl extends
-        EffectiveStatementBase<String, IncludeStatement> {
-
-    public IncludeEffectiveStatementImpl(
-            StmtContext<String, IncludeStatement, ?> ctx) {
+public class IncludeEffectiveStatementImpl extends EffectiveStatementBase<String, IncludeStatement> {
+    public IncludeEffectiveStatementImpl(final StmtContext<String, IncludeStatement, ?> ctx) {
         super(ctx);
     }
-
 }
\ No newline at end of file
index 9d53810150a67b276bdf6b7f7acb55be9132b873..b0fb26780e932be15d59a1f970a564aed7738cf0 100644 (file)
@@ -19,10 +19,10 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.InputStatement;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.InputStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.TypeOfCopy;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
@@ -35,41 +35,38 @@ public class InputEffectiveStatementImpl extends
     private final SchemaPath path;
     private final boolean presence;
 
-    boolean augmenting;
-    boolean addedByUses;
-    boolean configuration = true;
-    ContainerSchemaNode original;
-    ConstraintDefinition constraints;
+    private boolean augmenting;
+    private boolean addedByUses;
+    private boolean configuration = true;
+    private ContainerSchemaNode original;
+    private final ConstraintDefinition constraints;
 
     private ImmutableSet<AugmentationSchema> augmentations;
     private ImmutableList<UnknownSchemaNode> unknownNodes;
 
     public InputEffectiveStatementImpl(
-            StmtContext<QName, InputStatement, EffectiveStatement<QName, InputStatement>> ctx) {
+            final StmtContext<QName, InputStatement, EffectiveStatement<QName, InputStatement>> ctx) {
         super(ctx);
 
         qname = ctx.getStatementArgument();
         path = Utils.getSchemaPath(ctx);
-        presence = (firstEffective(PresenceEffectiveStatementImpl.class) == null) ? false
-                : true;
+        presence = firstEffective(PresenceEffectiveStatementImpl.class) != null;
         this.constraints = new EffectiveConstraintDefinitionImpl(this);
 
         initSubstatementCollectionsAndFields();
         initCopyType(ctx);
     }
 
-    private void initCopyType(
-            StmtContext<QName, InputStatement, EffectiveStatement<QName, InputStatement>> ctx) {
+    private void initCopyType(final StmtContext<QName, InputStatement, EffectiveStatement<QName, InputStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
-
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
             augmenting = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
             addedByUses = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
             addedByUses = augmenting = true;
         }
 
@@ -94,8 +91,7 @@ public class InputEffectiveStatementImpl extends
                 AugmentationSchema augmentationSchema = (AugmentationSchema) effectiveStatement;
                 augmentationsInit.add(augmentationSchema);
             }
-            if (!configurationInit
-                    && effectiveStatement instanceof ConfigEffectiveStatementImpl) {
+            if (!configurationInit && effectiveStatement instanceof ConfigEffectiveStatementImpl) {
                 ConfigEffectiveStatementImpl configStmt = (ConfigEffectiveStatementImpl) effectiveStatement;
                 this.configuration = configStmt.argument();
                 configurationInit = true;
@@ -172,26 +168,11 @@ public class InputEffectiveStatementImpl extends
             return false;
         }
         InputEffectiveStatementImpl other = (InputEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
     public String toString() {
         return "RPC input " + qname.getLocalName();
     }
-
 }
index 4d61814de7ddbe2a94d60a1304cec493f8bff089..a0c23d9f4be717b3c20ab65f187960251db66f59 100644 (file)
@@ -8,17 +8,12 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import java.util.Collection;
-import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.KeyStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class KeyEffectiveStatementImpl extends
-        EffectiveStatementBase<Collection<SchemaNodeIdentifier>, KeyStatement> {
-
-    public KeyEffectiveStatementImpl(
-            StmtContext<Collection<SchemaNodeIdentifier>, KeyStatement, ?> ctx) {
+public class KeyEffectiveStatementImpl extends EffectiveStatementBase<Collection<SchemaNodeIdentifier>, KeyStatement> {
+    public KeyEffectiveStatementImpl(final StmtContext<Collection<SchemaNodeIdentifier>, KeyStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index 60c3384017093d666342536d9aa0d0648c24116a..9590f292ed5faa4d5dc429684cd3f62c3b7ba6c7 100644 (file)
@@ -17,11 +17,11 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.LeafStatement;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.LeafStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.TypeOfCopy;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils;
@@ -32,18 +32,19 @@ public class LeafEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<
     private final QName qname;
     private final SchemaPath path;
 
+    // FIXME: should be private
     boolean augmenting;
     private boolean addedByUses;
     private LeafSchemaNode original;
     private boolean configuration = true;
-    private ConstraintDefinition constraintsDef;
+    private final ConstraintDefinition constraintsDef;
     private TypeDefinition<?> type;
     private String defaultStr;
     private String unitsStr;
 
     private ImmutableList<UnknownSchemaNode> unknownNodes;
 
-    public LeafEffectiveStatementImpl(StmtContext<QName, LeafStatement, EffectiveStatement<QName, LeafStatement>> ctx) {
+    public LeafEffectiveStatementImpl(final StmtContext<QName, LeafStatement, EffectiveStatement<QName, LeafStatement>> ctx) {
         super(ctx);
         this.qname = ctx.getStatementArgument();
         this.path = Utils.getSchemaPath(ctx);
@@ -54,20 +55,19 @@ public class LeafEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<
     }
 
     private void initCopyType(
-            StmtContext<QName, LeafStatement, EffectiveStatement<QName, LeafStatement>> ctx) {
+            final StmtContext<QName, LeafStatement, EffectiveStatement<QName, LeafStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
 
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
             augmenting = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
             addedByUses = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
             addedByUses = augmenting = true;
         }
-
         if (ctx.getOriginalCtx() != null) {
             original = (LeafSchemaNode) ctx.getOriginalCtx().buildEffective();
         }
@@ -185,21 +185,7 @@ public class LeafEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<
             return false;
         }
         LeafEffectiveStatementImpl other = (LeafEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
index 96bc2ef825ac2e743a94a443cb9205365944d2c2..92cb8de401392849c5c4c9f4b6139008efbab837 100644 (file)
@@ -17,11 +17,11 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.LeafListStatement;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.LeafListStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.TypeOfCopy;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils;
@@ -32,18 +32,19 @@ public class LeafListEffectiveStatementImpl extends AbstractEffectiveDocumentedN
     private final QName qname;
     private final SchemaPath path;
 
+    // FIXME: should be private
     boolean augmenting;
     private boolean addedByUses;
     private LeafListSchemaNode original;
     private boolean configuration = true;
-    private ConstraintDefinition constraintsDef;
+    private final ConstraintDefinition constraintsDef;
     private TypeDefinition<?> type;
     private boolean userOrdered;
 
     private ImmutableList<UnknownSchemaNode> unknownNodes;
 
     public LeafListEffectiveStatementImpl(
-            StmtContext<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> ctx) {
+            final StmtContext<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> ctx) {
         super(ctx);
         this.qname = ctx.getStatementArgument();
         this.path = Utils.getSchemaPath(ctx);
@@ -56,17 +57,17 @@ public class LeafListEffectiveStatementImpl extends AbstractEffectiveDocumentedN
     }
 
     private void initCopyType(
-            StmtContext<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> ctx) {
+            final StmtContext<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
 
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
             augmenting = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
             addedByUses = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
             addedByUses = augmenting = true;
         }
 
@@ -174,21 +175,7 @@ public class LeafListEffectiveStatementImpl extends AbstractEffectiveDocumentedN
             return false;
         }
         LeafListEffectiveStatementImpl other = (LeafListEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
index 303604f5d2f7df1637732e1790af68fb5f337b50..017dfe0615874202be1fbcc0691a814612dbeaf6 100644 (file)
@@ -23,11 +23,11 @@ import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ListStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.TypeOfCopy;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
@@ -37,18 +37,19 @@ public class ListEffectiveStatementImpl extends AbstractEffectiveDocumentedDataN
     private final QName qname;
     private final SchemaPath path;
 
+    // FIXME: should be private
     boolean augmenting;
     private boolean addedByUses;
-    ListSchemaNode original;
-    boolean configuration = true;
-    ConstraintDefinition constraints;
-    boolean userOrdered;
+    private ListSchemaNode original;
+    private boolean configuration = true;
+    private final ConstraintDefinition constraints;
+    private boolean userOrdered;
 
-    ImmutableList<QName> keyDefinition;
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private ImmutableList<QName> keyDefinition;
+    private ImmutableSet<AugmentationSchema> augmentations;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
 
-    public ListEffectiveStatementImpl(StmtContext<QName, ListStatement, EffectiveStatement<QName, ListStatement>> ctx) {
+    public ListEffectiveStatementImpl(final StmtContext<QName, ListStatement, EffectiveStatement<QName, ListStatement>> ctx) {
         super(ctx);
         this.qname = ctx.getStatementArgument();
         this.path = Utils.getSchemaPath(ctx);
@@ -61,27 +62,25 @@ public class ListEffectiveStatementImpl extends AbstractEffectiveDocumentedDataN
         initKeyDefinition(ctx);
     }
 
-    private void initCopyType(
-            StmtContext<QName, ListStatement, EffectiveStatement<QName, ListStatement>> ctx) {
+    private void initCopyType(final StmtContext<QName, ListStatement, EffectiveStatement<QName, ListStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
 
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
             augmenting = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
             addedByUses = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
             addedByUses = augmenting = true;
         }
-
         if (ctx.getOriginalCtx() != null) {
             original = (ListSchemaNode) ctx.getOriginalCtx().buildEffective();
         }
     }
 
-    private void initKeyDefinition(StmtContext<QName, ListStatement, EffectiveStatement<QName, ListStatement>> ctx) {
+    private void initKeyDefinition(final StmtContext<QName, ListStatement, EffectiveStatement<QName, ListStatement>> ctx) {
         List<QName> keyDefinitionInit = new LinkedList<>();
         KeyEffectiveStatementImpl keyEffectiveSubstatement = firstEffective(KeyEffectiveStatementImpl.class);
 
@@ -220,21 +219,7 @@ public class ListEffectiveStatementImpl extends AbstractEffectiveDocumentedDataN
             return false;
         }
         final ListEffectiveStatementImpl other = (ListEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
index 408c97fff451ac8e2a8521f69d8e1259fecab1b8..bcd8e8cb8783845e69964b96c0b6d1c232c59eed 100644 (file)
@@ -10,13 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class MandatoryEffectiveStatementImpl extends
-        EffectiveStatementBase<Boolean, MandatoryStatement> {
-
-    public MandatoryEffectiveStatementImpl(
-            StmtContext<Boolean, MandatoryStatement, ?> ctx) {
+public class MandatoryEffectiveStatementImpl extends EffectiveStatementBase<Boolean, MandatoryStatement> {
+    public MandatoryEffectiveStatementImpl(final StmtContext<Boolean, MandatoryStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 7055f74a7e81df48a786a8b172f96d4afe9c757d..ee58993cfa30caa19a8268a203b548fe459d455f 100644 (file)
@@ -10,13 +10,9 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class MaxElementsEffectiveStatementImpl extends
-        EffectiveStatementBase<String, MaxElementsStatement> {
-
-    public MaxElementsEffectiveStatementImpl(
-            StmtContext<String, MaxElementsStatement, ?> ctx) {
+public class MaxElementsEffectiveStatementImpl extends EffectiveStatementBase<String, MaxElementsStatement> {
+    public MaxElementsEffectiveStatementImpl(final StmtContext<String, MaxElementsStatement, ?> ctx) {
         super(ctx);
 
     }
-
 }
\ No newline at end of file
index 15819a43266d493d348a97346f0cbec0bd39f543..819ff549d8ece20dacaee3331d418af01b3d58bc 100644 (file)
@@ -10,13 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class MinElementsEffectiveStatementImpl extends
-        EffectiveStatementBase<Integer, MinElementsStatement> {
-
-    public MinElementsEffectiveStatementImpl(
-            StmtContext<Integer, MinElementsStatement, ?> ctx) {
+public class MinElementsEffectiveStatementImpl extends EffectiveStatementBase<Integer, MinElementsStatement> {
+    public MinElementsEffectiveStatementImpl(final StmtContext<Integer, MinElementsStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index e415ecbfda300771057084bbba7eb76e487b84bb..d92f2ba213549f4b190098ee2391d8dd96043a50 100644 (file)
@@ -53,8 +53,7 @@ import org.opendaylight.yangtools.yang.parser.spi.source.IncludedSubmoduleNameTo
 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleQName;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
-public class ModuleEffectiveStatementImpl extends
-        AbstractEffectiveDocumentedNode<String, ModuleStatement> implements
+public class ModuleEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<String, ModuleStatement> implements
         Module, Immutable {
 
     private final QNameModule qNameModule;
@@ -88,11 +87,9 @@ public class ModuleEffectiveStatementImpl extends
         super(ctx);
 
         name = argument();
-        QNameModule qNameModuleInit = ctx.getFromNamespace(
-                ModuleCtxToModuleQName.class, ctx);
-        qNameModule = qNameModuleInit.getRevision() == null ? QNameModule
-                .create(qNameModuleInit.getNamespace(),
-                        SimpleDateFormatUtil.DEFAULT_DATE_REV)
+        QNameModule qNameModuleInit = ctx.getFromNamespace( ModuleCtxToModuleQName.class, ctx);
+        qNameModule = qNameModuleInit.getRevision() == null
+                ? QNameModule.create(qNameModuleInit.getNamespace(), SimpleDateFormatUtil.DEFAULT_DATE_REV)
                 : qNameModuleInit;
 
         for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
@@ -138,8 +135,10 @@ public class ModuleEffectiveStatementImpl extends
         Set<Module> submodulesInit = new HashSet<>();
         List<EffectiveStatement<?, ?>> substatementsOfSubmodulesInit = new LinkedList<>();
         for (ModuleIdentifier submoduleIdentifier : includedSubmodules) {
-            Mutable<String, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>> submoduleCtx = (Mutable<String, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>>) ctx
-                    .getFromNamespace(SubmoduleNamespace.class, submoduleIdentifier);
+            @SuppressWarnings("unchecked")
+            Mutable<String, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>> submoduleCtx =
+                    (Mutable<String, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>>)
+                    ctx.getFromNamespace(SubmoduleNamespace.class, submoduleIdentifier);
             SubmoduleEffectiveStatementImpl submodule = (SubmoduleEffectiveStatementImpl) submoduleCtx
                     .buildEffective();
             submodulesInit.add(submodule);
@@ -208,9 +207,7 @@ public class ModuleEffectiveStatementImpl extends
                     mutableChildNodes.put(dataSchemaNode.getQName(), dataSchemaNode);
                     mutablePublicChildNodes.add(dataSchemaNode);
                 } else {
-                    throw EffectiveStmtUtils
-                            .createNameCollisionSourceException(ctx,
-                                    effectiveStatement);
+                    throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, effectiveStatement);
                 }
             }
             if (effectiveStatement instanceof UsesNode) {
@@ -218,9 +215,7 @@ public class ModuleEffectiveStatementImpl extends
                 if (!mutableUses.contains(usesNode)) {
                     mutableUses.add(usesNode);
                 } else {
-                    throw EffectiveStmtUtils
-                            .createNameCollisionSourceException(ctx,
-                                    effectiveStatement);
+                    throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, effectiveStatement);
                 }
             }
             if (effectiveStatement instanceof TypeDefEffectiveStatementImpl) {
@@ -229,9 +224,7 @@ public class ModuleEffectiveStatementImpl extends
                 if (!mutableTypeDefinitions.contains(extendedType)) {
                     mutableTypeDefinitions.add(extendedType);
                 } else {
-                    throw EffectiveStmtUtils
-                            .createNameCollisionSourceException(ctx,
-                                    effectiveStatement);
+                    throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, effectiveStatement);
                 }
             }
             if (effectiveStatement instanceof GroupingDefinition) {
@@ -239,17 +232,14 @@ public class ModuleEffectiveStatementImpl extends
                 if (!mutableGroupings.contains(grp)) {
                     mutableGroupings.add(grp);
                 } else {
-                    throw EffectiveStmtUtils
-                            .createNameCollisionSourceException(ctx,
-                                    effectiveStatement);
+                    throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, effectiveStatement);
                 }
             }
         }
 
         this.unknownNodes = ImmutableList.copyOf(unknownNodesInit);
         this.augmentations = ImmutableSet.copyOf(augmentationsInit);
-        this.imports = ImmutableSet.copyOf(resolveModuleImports(importsInit,
-                ctx));
+        this.imports = ImmutableSet.copyOf(resolveModuleImports(importsInit, ctx));
         this.notifications = ImmutableSet.copyOf(notificationsInit);
         this.rpcs = ImmutableSet.copyOf(rpcsInit);
         this.deviations = ImmutableSet.copyOf(deviationsInit);
@@ -264,8 +254,7 @@ public class ModuleEffectiveStatementImpl extends
         this.uses = ImmutableSet.copyOf(mutableUses);
     }
 
-    private static Set<ModuleImport> resolveModuleImports(
-            final Set<ModuleImport> importsInit,
+    private static Set<ModuleImport> resolveModuleImports(final Set<ModuleImport> importsInit,
             final StmtContext<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> ctx) {
         Set<ModuleImport> resolvedModuleImports = new LinkedHashSet<>();
         for (ModuleImport moduleImport : importsInit) {
@@ -442,21 +431,13 @@ public class ModuleEffectiveStatementImpl extends
             return false;
         }
         ModuleEffectiveStatementImpl other = (ModuleEffectiveStatementImpl) obj;
-        if (name == null) {
-            if (other.name != null) {
-                return false;
-            }
-        } else if (!name.equals(other.name)) {
+        if (!Objects.equals(name, other.name)) {
             return false;
         }
         if (!qNameModule.equals(other.qNameModule)) {
             return false;
         }
-        if (yangVersion == null) {
-            if (other.yangVersion != null) {
-                return false;
-            }
-        } else if (!yangVersion.equals(other.yangVersion)) {
+        if (!Objects.equals(yangVersion, other.yangVersion)) {
             return false;
         }
         return true;
@@ -464,8 +445,7 @@ public class ModuleEffectiveStatementImpl extends
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder(
-                ModuleEffectiveStatementImpl.class.getSimpleName());
+        StringBuilder sb = new StringBuilder(ModuleEffectiveStatementImpl.class.getSimpleName());
         sb.append("[");
         sb.append("name=").append(name);
         sb.append(", namespace=").append(getNamespace());
index bbb7437c236f3df0693f975cd3fb6c641c75be25..e8c9d4ac1e4b32fbffde66e716efc8b8e5fe73e7 100644 (file)
@@ -14,18 +14,16 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class MustEffectiveStatementImpl extends
-        EffectiveStatementBase<RevisionAwareXPath, MustStatement> implements
+public class MustEffectiveStatementImpl extends EffectiveStatementBase<RevisionAwareXPath, MustStatement> implements
         MustDefinition {
 
-    private RevisionAwareXPath xPath;
+    private final RevisionAwareXPath xPath;
     private String description;
     private String errorAppTag;
     private String errorMessage;
     private String reference;
 
-    public MustEffectiveStatementImpl(
-            StmtContext<RevisionAwareXPath, MustStatement, ?> ctx) {
+    public MustEffectiveStatementImpl(final StmtContext<RevisionAwareXPath, MustStatement, ?> ctx) {
         super(ctx);
 
         initFields();
@@ -99,25 +97,13 @@ public class MustEffectiveStatementImpl extends
             return false;
         }
         final MustEffectiveStatementImpl other = (MustEffectiveStatementImpl) obj;
-        if (xPath == null) {
-            if (other.xPath != null) {
-                return false;
-            }
-        } else if (!xPath.equals(other.xPath)) {
+        if (!Objects.equals(xPath, other.xPath)) {
             return false;
         }
-        if (description == null) {
-            if (other.description != null) {
-                return false;
-            }
-        } else if (!description.equals(other.description)) {
+        if (!Objects.equals(description, other.description)) {
             return false;
         }
-        if (reference == null) {
-            if (other.reference != null) {
-                return false;
-            }
-        } else if (!reference.equals(other.reference)) {
+        if (!Objects.equals(reference,other.reference)) {
             return false;
         }
         return true;
index 4d2be0f8029654507680f159a8bab7b1826d5c3b..3164a816c29072e234609130920374c8fe03460e 100644 (file)
@@ -8,15 +8,11 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import java.net.URI;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 public class NamespaceEffectiveStatementImpl extends EffectiveStatementBase<URI, NamespaceStatement>  {
-
-    public NamespaceEffectiveStatementImpl(
-            StmtContext<URI, NamespaceStatement, ?> ctx) {
+    public NamespaceEffectiveStatementImpl(final StmtContext<URI, NamespaceStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index a29dba00f669cddc10fc97a298877f961097b6a9..b89e34211a1511a5ce5e6cbeafc2d1289d9d8036 100644 (file)
@@ -17,11 +17,11 @@ import java.util.Objects;
 import java.util.Set;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.NotificationStatement;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.NotificationStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
@@ -30,11 +30,11 @@ public class NotificationEffectiveStatementImpl
         implements NotificationDefinition {
     private final QName qname;
     private final SchemaPath path;
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private Set<AugmentationSchema> augmentations;
+    private List<UnknownSchemaNode> unknownNodes;
 
     public NotificationEffectiveStatementImpl(
-            StmtContext<QName, NotificationStatement, EffectiveStatement<QName, NotificationStatement>> ctx) {
+            final StmtContext<QName, NotificationStatement, EffectiveStatement<QName, NotificationStatement>> ctx) {
         super(ctx);
         this.qname = ctx.getStatementArgument();
         this.path = Utils.getSchemaPath(ctx);
@@ -104,29 +104,13 @@ public class NotificationEffectiveStatementImpl
             return false;
         }
         final NotificationEffectiveStatementImpl other = (NotificationEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder(
-                NotificationEffectiveStatementImpl.class.getSimpleName());
-        sb.append("[qname=").append(qname).append(", path=").append(path)
-                .append("]");
+        StringBuilder sb = new StringBuilder(NotificationEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[qname=").append(qname).append(", path=").append(path).append("]");
         return sb.toString();
     }
 }
index 8189e90d077cf9c60a1a8b7dd4b107f37287ade9..41f5f410162ae59aaa91e2c8c6f6f92d0a3cb24f 100644 (file)
@@ -10,13 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class OrderedByEffectiveStatementImpl extends
-        EffectiveStatementBase<String, OrderedByStatement> {
-
-    public OrderedByEffectiveStatementImpl(
-            StmtContext<String, OrderedByStatement, ?> ctx) {
+public class OrderedByEffectiveStatementImpl extends EffectiveStatementBase<String, OrderedByStatement> {
+    public OrderedByEffectiveStatementImpl(final StmtContext<String, OrderedByStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 2dd08e1131f00dd339021c41de64ec289b4b40fd..16ef3c523a5c1a5568ae9d2439b0e9e0663b3c54 100644 (file)
@@ -10,13 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class OrganizationEffectiveStatementImpl extends
-EffectiveStatementBase<String, OrganizationStatement> {
-
-    public OrganizationEffectiveStatementImpl(
-            StmtContext<String, OrganizationStatement, ?> ctx) {
+public class OrganizationEffectiveStatementImpl extends EffectiveStatementBase<String, OrganizationStatement> {
+    public OrganizationEffectiveStatementImpl(final StmtContext<String, OrganizationStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 068596130b84238778f88c8f6e39114dd5190c22..ce7648c5fb612651741b7412d043371b1ffc8590 100644 (file)
@@ -19,39 +19,37 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.TypeOfCopy;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
-public class OutputEffectiveStatementImpl extends
-        AbstractEffectiveDocumentedDataNodeContainer<QName, OutputStatement>
+public class OutputEffectiveStatementImpl extends AbstractEffectiveDocumentedDataNodeContainer<QName, OutputStatement>
         implements ContainerSchemaNode {
 
     private final QName qname;
     private final SchemaPath path;
     private final boolean presence;
 
-    boolean augmenting;
-    boolean addedByUses;
-    boolean configuration = true;
-    ContainerSchemaNode original;
-    ConstraintDefinition constraints;
+    private boolean augmenting;
+    private boolean addedByUses;
+    private boolean configuration = true;
+    private ContainerSchemaNode original;
+    private final ConstraintDefinition constraints;
 
-    private ImmutableSet<AugmentationSchema> augmentations;
-    private ImmutableList<UnknownSchemaNode> unknownNodes;
+    private Set<AugmentationSchema> augmentations;
+    private List<UnknownSchemaNode> unknownNodes;
 
     public OutputEffectiveStatementImpl(
-            StmtContext<QName, OutputStatement, EffectiveStatement<QName, OutputStatement>> ctx) {
+            final StmtContext<QName, OutputStatement, EffectiveStatement<QName, OutputStatement>> ctx) {
         super(ctx);
 
         qname = ctx.getStatementArgument();
         path = Utils.getSchemaPath(ctx);
-        presence = (firstEffective(PresenceEffectiveStatementImpl.class) == null) ? false
-                : true;
+        presence = firstEffective(PresenceEffectiveStatementImpl.class) != null;
         this.constraints = new EffectiveConstraintDefinitionImpl(this);
 
         initSubstatementCollections();
@@ -59,20 +57,19 @@ public class OutputEffectiveStatementImpl extends
     }
 
     private void initCopyType(
-            StmtContext<QName, OutputStatement, EffectiveStatement<QName, OutputStatement>> ctx) {
+            final StmtContext<QName, OutputStatement, EffectiveStatement<QName, OutputStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
 
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION)) {
             augmenting = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
             addedByUses = true;
         }
-        if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
+        if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) {
             addedByUses = augmenting = true;
         }
-
         if (ctx.getOriginalCtx() != null) {
             original = (ContainerSchemaNode) ctx.getOriginalCtx().buildEffective();
         }
@@ -94,8 +91,7 @@ public class OutputEffectiveStatementImpl extends
                 AugmentationSchema augmentationSchema = (AugmentationSchema) effectiveStatement;
                 augmentationsInit.add(augmentationSchema);
             }
-            if (!configurationInit
-                    && effectiveStatement instanceof ConfigEffectiveStatementImpl) {
+            if (!configurationInit && effectiveStatement instanceof ConfigEffectiveStatementImpl) {
                 ConfigEffectiveStatementImpl configStmt = (ConfigEffectiveStatementImpl) effectiveStatement;
                 this.configuration = configStmt.argument();
                 configurationInit = true;
@@ -172,21 +168,7 @@ public class OutputEffectiveStatementImpl extends
             return false;
         }
         OutputEffectiveStatementImpl other = (OutputEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
index 5fa69b0aeb179b58069f36a4b7ba5854a7aeac1d..cfdd800606dd48168d30fcbbbf98504047f92b65 100644 (file)
@@ -11,13 +11,8 @@ import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
 import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class PathEffectiveStatementImpl extends
-        EffectiveStatementBase<RevisionAwareXPath, PathStatement> {
-
-    public PathEffectiveStatementImpl(
-            StmtContext<RevisionAwareXPath, PathStatement, ?> ctx) {
+public class PathEffectiveStatementImpl extends EffectiveStatementBase<RevisionAwareXPath, PathStatement> {
+    public PathEffectiveStatementImpl(final StmtContext<RevisionAwareXPath, PathStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 4b132cc97536a0d32bf0bd5d41de2461d2198e0d..15638e03a97264394f85aa1c784c2711d55ea4fe 100644 (file)
@@ -11,10 +11,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 public class PositionEffectiveStatementImpl extends EffectiveStatementBase<Long, PositionStatement> {
-
-    public PositionEffectiveStatementImpl(StmtContext<Long, PositionStatement, ?> ctx) {
+    public PositionEffectiveStatementImpl(final StmtContext<Long, PositionStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 67f29fb0e962ef3e8590c8ebc4bba73a9cb7eaec..294840f671a9bb2b3e8bf97646a3141bf2b1d351 100644 (file)
@@ -8,14 +8,10 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
-
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 public class PrefixEffectiveStatementImpl extends EffectiveStatementBase<String, PrefixStatement>  {
-
-    public PrefixEffectiveStatementImpl(
-            StmtContext<String, PrefixStatement, ?> ctx) {
+    public PrefixEffectiveStatementImpl(final StmtContext<String, PrefixStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index 0fce3312ab71f58e6b385dbd3e5e93d4b8fa1424..9bed5d4f2e4d53142e42c7597fe76bd0ef131521 100644 (file)
@@ -7,15 +7,11 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class PresenceEffectiveStatementImpl extends EffectiveStatementBase<String, PresenceStatement>  {
-
-    public PresenceEffectiveStatementImpl(
-            StmtContext<String, PresenceStatement, ?> ctx) {
+public class PresenceEffectiveStatementImpl extends EffectiveStatementBase<String, PresenceStatement> {
+    public PresenceEffectiveStatementImpl(final StmtContext<String, PresenceStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index 5e1708c1925c8ade94200d0e023fe31990907cb3..b2d9171c4994dce81c01482c762b66b986bbdd13 100644 (file)
@@ -7,15 +7,11 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 public class ReferenceEffectiveStatementImpl extends EffectiveStatementBase<String, ReferenceStatement>  {
-
-    public ReferenceEffectiveStatementImpl(
-            StmtContext<String, ReferenceStatement, ?> ctx) {
+    public ReferenceEffectiveStatementImpl(final StmtContext<String, ReferenceStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index 3099c8edccfcd63875f48536f00fcf1007b4ccc5..9752e4e2151826679c6b376b45f800ef1a49f978 100644 (file)
@@ -7,20 +7,19 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
+import com.google.common.collect.ImmutableList;
 import java.util.Collection;
 import java.util.LinkedList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
-import com.google.common.collect.ImmutableList;
 import java.util.List;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.RefineStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
 public class RefineEffectiveStatementImpl extends
         AbstractEffectiveDocumentedNode<SchemaNodeIdentifier, RefineStatement>
@@ -28,11 +27,11 @@ public class RefineEffectiveStatementImpl extends
 
     private final QName qname;
     private final SchemaPath path;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private List<UnknownSchemaNode> unknownNodes;
     private final SchemaNode refineTargetNode;
 
     public RefineEffectiveStatementImpl(
-            StmtContext<SchemaNodeIdentifier, RefineStatement, ?> ctx) {
+            final StmtContext<SchemaNodeIdentifier, RefineStatement, ?> ctx) {
         super(ctx);
 
         qname = ctx.getStatementArgument().getLastComponent();
@@ -40,7 +39,6 @@ public class RefineEffectiveStatementImpl extends
         refineTargetNode = (SchemaNode) ctx.getEffectOfStatement().iterator().next().buildEffective();
 
         initSubstatementCollectionsAndFields();
-
     }
 
     public SchemaNode getRefineTargetNode() {
index 1d66959415455970fc0e6cab97d8041d3fb4ee1a..f6883b18bf364c08ee9e33b54e6e4bbe2cf639ca 100644 (file)
@@ -11,10 +11,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 public class RequireInstanceEffectiveStatementImpl extends EffectiveStatementBase<Boolean, RequireInstanceStatement> {
-
-    public RequireInstanceEffectiveStatementImpl(StmtContext<Boolean, RequireInstanceStatement, ?> ctx) {
+    public RequireInstanceEffectiveStatementImpl(final StmtContext<Boolean, RequireInstanceStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 57714cfe6ce42feae9f76fa22f947c1ef57df62f..0b925b169c0d6bbd20de7efaa9de9814050487e2 100644 (file)
@@ -8,16 +8,11 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import java.util.Date;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class RevisionDateEffectiveStatementImpl extends
-        EffectiveStatementBase<Date, RevisionDateStatement> {
-
-    public RevisionDateEffectiveStatementImpl(
-            StmtContext<Date, RevisionDateStatement, ?> ctx) {
+public class RevisionDateEffectiveStatementImpl extends EffectiveStatementBase<Date, RevisionDateStatement> {
+    public RevisionDateEffectiveStatementImpl(final StmtContext<Date, RevisionDateStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index 1e75a8b783106d5933bb44d2f24b7ba79b997095..4aff93ae0babd0f93d89a9b04528e85833802306 100644 (file)
@@ -11,14 +11,11 @@ import java.util.Date;
 import org.opendaylight.yangtools.yang.model.api.stmt.RevisionStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class RevisionEffectiveStatementImpl extends
-        EffectiveStatementBase<Date, RevisionStatement> {
-
+public class RevisionEffectiveStatementImpl extends EffectiveStatementBase<Date, RevisionStatement> {
     private final String reference;
     private final String description;
 
-    public RevisionEffectiveStatementImpl(
-            StmtContext<Date, RevisionStatement, ?> ctx) {
+    public RevisionEffectiveStatementImpl(final StmtContext<Date, RevisionStatement, ?> ctx) {
         super(ctx);
 
         DescriptionEffectiveStatementImpl descStmt = firstEffective(DescriptionEffectiveStatementImpl.class);
@@ -43,5 +40,4 @@ public class RevisionEffectiveStatementImpl extends
     public final String getReference() {
         return reference;
     }
-
 }
\ No newline at end of file
index 0eef258d300ccd4e457ddc059451625562667101..65e336ca0a039d241b6ef8ec7adaa4f468c4012d 100644 (file)
@@ -18,12 +18,12 @@ import java.util.Set;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.stmt.RpcStatement;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.RpcStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
@@ -34,17 +34,16 @@ public class RpcEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<Q
     private ContainerSchemaNode input;
     private ContainerSchemaNode output;
 
-    ImmutableSet<TypeDefinition<?>> typeDefinitions;
-    ImmutableSet<GroupingDefinition> groupings;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private Set<TypeDefinition<?>> typeDefinitions;
+    private Set<GroupingDefinition> groupings;
+    private List<UnknownSchemaNode> unknownNodes;
 
-    public RpcEffectiveStatementImpl(StmtContext<QName, RpcStatement, EffectiveStatement<QName, RpcStatement>> ctx) {
+    public RpcEffectiveStatementImpl(final StmtContext<QName, RpcStatement, EffectiveStatement<QName, RpcStatement>> ctx) {
         super(ctx);
         this.qname = ctx.getStatementArgument();
         this.path = Utils.getSchemaPath(ctx);
 
         initSubstatements();
-
     }
 
     private void initSubstatements() {
@@ -144,21 +143,7 @@ public class RpcEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<Q
             return false;
         }
         final RpcEffectiveStatementImpl other = (RpcEffectiveStatementImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qname, other.qname) && Objects.equals(path, other.path);
     }
 
     @Override
index e0280ca76d51855687ac453cefb0d8423e5708ea..73e892f95870422b7f15bf25a4b605675b7526b3 100644 (file)
@@ -8,17 +8,11 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import org.opendaylight.yangtools.yang.model.api.Status;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class StatusEffectiveStatementImpl extends
-        EffectiveStatementBase<Status, StatusStatement> {
-
-    public StatusEffectiveStatementImpl(
-            StmtContext<Status, StatusStatement, ?> ctx) {
+public class StatusEffectiveStatementImpl extends EffectiveStatementBase<Status, StatusStatement> {
+    public StatusEffectiveStatementImpl(final StmtContext<Status, StatusStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index faeb3d9544f4635251bc10d62823485a552b025c..b3af3c8c0b0b47915356440588e8a130412e9da1 100644 (file)
@@ -54,9 +54,7 @@ import org.opendaylight.yangtools.yang.parser.spi.source.IncludedSubmoduleNameTo
 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToModuleQName;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
-public class SubmoduleEffectiveStatementImpl
-        extends
-        AbstractEffectiveDocumentedNode<String, SubmoduleStatement>
+public class SubmoduleEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<String, SubmoduleStatement>
         implements Module, Immutable {
 
     private final QNameModule qNameModule;
@@ -91,34 +89,27 @@ public class SubmoduleEffectiveStatementImpl
 
         name = argument();
 
-        String belongsToModuleName = firstAttributeOf(
-                ctx.declaredSubstatements(), BelongsToStatement.class);
+        String belongsToModuleName = firstAttributeOf(ctx.declaredSubstatements(), BelongsToStatement.class);
         final QNameModule belongsToModuleQName = ctx.getFromNamespace(
                 ModuleNameToModuleQName.class, belongsToModuleName);
         RevisionEffectiveStatementImpl submoduleRevision = firstEffective(RevisionEffectiveStatementImpl.class);
 
-        qNameModule = submoduleRevision == null ? QNameModule.create(
-                belongsToModuleQName.getNamespace(),
-                SimpleDateFormatUtil.DEFAULT_DATE_REV) : QNameModule.create(
-                belongsToModuleQName.getNamespace(),
-                submoduleRevision.argument());
+        qNameModule = submoduleRevision == null
+                ? QNameModule.create(belongsToModuleQName.getNamespace(), SimpleDateFormatUtil.DEFAULT_DATE_REV)
+                : QNameModule.create(belongsToModuleQName.getNamespace(), submoduleRevision.argument());
 
         for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
             if (effectiveStatement instanceof PrefixEffectiveStatementImpl) {
-                prefix = ((PrefixEffectiveStatementImpl) effectiveStatement)
-                        .argument();
+                prefix = ((PrefixEffectiveStatementImpl) effectiveStatement).argument();
             }
             if (effectiveStatement instanceof YangVersionEffectiveStatementImpl) {
-                yangVersion = ((YangVersionEffectiveStatementImpl) effectiveStatement)
-                        .argument();
+                yangVersion = ((YangVersionEffectiveStatementImpl) effectiveStatement).argument();
             }
             if (effectiveStatement instanceof OrganizationEffectiveStatementImpl) {
-                organization = ((OrganizationEffectiveStatementImpl) effectiveStatement)
-                        .argument();
+                organization = ((OrganizationEffectiveStatementImpl) effectiveStatement).argument();
             }
             if (effectiveStatement instanceof ContactEffectiveStatementImpl) {
-                contact = ((ContactEffectiveStatementImpl) effectiveStatement)
-                        .argument();
+                contact = ((ContactEffectiveStatementImpl) effectiveStatement).argument();
             }
         }
 
@@ -444,21 +435,13 @@ public class SubmoduleEffectiveStatementImpl
             return false;
         }
         SubmoduleEffectiveStatementImpl other = (SubmoduleEffectiveStatementImpl) obj;
-        if (name == null) {
-            if (other.name != null) {
-                return false;
-            }
-        } else if (!name.equals(other.name)) {
+        if (!Objects.equals(name, other.name)) {
             return false;
         }
         if (!qNameModule.equals(other.qNameModule)) {
             return false;
         }
-        if (yangVersion == null) {
-            if (other.yangVersion != null) {
-                return false;
-            }
-        } else if (!yangVersion.equals(other.yangVersion)) {
+        if (!Objects.equals(yangVersion, other.yangVersion)) {
             return false;
         }
         return true;
index fe9e1389c70f88b58abed5acfddce84866e01e02..4a806d64052b9a82f81ede3dd82799e014664bba 100644 (file)
@@ -7,16 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
-import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
-
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.Decimal64SpecificationEffectiveStatementImpl;
-import java.util.ArrayList;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.LengthEffectiveStatementImpl;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.PatternEffectiveStatementImpl;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.RangeEffectiveStatementImpl;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -25,6 +18,7 @@ import org.opendaylight.yangtools.yang.model.api.Status;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.TypedefStatement;
 import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
@@ -33,13 +27,17 @@ import org.opendaylight.yangtools.yang.model.util.ExtendedType;
 import org.opendaylight.yangtools.yang.model.util.ExtendedType.Builder;
 import org.opendaylight.yangtools.yang.parser.spi.TypeNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.Decimal64SpecificationEffectiveStatementImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.LengthEffectiveStatementImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.PatternEffectiveStatementImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.RangeEffectiveStatementImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.TypeDefinitionEffectiveBuilder;
 
-public class TypeDefEffectiveStatementImpl extends
-        EffectiveStatementBase<QName, TypedefStatement> implements
-        TypeDefinition<TypeDefinition<?>>, TypeDefinitionEffectiveBuilder {
+public class TypeDefEffectiveStatementImpl extends EffectiveStatementBase<QName, TypedefStatement>
+        implements TypeDefinition<TypeDefinition<?>>, TypeDefinitionEffectiveBuilder {
 
     private final QName qName;
     private final SchemaPath path;
@@ -61,8 +59,7 @@ public class TypeDefEffectiveStatementImpl extends
 
     private ExtendedType extendedType = null;
 
-    public TypeDefEffectiveStatementImpl(
-            StmtContext<QName, TypedefStatement, ?> ctx) {
+    public TypeDefEffectiveStatementImpl(final StmtContext<QName, TypedefStatement, ?> ctx) {
         super(ctx);
 
         qName = ctx.getStatementArgument();
@@ -109,8 +106,7 @@ public class TypeDefEffectiveStatementImpl extends
         }
     }
 
-    private TypeDefinition<?> parseBaseTypeFromCtx(
-            final StmtContext<QName, TypedefStatement, ?> ctx) {
+    private TypeDefinition<?> parseBaseTypeFromCtx(final StmtContext<QName, TypedefStatement, ?> ctx) {
 
         TypeDefinition<?> baseType;
 
@@ -135,58 +131,44 @@ public class TypeDefEffectiveStatementImpl extends
             }
         } else {
             StmtContext<?, TypedefStatement, EffectiveStatement<QName, TypedefStatement>> baseTypeCtx = ctx
-                    .getParentContext().getFromNamespace(TypeNamespace.class,
-                            baseTypeQName);
-            baseType = (TypeDefEffectiveStatementImpl) baseTypeCtx
-                    .buildEffective();
+                    .getParentContext().getFromNamespace(TypeNamespace.class, baseTypeQName);
+            baseType = (TypeDefEffectiveStatementImpl) baseTypeCtx.buildEffective();
         }
 
         return baseType;
     }
 
-    protected Integer initFractionDigits(
-            EffectiveStatementBase<?, ?> typeEffectiveStmt) {
+    protected Integer initFractionDigits(final EffectiveStatementBase<?, ?> typeEffectiveStmt) {
         final FractionDigitsEffectiveStatementImpl fractionDigitsEffStmt = typeEffectiveStmt
                 .firstEffective(FractionDigitsEffectiveStatementImpl.class);
-        return fractionDigitsEffStmt != null ? fractionDigitsEffStmt.argument()
-                : null;
+        return fractionDigitsEffStmt != null ? fractionDigitsEffStmt.argument() : null;
     }
 
-    protected List<RangeConstraint> initRanges(
-            EffectiveStatementBase<?, ?> typeEffectiveStmt) {
+    protected List<RangeConstraint> initRanges(final EffectiveStatementBase<?, ?> typeEffectiveStmt) {
         final RangeEffectiveStatementImpl rangeConstraints = typeEffectiveStmt
                 .firstEffective(RangeEffectiveStatementImpl.class);
-        return rangeConstraints != null ? rangeConstraints.argument()
-                : Collections.<RangeConstraint> emptyList();
+        return rangeConstraints != null ? rangeConstraints.argument(): Collections.<RangeConstraint> emptyList();
     }
 
-    protected List<LengthConstraint> initLengths(
-            EffectiveStatementBase<?, ?> typeEffectiveStmt) {
+    protected List<LengthConstraint> initLengths(final EffectiveStatementBase<?, ?> typeEffectiveStmt) {
         final LengthEffectiveStatementImpl lengthConstraints = typeEffectiveStmt
                 .firstEffective(LengthEffectiveStatementImpl.class);
-        return lengthConstraints != null ? lengthConstraints.argument()
-                : Collections.<LengthConstraint> emptyList();
+        return lengthConstraints != null ? lengthConstraints.argument(): Collections.<LengthConstraint> emptyList();
     }
 
-    protected List<PatternConstraint> initPatterns(
-            EffectiveStatementBase<?, ?> typeEffectiveStmt) {
+    protected List<PatternConstraint> initPatterns(final EffectiveStatementBase<?, ?> typeEffectiveStmt) {
         final List<PatternConstraint> patternConstraints = new ArrayList<>();
 
-        for (final EffectiveStatement<?, ?> effectiveStatement : typeEffectiveStmt
-                .effectiveSubstatements()) {
+        for (final EffectiveStatement<?, ?> effectiveStatement : typeEffectiveStmt.effectiveSubstatements()) {
             if (effectiveStatement instanceof PatternEffectiveStatementImpl) {
-                final PatternConstraint pattern = ((PatternEffectiveStatementImpl) effectiveStatement)
-                        .argument();
-
+                final PatternConstraint pattern = ((PatternEffectiveStatementImpl) effectiveStatement).argument();
                 if (pattern != null) {
                     patternConstraints.add(pattern);
                 }
             }
         }
 
-        return !patternConstraints.isEmpty() ? ImmutableList
-                .copyOf(patternConstraints) : Collections
-                .<PatternConstraint> emptyList();
+        return ImmutableList.copyOf(patternConstraints);
     }
 
     @Override
index 7ab0ac09717c8362dbb418b2e1abf160a776d16e..4ac90946e3346bf5eb923e5643639cb0af876258 100644 (file)
@@ -10,12 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class UnitsEffectiveStatementImpl extends
-        EffectiveStatementBase<String, UnitsStatement> {
-
-    public UnitsEffectiveStatementImpl(
-            StmtContext<String, UnitsStatement, ?> ctx) {
+public class UnitsEffectiveStatementImpl extends EffectiveStatementBase<String, UnitsStatement> {
+    public UnitsEffectiveStatementImpl(final StmtContext<String, UnitsStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index 7822169ab0aa942b5995cfafcfa9dba0fe5ff05b..2027a1b9cc714a1150ce1010ba5939d395398457 100644 (file)
@@ -36,10 +36,10 @@ public class UnknownEffectiveStatementImpl extends EffectiveStatementBase<QName,
     private ExtensionDefinition extension;
     private String description;
     private String reference;
-    private Status status = Status.CURRENT;
+    private final Status status = Status.CURRENT;
     private final List<UnknownSchemaNode> unknownNodes = new ArrayList<>();
     private QName nodeType;
-    private String nodeParameter;
+    private final String nodeParameter;
 
     public UnknownEffectiveStatementImpl(final StmtContext<QName, UnknownStatement<QName>, ?> ctx) {
         super(ctx);
@@ -169,32 +169,16 @@ public class UnknownEffectiveStatementImpl extends EffectiveStatementBase<QName,
             return false;
         }
         UnknownEffectiveStatementImpl other = (UnknownEffectiveStatementImpl) obj;
-        if (qName == null) {
-            if (other.qName != null) {
-                return false;
-            }
-        } else if (!qName.equals(other.qName)) {
+        if (!Objects.equals(qName, other.qName)) {
             return false;
         }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
+        if (!Objects.equals(path, other.path)) {
             return false;
         }
-        if (nodeType == null) {
-            if (other.nodeType != null) {
-                return false;
-            }
-        } else if (!nodeType.equals(other.nodeType)) {
+        if (!Objects.equals(nodeType, other.nodeType)) {
             return false;
         }
-        if (nodeParameter == null) {
-            if (other.nodeParameter != null) {
-                return false;
-            }
-        } else if (!nodeParameter.equals(other.nodeParameter)) {
+        if (!Objects.equals(nodeParameter, other.nodeParameter)) {
             return false;
         }
         return true;
index 6c41847481506a6149b7ac9735cbe972ba206042..0a95b20312507feb955dba9eb0f4e57cd13f8db0 100644 (file)
@@ -36,11 +36,11 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 public class UsesEffectiveStatementImpl extends EffectiveStatementBase<QName, UsesStatement> implements UsesNode {
     private SchemaPath groupingPath;
     private boolean addedByUses;
-    ImmutableMap<SchemaPath, SchemaNode> refines;
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private ImmutableMap<SchemaPath, SchemaNode> refines;
+    private ImmutableSet<AugmentationSchema> augmentations;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
 
-    public UsesEffectiveStatementImpl(StmtContext<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> ctx) {
+    public UsesEffectiveStatementImpl(final StmtContext<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> ctx) {
         super(ctx);
 
         initGroupingPath(ctx);
@@ -48,7 +48,7 @@ public class UsesEffectiveStatementImpl extends EffectiveStatementBase<QName, Us
         initSubstatementCollections();
     }
 
-    private void initGroupingPath(StmtContext<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> ctx) {
+    private void initGroupingPath(final StmtContext<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> ctx) {
         StmtContext<?, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> grpCtx = ctx.getFromNamespace(
                 GroupingNamespace.class, ctx.getStatementArgument());
         this.groupingPath = Utils.getSchemaPath(grpCtx);
@@ -83,7 +83,7 @@ public class UsesEffectiveStatementImpl extends EffectiveStatementBase<QName, Us
     }
 
     private void initCopyType(
-            StmtContext<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> ctx) {
+            final StmtContext<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> ctx) {
 
         List<TypeOfCopy> copyTypesFromOriginal = ctx.getCopyHistory();
         if(copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES)) {
@@ -145,21 +145,7 @@ public class UsesEffectiveStatementImpl extends EffectiveStatementBase<QName, Us
             return false;
         }
         final UsesEffectiveStatementImpl other = (UsesEffectiveStatementImpl) obj;
-        if (groupingPath == null) {
-            if (other.groupingPath != null) {
-                return false;
-            }
-        } else if (!groupingPath.equals(other.groupingPath)) {
-            return false;
-        }
-        if (augmentations == null) {
-            if (other.augmentations != null) {
-                return false;
-            }
-        } else if (!augmentations.equals(other.augmentations)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(groupingPath, other.groupingPath) && Objects.equals(augmentations, other.augmentations);
     }
 
     @Override
index 802893d20bc23763b67d0feac4998602af403daa..77d842a769318ee218ad73525cce496dd7178e5b 100644 (file)
@@ -11,8 +11,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 public class ValueEffectiveStatementImpl extends EffectiveStatementBase<Integer, ValueStatement> {
-
-    public ValueEffectiveStatementImpl(StmtContext<Integer, ValueStatement, ?> ctx) {
+    public ValueEffectiveStatementImpl(final StmtContext<Integer, ValueStatement, ?> ctx) {
         super(ctx);
     }
 }
\ No newline at end of file
index 45a1142ce177206870d2cbc3a8a5dac451edf17e..76f9b692ea36828030621ee60bd0d915d925a4a1 100644 (file)
@@ -11,13 +11,8 @@ import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
 import org.opendaylight.yangtools.yang.model.api.stmt.WhenStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class WhenEffectiveStatementImpl extends
-        EffectiveStatementBase<RevisionAwareXPath, WhenStatement> {
-
-    public WhenEffectiveStatementImpl(
-            StmtContext<RevisionAwareXPath, WhenStatement, ?> ctx) {
+public class WhenEffectiveStatementImpl extends EffectiveStatementBase<RevisionAwareXPath, WhenStatement> {
+    public WhenEffectiveStatementImpl(final StmtContext<RevisionAwareXPath, WhenStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 32479687a131175641c4da7faa7f40aaa55b213b..34e38b4ea458adbb17d2fceb5c8ec20bac528c58 100644 (file)
@@ -10,13 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class YangVersionEffectiveStatementImpl extends
-        EffectiveStatementBase<String, YangVersionStatement> {
-
-    public YangVersionEffectiveStatementImpl(
-            StmtContext<String, YangVersionStatement, ?> ctx) {
+public class YangVersionEffectiveStatementImpl extends EffectiveStatementBase<String, YangVersionStatement> {
+    public YangVersionEffectiveStatementImpl(final StmtContext<String, YangVersionStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 600b0c5998446451ce057ea59bdd3306e06ede28..f2d640c3db12c2a86135895213e5887afcfe73a5 100644 (file)
@@ -10,12 +10,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class YinElementEffectiveStatementImpl extends
-        EffectiveStatementBase<Boolean, YinElementStatement> {
-
-    public YinElementEffectiveStatementImpl(
-            StmtContext<Boolean, YinElementStatement, ?> ctx) {
+public class YinElementEffectiveStatementImpl extends EffectiveStatementBase<Boolean, YinElementStatement> {
+    public YinElementEffectiveStatementImpl(final StmtContext<Boolean, YinElementStatement, ?> ctx) {
         super(ctx);
     }
-
 }
index e20dd839c54a439d05031a6191fa74b4da26159a..7382a411a98e2e4d27ad147e83c43d7a17f6ea98 100644 (file)
@@ -23,9 +23,8 @@ import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
-public class BinaryEffectiveStatementImpl extends
-        EffectiveStatementBase<String, TypeStatement> implements
-        BinaryTypeDefinition {
+public class BinaryEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement>
+        implements BinaryTypeDefinition {
 
     private static final String DESCRIPTION = "The binary built-in type represents any binary data, i.e., a sequence of octets.";
     private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.8";
@@ -41,8 +40,8 @@ public class BinaryEffectiveStatementImpl extends
             final StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx) {
         super(ctx);
 
-        final LengthConstraint lengthConstraint = new LengthConstraintEffectiveImpl(
-                0, Long.MAX_VALUE, OPTIONAL_EMPTY, OPTIONAL_EMPTY);
+        final LengthConstraint lengthConstraint =
+                new LengthConstraintEffectiveImpl(0, Long.MAX_VALUE, OPTIONAL_EMPTY, OPTIONAL_EMPTY);
         lengthConstraints = Collections.singletonList(lengthConstraint);
     }
 
index fec0ef919ef3aaa190efc83591f1c193608254f2..a471895f924de7d937af48392c2a89dd4e00291e 100644 (file)
@@ -12,19 +12,19 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.BitStatement;
 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DescriptionEffectiveStatementImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.PositionEffectiveStatementImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ReferenceEffectiveStatementImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.StatusEffectiveStatementImpl;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
 public class BitEffectiveStatementImpl extends EffectiveStatementBase<QName, BitStatement> implements
         BitsTypeDefinition.Bit {
@@ -35,9 +35,9 @@ public class BitEffectiveStatementImpl extends EffectiveStatementBase<QName, Bit
     private String description;
     private String reference;
     private Status status;
-    private List<UnknownSchemaNode> unknownSchemaNodes;
+    private final List<UnknownSchemaNode> unknownSchemaNodes;
 
-    public BitEffectiveStatementImpl(StmtContext<QName, BitStatement, ?> ctx) {
+    public BitEffectiveStatementImpl(final StmtContext<QName, BitStatement, ?> ctx) {
         super(ctx);
 
         List<UnknownSchemaNode> unknownSchemaNodesInit = new ArrayList<>();
@@ -130,21 +130,7 @@ public class BitEffectiveStatementImpl extends EffectiveStatementBase<QName, Bit
             return false;
         }
         BitsTypeDefinition.Bit other = (BitsTypeDefinition.Bit) obj;
-        if (qName == null) {
-            if (other.getQName() != null) {
-                return false;
-            }
-        } else if (!qName.equals(other.getQName())) {
-            return false;
-        }
-        if (schemaPath == null) {
-            if (other.getPath() != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.getPath())) {
-            return false;
-        }
-        return true;
+        return Objects.equals(qName, other.getQName()) && Objects.equals(schemaPath, other.getPath());
     }
 
     @Override
index 472689dece8325ad0c5a565f84c114574c40f0c6..f94cd87483bc9d0fd157013d05d5d5c59c5cad50 100644 (file)
@@ -13,18 +13,18 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
-import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
 import org.opendaylight.yangtools.yang.model.util.BaseTypes;
 import org.opendaylight.yangtools.yang.model.util.BitsType;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
 public class BitsSpecificationEffectiveStatementImpl extends
         EffectiveStatementBase<String, TypeStatement.BitsSpecification> implements BitsTypeDefinition, TypeDefinitionEffectiveBuilder {
@@ -39,7 +39,7 @@ public class BitsSpecificationEffectiveStatementImpl extends
     private final SchemaPath path;
     private final List<Bit> bits;
 
-    public BitsSpecificationEffectiveStatementImpl(StmtContext<String, TypeStatement.BitsSpecification, EffectiveStatement<String, TypeStatement.BitsSpecification>> ctx) {
+    public BitsSpecificationEffectiveStatementImpl(final StmtContext<String, TypeStatement.BitsSpecification, EffectiveStatement<String, TypeStatement.BitsSpecification>> ctx) {
         super(ctx);
 
         List<Bit> bitsInit = new ArrayList<>();
@@ -127,21 +127,7 @@ public class BitsSpecificationEffectiveStatementImpl extends
             return false;
         }
         BitsSpecificationEffectiveStatementImpl other = (BitsSpecificationEffectiveStatementImpl) obj;
-        if (bits == null) {
-            if (other.bits != null) {
-                return false;
-            }
-        } else if (!bits.equals(other.bits)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(bits, other.bits) && Objects.equals(path, other.path);
     }
 
     @Override
index bf55043c73a1e3a4d440feb199e9407a5f57e23d..ddf52a5e081969c6dcd46014562b98822fa94739 100644 (file)
@@ -8,9 +8,6 @@
 
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type;
 
-import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
-
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -19,27 +16,26 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
 import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition;
 import org.opendaylight.yangtools.yang.model.util.BaseTypes;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
-public class BooleanEffectiveStatementImpl
-        extends EffectiveStatementBase<String, TypeStatement> implements
-        BooleanTypeDefinition {
+public class BooleanEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement>
+        implements BooleanTypeDefinition {
 
     public static final String LOCAL_NAME = TypeUtils.BOOLEAN;
-    private static final QName QNAME = QName.create(
-            YangConstants.RFC6020_YANG_MODULE, LOCAL_NAME);
+    private static final QName QNAME = QName.create(YangConstants.RFC6020_YANG_MODULE, LOCAL_NAME);
     private static final SchemaPath PATH = SchemaPath.create(true, QNAME);
     private static final String DESCRIPTION = "The boolean built-in type represents a boolean value.";
     private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.5";
     private static final String UNITS = "";
 
     public BooleanEffectiveStatementImpl(
-            StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx) {
+            final StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx) {
         super(ctx);
-
     }
 
     @Override
index 5a879baf58d98bcea47813c58dd72a04a09d75be..18fb22ced1e996d9b68e706fc02cffbcac563e0d 100644 (file)
@@ -69,6 +69,7 @@ public class Decimal64SpecificationEffectiveStatementImpl extends
 
     private ExtendedType extendedType;
     private final boolean isExtended;
+    private Decimal64 decimal64Instance = null;
 
     public Decimal64SpecificationEffectiveStatementImpl(
             final StmtContext<String, TypeStatement.Decimal64Specification, EffectiveStatement<String, TypeStatement.Decimal64Specification>> ctx) {
@@ -205,28 +206,17 @@ public class Decimal64SpecificationEffectiveStatementImpl extends
             return false;
         }
         Decimal64SpecificationEffectiveStatementImpl other = (Decimal64SpecificationEffectiveStatementImpl) obj;
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(path, other.path);
     }
 
     @Override
     public String toString() {
         return Decimal64SpecificationEffectiveStatementImpl.class
                 .getSimpleName()
-                + "[qName="
-                + QNAME
-                + ", fractionDigits="
-                + fractionDigits + "]";
+                + "[qName=" + QNAME
+                + ", fractionDigits=" + fractionDigits + "]";
     }
 
-    private Decimal64 decimal64Instance = null;
-
     @Override
     public TypeDefinition<?> buildType() {
 
@@ -234,7 +224,7 @@ public class Decimal64SpecificationEffectiveStatementImpl extends
             decimal64Instance = Decimal64.create(path, fractionDigits);
         }
 
-        if(!isExtended) {
+        if (!isExtended) {
             return decimal64Instance;
         }
 
@@ -242,8 +232,8 @@ public class Decimal64SpecificationEffectiveStatementImpl extends
             return extendedType;
         }
 
-        Builder extendedTypeBuilder = ExtendedType.builder(path.getLastComponent(), decimal64Instance, Optional.<String>absent(),
-                Optional.<String>absent(), path);
+        Builder extendedTypeBuilder = ExtendedType.builder(path.getLastComponent(), decimal64Instance,
+            Optional.<String>absent(), Optional.<String>absent(), path);
 
         extendedTypeBuilder.fractionDigits(fractionDigits);
         extendedTypeBuilder.ranges(rangeConstraints);
index e586780051ccd71f9ab70cacf0528b74a88bcba2..0c8d5c82883140d45ed2527c4cdc341a1a73e9cd 100644 (file)
@@ -8,9 +8,6 @@
 
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type;
 
-import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
-
 import java.util.Collections;
 import java.util.List;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -19,25 +16,24 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
 import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
-public class EmptyEffectiveStatementImpl extends
-        EffectiveStatementBase<String, TypeStatement> implements
-        EmptyTypeDefinition {
+public class EmptyEffectiveStatementImpl extends EffectiveStatementBase<String, TypeStatement>
+        implements EmptyTypeDefinition {
 
     public static final String LOCAL_NAME = TypeUtils.EMPTY;
-    private static final QName QNAME = QName.create(
-            YangConstants.RFC6020_YANG_MODULE, LOCAL_NAME);
+    private static final QName QNAME = QName.create(YangConstants.RFC6020_YANG_MODULE, LOCAL_NAME);
     private static final SchemaPath PATH = SchemaPath.create(true, QNAME);
     private static final String DESCRIPTION = "The empty built-in type represents a leaf that does not have any value, it conveys information by its presence or absence.";
     private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#page-131";
 
     public EmptyEffectiveStatementImpl(
-            StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx) {
+            final StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx) {
         super(ctx);
-
     }
 
     @Override
index 478004f25e448f40e2c3c832a6e8fbad8bb95d0f..a3d5feddbc01e2d0a32da39173794edc7343553c 100644 (file)
@@ -9,14 +9,13 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type;
 
 import java.util.Collections;
 import java.util.List;
-
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.EnumStatement;
-import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DescriptionEffectiveStatementImpl;
@@ -25,17 +24,15 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ReferenceEf
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.StatusEffectiveStatementImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ValueEffectiveStatementImpl;
 
-public class EnumEffectiveStatementImpl extends EffectiveStatementBase<QName, EnumStatement> implements
-        EnumTypeDefinition.EnumPair {
-
-    private QName qName;
-    private SchemaPath path;
+public class EnumEffectiveStatementImpl extends EffectiveStatementBase<QName, EnumStatement> implements EnumPair {
+    private final QName qName;
+    private final SchemaPath path;
     private String description;
     private String reference;
     private Status status;
     private Integer value;
 
-    public EnumEffectiveStatementImpl(StmtContext<QName, EnumStatement, ?> ctx) {
+    public EnumEffectiveStatementImpl(final StmtContext<QName, EnumStatement, ?> ctx) {
         super(ctx);
 
         qName = ctx.getStatementArgument();
index fca2532227d5630bacaf0f024d36149ace62b128..a9dfd93e16cf9b5788c60297ada49a1157507aff 100644 (file)
@@ -132,25 +132,13 @@ public class EnumSpecificationEffectiveStatementImpl extends
             return false;
         }
         EnumSpecificationEffectiveStatementImpl other = (EnumSpecificationEffectiveStatementImpl) obj;
-        if (defaultEnum == null) {
-            if (other.defaultEnum != null) {
-                return false;
-            }
-        } else if (!defaultEnum.equals(other.defaultEnum)) {
+        if (!Objects.equals(defaultEnum, other.defaultEnum)) {
             return false;
         }
-        if (enums == null) {
-            if (other.enums != null) {
-                return false;
-            }
-        } else if (!enums.equals(other.enums)) {
+        if (!Objects.equals(enums, other.enums)) {
             return false;
         }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
+        if (!Objects.equals(path, other.path)) {
             return false;
         }
         return true;
@@ -181,7 +169,7 @@ public class EnumSpecificationEffectiveStatementImpl extends
     @Override
     public TypeDefinition<?> buildType() {
 
-        if(enumerationTypeInstance !=null) {
+        if (enumerationTypeInstance !=null) {
             return enumerationTypeInstance;
         }
 
index 124112de8c8a8bccd3b83132b16263a614775eab..08bfea3cd7567de7d01c45f3d346f8e9b9f45252 100644 (file)
@@ -30,6 +30,6 @@ public class Int16EffectiveStatementImpl extends IntegerEffectiveImplBase {
 
     @Override
     public String toString() {
-        return "type " + qName;
+        return "type " + getQName();
     }
 }
index 4d2e4454790cc21d8aa1498c19cecb833be9068c..2bdc77853042b38323812b9e6af1f98bf32270dd 100644 (file)
@@ -30,6 +30,6 @@ public class Int32EffectiveStatementImpl extends IntegerEffectiveImplBase {
 
     @Override
     public String toString() {
-        return "type " + qName;
+        return "type " + getQName();
     }
 }
index e3a365e317b3fd6717584da914ff11baac39ab50..5b94bcb032bb850b615dc7209c1483b2e25ce30b 100644 (file)
@@ -30,6 +30,6 @@ public class Int64EffectiveStatementImpl extends IntegerEffectiveImplBase {
 
     @Override
     public String toString() {
-        return "type " + qName;
+        return "type " + getQName();
     }
 }
index 9f90fa111be40b8a1a8e135e8e93a9fed81e2bb1..e3d3f620b88f44e8152926c3497e6ae91a01ec24 100644 (file)
@@ -30,6 +30,6 @@ public class Int8EffectiveStatementImpl extends IntegerEffectiveImplBase {
 
     @Override
     public String toString() {
-        return "type " + qName;
+        return "type " + getQName();
     }
 }
index 885b7a14d36673a3de795464906f815b76d45f73..c1c6a07301f1121acb2be364b76a112ece9904dc 100644 (file)
@@ -8,34 +8,33 @@
 
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type;
 
-import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
-
 import com.google.common.base.Optional;
 import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
 import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
 abstract class IntegerEffectiveImplBase extends
         EffectiveStatementBase<String,TypeStatement> implements IntegerTypeDefinition {
 
     private static final String REFERENCE_INT = "https://tools.ietf.org/html/rfc6020#section-9.2";
 
-    protected QName qName;
-    private SchemaPath path;
-    private String units = "";
+    private final QName qName;
+    private final SchemaPath path;
+    private final String units = "";
     private final String description;
-    private List<RangeConstraint> rangeStatements;
+    private final List<RangeConstraint> rangeStatements;
 
     protected IntegerEffectiveImplBase(final StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx,
             final String localName, final Number minRange, final Number maxRange, final String description) {
@@ -127,39 +126,19 @@ abstract class IntegerEffectiveImplBase extends
             return false;
         }
         IntegerEffectiveImplBase other = (IntegerEffectiveImplBase) obj;
-        if (description == null) {
-            if (other.description != null) {
-                return false;
-            }
-        } else if (!description.equals(other.description)) {
+        if (!Objects.equals(description, other.description)) {
             return false;
         }
-        if (qName == null) {
-            if (other.qName != null) {
-                return false;
-            }
-        } else if (!qName.equals(other.qName)) {
+        if (!Objects.equals(qName, other.qName)) {
             return false;
         }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
+        if (!Objects.equals(path, other.path)) {
             return false;
         }
-        if (rangeStatements == null) {
-            if (other.rangeStatements != null) {
-                return false;
-            }
-        } else if (!rangeStatements.equals(other.rangeStatements)) {
+        if (!Objects.equals(rangeStatements, other.rangeStatements)) {
             return false;
         }
-        if (units == null) {
-            if (other.units != null) {
-                return false;
-            }
-        } else if (!units.equals(other.units)) {
+        if (!Objects.equals(units, other.units)) {
             return false;
         }
         return true;
index 24bdf82414fbe72941574bc43de77ee4b2082ca8..6b9d11e2866f9b1c46106b09f2a6472fa23df3e4 100644 (file)
@@ -12,18 +12,18 @@ import java.util.List;
 import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.util.Leafref;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.PathEffectiveStatementImpl;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 
 public class LeafrefSpecificationEffectiveStatementImpl extends
         EffectiveStatementBase<String, TypeStatement.LeafrefSpecification> implements LeafrefTypeDefinition, TypeDefinitionEffectiveBuilder {
@@ -35,10 +35,11 @@ public class LeafrefSpecificationEffectiveStatementImpl extends
     private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.9";
     private static final String UNITS = "";
 
-    private RevisionAwareXPath xpath;
     private final SchemaPath path;
+    private RevisionAwareXPath xpath;
+    private Leafref leafrefInstance = null;
 
-    public LeafrefSpecificationEffectiveStatementImpl(StmtContext<String, TypeStatement.LeafrefSpecification, EffectiveStatement<String, TypeStatement.LeafrefSpecification>> ctx) {
+    public LeafrefSpecificationEffectiveStatementImpl(final StmtContext<String, TypeStatement.LeafrefSpecification, EffectiveStatement<String, TypeStatement.LeafrefSpecification>> ctx) {
         super(ctx);
 
         path = Utils.getSchemaPath(ctx.getParentContext()).createChild(QNAME);
@@ -120,14 +121,7 @@ public class LeafrefSpecificationEffectiveStatementImpl extends
             return false;
         }
         LeafrefSpecificationEffectiveStatementImpl other = (LeafrefSpecificationEffectiveStatementImpl) obj;
-        if (xpath == null) {
-            if (other.xpath != null) {
-                return false;
-            }
-        } else if (!xpath.equals(other.xpath)) {
-            return false;
-        }
-        return true;
+        return Objects.equals(xpath, other.xpath);
     }
 
     @Override
@@ -141,8 +135,6 @@ public class LeafrefSpecificationEffectiveStatementImpl extends
         return builder.toString();
     }
 
-    private Leafref leafrefInstance = null;
-
     @Override
     public Leafref buildType() {
 
index 2912bddcf22b2f0c05ca8eafd69e6eac46399dc8..32ca55e4465b9722f164e380258eef9616044d28 100644 (file)
@@ -92,25 +92,13 @@ public class LengthConstraintEffectiveImpl implements LengthConstraint {
             return false;
         }
         final LengthConstraintEffectiveImpl other = (LengthConstraintEffectiveImpl) obj;
-        if (description == null) {
-            if (other.description != null) {
-                return false;
-            }
-        } else if (!description.equals(other.description)) {
+        if (!Objects.equals(description, other.description)) {
             return false;
         }
-        if (errorAppTag == null) {
-            if (other.errorAppTag != null) {
-                return false;
-            }
-        } else if (!errorAppTag.equals(other.errorAppTag)) {
+        if (!Objects.equals(errorAppTag, other.errorAppTag)) {
             return false;
         }
-        if (errorMessage == null) {
-            if (other.errorMessage != null) {
-                return false;
-            }
-        } else if (!errorMessage.equals(other.errorMessage)) {
+        if (!Objects.equals(errorMessage, other.errorMessage)) {
             return false;
         }
         if (!Objects.equals(max, other.max)) {
@@ -119,11 +107,7 @@ public class LengthConstraintEffectiveImpl implements LengthConstraint {
         if (!Objects.equals(min, other.min)) {
             return false;
         }
-        if (reference == null) {
-            if (other.reference != null) {
-                return false;
-            }
-        } else if (!reference.equals(other.reference)) {
+        if (!Objects.equals(reference, other.reference)) {
             return false;
         }
         return true;
index e26d69600b247df785c363f3903035bf2a68db0d..e876ac3363c153480732faf880ae39cc6cf4b90a 100644 (file)
@@ -8,17 +8,13 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type;
 
 import java.util.List;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.LengthStatement;
 import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
 public class LengthEffectiveStatementImpl extends EffectiveStatementBase<List<LengthConstraint>, LengthStatement> {
-
-    public LengthEffectiveStatementImpl(StmtContext<List<LengthConstraint>, LengthStatement, ?> ctx) {
+    public LengthEffectiveStatementImpl(final StmtContext<List<LengthConstraint>, LengthStatement, ?> ctx) {
         super(ctx);
-
     }
-
 }
\ No newline at end of file
index 1b8bbc91267885c8de15710b7049ca497139a89b..184ebc401bd57f76d1aa0ef2a1e43fa7265f10f8 100644 (file)
@@ -83,39 +83,19 @@ public class PatternConstraintEffectiveImpl implements PatternConstraint {
             return false;
         }
         final PatternConstraintEffectiveImpl other = (PatternConstraintEffectiveImpl) obj;
-        if (description == null) {
-            if (other.description != null) {
-                return false;
-            }
-        } else if (!description.equals(other.description)) {
+        if (!Objects.equals(description, other.description)) {
             return false;
         }
-        if (errorAppTag == null) {
-            if (other.errorAppTag != null) {
-                return false;
-            }
-        } else if (!errorAppTag.equals(other.errorAppTag)) {
+        if (!Objects.equals(errorAppTag, other.errorAppTag)) {
             return false;
         }
-        if (errorMessage == null) {
-            if (other.errorMessage != null) {
-                return false;
-            }
-        } else if (!errorMessage.equals(other.errorMessage)) {
+        if (!Objects.equals(errorMessage, other.errorMessage)) {
             return false;
         }
-        if (reference == null) {
-            if (other.reference != null) {
-                return false;
-            }
-        } else if (!reference.equals(other.reference)) {
+        if (!Objects.equals(reference, other.reference)) {
             return false;
         }
-        if (regEx == null) {
-            if (other.regEx != null) {
-                return false;
-            }
-        } else if (!regEx.equals(other.regEx)) {
+        if (!Objects.equals(regEx, other.regEx)) {
             return false;
         }
         return true;
index 81f7d2a4d34a041ea52e6edcbd4db41c0b86d88a..c58c185218e6dde57f4c1ada8888d2066014a499 100644 (file)
@@ -13,9 +13,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
 public class PatternEffectiveStatementImpl extends EffectiveStatementBase<PatternConstraint, PatternStatement> {
-
-    public PatternEffectiveStatementImpl(StmtContext<PatternConstraint, PatternStatement, ?> ctx) {
+    public PatternEffectiveStatementImpl(final StmtContext<PatternConstraint, PatternStatement, ?> ctx) {
         super(ctx);
-
     }
 }
\ No newline at end of file
index c2c98686b4a2da097fc591124a603f48a7a4ba38..4308ecb07b80cca83b9ac4f6762f04f65c31c1d4 100644 (file)
@@ -93,32 +93,16 @@ public class RangeConstraintEffectiveImpl implements RangeConstraint {
             return false;
         }
         final RangeConstraintEffectiveImpl other = (RangeConstraintEffectiveImpl) obj;
-        if (description == null) {
-            if (other.description != null) {
-                return false;
-            }
-        } else if (!description.equals(other.description)) {
+        if (!Objects.equals(description, other.description)) {
             return false;
         }
-        if (max == null) {
-            if (other.max != null) {
-                return false;
-            }
-        } else if (!max.equals(other.max)) {
+        if (!Objects.equals(max, other.max)) {
             return false;
         }
-        if (min == null) {
-            if (other.min != null) {
-                return false;
-            }
-        } else if (!min.equals(other.min)) {
+        if (!Objects.equals(min, other.min)) {
             return false;
         }
-        if (reference == null) {
-            if (other.reference != null) {
-                return false;
-            }
-        } else if (!reference.equals(other.reference)) {
+        if (!Objects.equals(reference, other.reference)) {
             return false;
         }
         return true;
index 0c88187c41cbca44b7a2cf2f618df934d984195e..4e97546667f82e819988d437e98221babcbbc676 100644 (file)
@@ -8,15 +8,13 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type;
 
 import java.util.List;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.RangeStatement;
 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
 public class RangeEffectiveStatementImpl extends EffectiveStatementBase<List<RangeConstraint>, RangeStatement> {
-
-    public RangeEffectiveStatementImpl(StmtContext<List<RangeConstraint>, RangeStatement, ?> ctx) {
+    public RangeEffectiveStatementImpl(final StmtContext<List<RangeConstraint>, RangeStatement, ?> ctx) {
         super(ctx);
     }
 }
index 6a7207a6a698665fb6d708f1d44392acb06d7669..06edda620fabb9a1f4d7c91479ce0617d3b828d6 100644 (file)
@@ -132,18 +132,10 @@ public class StringEffectiveStatementImpl extends EffectiveStatementBase<String,
             return false;
         }
         StringEffectiveStatementImpl other = (StringEffectiveStatementImpl) obj;
-        if (lengthConstraints == null) {
-            if (other.lengthConstraints != null) {
-                return false;
-            }
-        } else if (!lengthConstraints.equals(other.lengthConstraints)) {
+        if (!Objects.equals(lengthConstraints, other.lengthConstraints)) {
             return false;
         }
-        if (patternConstraints == null) {
-            if (other.patternConstraints != null) {
-                return false;
-            }
-        } else if (!patternConstraints.equals(other.patternConstraints)) {
+        if (!Objects.equals(patternConstraints, other.patternConstraints)) {
             return false;
         }
         return true;
index dbbd8eaa75764984e7532fd2f92357f4dbdfe084..f49f6cba14c175f18142da93a0c70146dac3fc7e 100644 (file)
@@ -7,14 +7,12 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type;
 
-import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement.StringRestrictions;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
-public class StringRestrictionsEffectiveStatementImpl extends
-        EffectiveStatementBase<String, TypeStatement.StringRestrictions> {
-
-    public StringRestrictionsEffectiveStatementImpl(StmtContext<String, TypeStatement.StringRestrictions, ?> ctx) {
+public class StringRestrictionsEffectiveStatementImpl extends EffectiveStatementBase<String, StringRestrictions> {
+    public StringRestrictionsEffectiveStatementImpl(final StmtContext<String, StringRestrictions, ?> ctx) {
         super(ctx);
     }
 }
index c411d4b2dfb7b267b34c60fedc0093a3210182fc..ba3cd16bc7fcda29def056cbd74587ca7a27d329 100644 (file)
@@ -29,6 +29,6 @@ public class UInt16EffectiveStatementImpl extends UnsignedIntegerEffectiveImplBa
 
     @Override
     public String toString() {
-        return "type " + qName;
+        return "type " + getQName();
     }
 }
index 2e051fc17d4de2b5303737e7f8981630dc3b85b2..ef1c69b078c1d63eb5ad7c6e76942fbb1ffdffa4 100644 (file)
@@ -29,6 +29,6 @@ public class UInt32EffectiveStatementImpl extends UnsignedIntegerEffectiveImplBa
 
     @Override
     public String toString() {
-        return "type " + qName;
+        return "type " + getQName();
     }
 }
index 3f18f8bc48a5394bd7c7d1b1af2ced18c44a2b80..4a07e45ba881950a7af591ef885f52cc1cf07b28 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type;
 
 import java.math.BigInteger;
-
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -31,6 +30,6 @@ public class UInt64EffectiveStatementImpl extends UnsignedIntegerEffectiveImplBa
 
     @Override
     public String toString() {
-        return "type " + qName;
+        return "type " + getQName();
     }
 }
index 04f5d3c3c957d69bd025fd14e54d11141448df64..53197fbb4b7ac880058831f969e677b17fe070e6 100644 (file)
@@ -29,6 +29,6 @@ public class UInt8EffectiveStatementImpl extends UnsignedIntegerEffectiveImplBas
 
     @Override
     public String toString() {
-        return "type " + qName;
+        return "type " + getQName();
     }
 }
index e00fbbdadd2a30e5fa80a7d885a0be4ce4c52fc6..12b9b35bdb2e5adecb78a2955ce7e06e452ec294 100644 (file)
@@ -14,16 +14,16 @@ import java.util.List;
 import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
 
 abstract class UnsignedIntegerEffectiveImplBase extends
         EffectiveStatementBase<String, TypeStatement> implements UnsignedIntegerTypeDefinition {
@@ -31,11 +31,11 @@ abstract class UnsignedIntegerEffectiveImplBase extends
     private static final String REFERENCE_INT = "https://tools.ietf.org/html/rfc6020#section-9.2";
 
     protected static final Number MIN_RANGE = 0;
-    protected QName qName;
-    private SchemaPath path;
-    private String units = "";
+    private final QName qName;
+    private final SchemaPath path;
+    private final String units = "";
     private final String description;
-    private List<RangeConstraint> rangeStatements;
+    private final List<RangeConstraint> rangeStatements;
 
     protected UnsignedIntegerEffectiveImplBase(final StmtContext<String, TypeStatement, EffectiveStatement<String, TypeStatement>> ctx,
             final String localName, final Number maxRange, final String description) {
@@ -127,39 +127,19 @@ abstract class UnsignedIntegerEffectiveImplBase extends
             return false;
         }
         UnsignedIntegerEffectiveImplBase other = (UnsignedIntegerEffectiveImplBase) obj;
-        if (description == null) {
-            if (other.description != null) {
-                return false;
-            }
-        } else if (!description.equals(other.description)) {
+        if (!Objects.equals(description, other.description)) {
             return false;
         }
-        if (qName == null) {
-            if (other.qName != null) {
-                return false;
-            }
-        } else if (!qName.equals(other.qName)) {
+        if (!Objects.equals(qName, other.qName)) {
             return false;
         }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
+        if (!Objects.equals(path, other.path)) {
             return false;
         }
-        if (rangeStatements == null) {
-            if (other.rangeStatements != null) {
-                return false;
-            }
-        } else if (!rangeStatements.equals(other.rangeStatements)) {
+        if (!Objects.equals(rangeStatements, other.rangeStatements)) {
             return false;
         }
-        if (units == null) {
-            if (other.units != null) {
-                return false;
-            }
-        } else if (!units.equals(other.units)) {
+        if (!Objects.equals(units, other.units)) {
             return false;
         }
         return true;