Move more simple statements 59/95159/2
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 13 Feb 2021 12:37:03 +0000 (13:37 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 13 Feb 2021 15:15:32 +0000 (16:15 +0100)
This is big code movement, making most effective statement
implementations available outside of yang-parser-rfc7950.

JIRA: YANGTOOL-1241
Change-Id: Ica9f785552d78c9f89f10ef9172df7bf5d4f79db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
71 files changed:
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/DeclaredStatements.java
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/EffectiveStatements.java
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/decl/EmptyFractionDigitsStatement.java
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/decl/EmptyRequireInstanceStatement.java
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/decl/EmptyStatusStatement.java
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/decl/EmptyYangVersionStatement.java
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/decl/EmptyYinElementStatement.java
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyBelongsToEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/belongs_to/EmptyBelongsToEffectiveStatement.java with 72% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyErrorAppTagEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/error_app_tag/EmptyErrorAppTagEffectiveStatement.java with 71% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyErrorMessageEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/error_message/EmptyErrorMessageEffectiveStatement.java with 71% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyFractionDigitsEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/fraction_digits/EmptyFractionDigitsEffectiveStatement.java with 71% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyIfFeatureEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/if_feature/EmptyIfFeatureEffectiveStatement.java with 73% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyIncludeEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/include/EmptyIncludeEffectiveStatement.java with 72% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyMandatoryEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/mandatory/EmptyMandatoryEffectiveStatement.java with 72% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyMaxElementsEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/max_elements/EmptyMaxElementsEffectiveStatement.java with 71% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyMinElementsEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/min_elements/EmptyMinElementsEffectiveStatement.java with 71% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyNamespaceEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/namespace/EmptyNamespaceEffectiveStatement.java with 73% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyOrderedByEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/ordered_by/EmptyOrderedByEffectiveStatement.java with 73% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyOrganizationEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/organization/EmptyOrganizationEffectiveStatement.java with 71% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyPathEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/path/EmptyPathEffectiveStatement.java with 74% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyPositionEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/position/EmptyPositionEffectiveStatement.java with 74% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyReferenceEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/reference/EmptyReferenceEffectiveStatement.java with 72% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyRequireInstanceEffectiveStatement.java [new file with mode: 0644]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyStatusEffectiveStatement.java [new file with mode: 0644]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyValueEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/value/EmptyValueEffectiveStatement.java with 73% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyYangVersionEffectiveStatement.java [new file with mode: 0644]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyYinElementEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/yin_element/EmptyYinElementEffectiveStatement.java with 72% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularBelongsToEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/belongs_to/RegularBelongsToEffectiveStatement.java with 77% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularErrorAppTagEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/error_app_tag/RegularErrorAppTagEffectiveStatement.java with 77% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularErrorMessageEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/error_message/RegularErrorMessageEffectiveStatement.java with 77% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularFractionDigitsEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/fraction_digits/RegularFractionDigitsEffectiveStatement.java with 76% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularIfFeatureEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/if_feature/RegularIfFeatureEffectiveStatement.java with 78% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularIncludeEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/include/RegularIncludeEffectiveStatement.java with 78% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularMandatoryEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/mandatory/RegularMandatoryEffectiveStatement.java with 77% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularMaxElementsEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/max_elements/RegularMaxElementsEffectiveStatement.java with 77% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularMinElementsEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/min_elements/RegularMinElementsEffectiveStatement.java with 77% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularNamespaceEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/namespace/RegularNamespaceEffectiveStatement.java with 78% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularOrderedByEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/ordered_by/RegularOrderedByEffectiveStatement.java with 78% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularOrganizationEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/organization/RegularOrganizationEffectiveStatement.java with 77% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularPathEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/path/RegularPathEffectiveStatement.java with 79% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularPositionEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/position/RegularPositionEffectiveStatement.java with 79% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularReferenceEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/reference/RegularReferenceEffectiveStatement.java with 77% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularRequireInstanceEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/require_instance/RegularRequireInstanceEffectiveStatement.java with 76% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularStatusEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/status/RegularStatusEffectiveStatement.java with 79% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularValueEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/value/RegularValueEffectiveStatement.java with 78% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularYangVersionEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/yang_version/RegularYangVersionEffectiveStatement.java with 78% similarity]
yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/RegularYinElementEffectiveStatement.java [moved from yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/yin_element/RegularYinElementEffectiveStatement.java with 77% similarity]
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/EffectiveStatementMixins.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/belongs_to/BelongsToStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/error_app_tag/ErrorAppTagStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/error_message/ErrorMessageStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/fraction_digits/FractionDigitsStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/if_feature/AbstractIfFeatureStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/include/IncludeStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/mandatory/MandatoryStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/max_elements/MaxElementsStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/min_elements/MinElementsStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/namespace/NamespaceStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/ordered_by/OrderedByStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/organization/OrganizationStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/path/PathStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/position/PositionStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/reference/ReferenceStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/require_instance/EmptyRequireInstanceEffectiveStatement.java [deleted file]
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/require_instance/RequireInstanceStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/status/EmptyStatusEffectiveStatement.java [deleted file]
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/status/StatusStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/value/ValueStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/yang_version/EmptyYangVersionEffectiveStatement.java [deleted file]
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/yang_version/YangVersionStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/yin_element/YinElementStatementSupport.java

index c8c125b45ac6e76465d93d1b9b9631c3923f67c5..e2ecc308abc5d22d9d4b9ee27228d03fdcf4dfda 100644 (file)
@@ -438,8 +438,8 @@ public final class DeclaredStatements {
         return substatements.isEmpty() ? createFeature(argument) : new RegularFeatureStatement(argument, substatements);
     }
 
-    public static FractionDigitsStatement createFractionDigits(final Integer argument) {
-        return new EmptyFractionDigitsStatement(argument);
+    public static FractionDigitsStatement createFractionDigits(final int argument) {
+        return EmptyFractionDigitsStatement.of(argument);
     }
 
     public static FractionDigitsStatement createFractionDigits(final Integer argument,
@@ -736,8 +736,8 @@ public final class DeclaredStatements {
         return new RefineStatementImpl(rawArgument, argument, substatements);
     }
 
-    public static RequireInstanceStatement createRequireInstance(final Boolean argument) {
-        return new EmptyRequireInstanceStatement(argument);
+    public static RequireInstanceStatement createRequireInstance(final boolean argument) {
+        return argument ? EmptyRequireInstanceStatement.TRUE : EmptyRequireInstanceStatement.FALSE;
     }
 
     public static RequireInstanceStatement createRequireInstance(final Boolean argument,
@@ -776,7 +776,16 @@ public final class DeclaredStatements {
     }
 
     public static StatusStatement createStatus(final Status argument) {
-        return new EmptyStatusStatement(argument);
+        switch (argument) {
+            case CURRENT:
+                return EmptyStatusStatement.CURRENT;
+            case DEPRECATED:
+                return EmptyStatusStatement.DEPRECATED;
+            case OBSOLETE:
+                return EmptyStatusStatement.OBSOLETE;
+            default:
+                throw new IllegalStateException("Unhandled argument " + argument);
+        }
     }
 
     public static StatusStatement createStatus(final Status argument,
@@ -856,7 +865,14 @@ public final class DeclaredStatements {
     }
 
     public static YangVersionStatement createYangVersion(final YangVersion argument) {
-        return new EmptyYangVersionStatement(argument);
+        switch (argument) {
+            case VERSION_1:
+                return EmptyYangVersionStatement.VERSION_1;
+            case VERSION_1_1:
+                return EmptyYangVersionStatement.VERSION_1_1;
+            default:
+                throw new IllegalStateException("Unhandled version " + argument);
+        }
     }
 
     public static YangVersionStatement createYangVersion(final YangVersion argument,
@@ -865,8 +881,8 @@ public final class DeclaredStatements {
             : new RegularYangVersionStatement(argument, substatements);
     }
 
-    public static YinElementStatement createYinElement(final Boolean argument) {
-        return new EmptyYinElementStatement(argument);
+    public static YinElementStatement createYinElement(final boolean argument) {
+        return argument ? EmptyYinElementStatement.TRUE : EmptyYinElementStatement.FALSE;
     }
 
     public static YinElementStatement createYinElement(final Boolean argument,
index cefa5ecbf37f2758ece35f69fb9a511166e7a7cc..59d3b1891d168125b3df7e90c19ffea1f386520e 100644 (file)
@@ -15,34 +15,117 @@ import org.opendaylight.yangtools.yang.model.api.stmt.ArgumentEffectiveStatement
 import org.opendaylight.yangtools.yang.model.api.stmt.ArgumentStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.BaseEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.BaseStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IncludeEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModifierEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModifierStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PathEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PositionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PresenceEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.UnitsEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ValueEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.WhenEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.WhenStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YinElementEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyRequireInstanceStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyStatusStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyYangVersionStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyArgumentEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyBaseEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyBelongsToEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyDescriptionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyErrorAppTagEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyErrorMessageEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyFractionDigitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyIfFeatureEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyIncludeEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyMandatoryEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyMaxElementsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyMinElementsEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyModifierEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyNamespaceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyOrderedByEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyOrganizationEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyPathEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyPositionEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyPresenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyReferenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyRequireInstanceEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyRevisionDateEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyStatusEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyUnitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyValueEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyWhenEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyYangVersionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.EmptyYinElementEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularArgumentEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularBaseEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularBelongsToEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularDescriptionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularErrorAppTagEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularErrorMessageEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularFractionDigitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularIfFeatureEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularIncludeEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularMandatoryEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularMaxElementsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularMinElementsEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularModifierEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularNamespaceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularOrderedByEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularOrganizationEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularPathEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularPositionEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularPresenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularReferenceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularRequireInstanceEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularRevisionDateEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularStatusEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularUnitsEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularValueEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularWhenEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularYangVersionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff.RegularYinElementEffectiveStatement;
 
 /**
  * Static entry point to instantiating {@link EffectiveStatement} covered in the {@code RFC7950} metamodel.
@@ -66,39 +149,236 @@ public final class EffectiveStatements {
             : new RegularBaseEffectiveStatement(declared, substatements);
     }
 
+    public static BelongsToEffectiveStatement createBelongsTo(final BelongsToStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? new EmptyBelongsToEffectiveStatement(declared)
+            : new RegularBelongsToEffectiveStatement(declared, substatements);
+    }
+
     public static DescriptionEffectiveStatement createDescription(final DescriptionStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         return substatements.isEmpty() ? new EmptyDescriptionEffectiveStatement(declared)
             : new RegularDescriptionEffectiveStatement(declared, substatements);
     }
 
+    public static ErrorAppTagEffectiveStatement createErrorAppTag(final ErrorAppTagStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? new EmptyErrorAppTagEffectiveStatement(declared)
+            : new RegularErrorAppTagEffectiveStatement(declared, substatements);
+    }
+
+    public static ErrorMessageEffectiveStatement createErrorMessage(final ErrorMessageStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? new EmptyErrorMessageEffectiveStatement(declared)
+            : new RegularErrorMessageEffectiveStatement(declared, substatements);
+    }
+
+    public static FractionDigitsEffectiveStatement createFractionDigits(final FractionDigitsStatement declared) {
+        return new EmptyFractionDigitsEffectiveStatement(declared);
+    }
+
+    public static FractionDigitsEffectiveStatement createFractionDigits(final FractionDigitsStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createFractionDigits(declared)
+            : new RegularFractionDigitsEffectiveStatement(declared, substatements);
+    }
+
+    public static IfFeatureEffectiveStatement createIfFeature(final IfFeatureStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? new EmptyIfFeatureEffectiveStatement(declared)
+            : new RegularIfFeatureEffectiveStatement(declared, substatements);
+    }
+
+    public static IncludeEffectiveStatement createInclude(final IncludeStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? new EmptyIncludeEffectiveStatement(declared)
+            : new RegularIncludeEffectiveStatement(declared, substatements);
+    }
+
+    public static MandatoryEffectiveStatement createMandatory(final MandatoryStatement declared) {
+        return new EmptyMandatoryEffectiveStatement(declared);
+    }
+
+    public static MandatoryEffectiveStatement createMandatory(final MandatoryStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createMandatory(declared)
+            : new RegularMandatoryEffectiveStatement(declared, substatements);
+    }
+
+    public static MaxElementsEffectiveStatement createMaxElements(final MaxElementsStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? new EmptyMaxElementsEffectiveStatement(declared)
+            : new RegularMaxElementsEffectiveStatement(declared, substatements);
+    }
+
+    public static MinElementsEffectiveStatement createMinElements(final MinElementsStatement declared) {
+        return new EmptyMinElementsEffectiveStatement(declared);
+    }
+
+    public static MinElementsEffectiveStatement createMinElements(final MinElementsStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createMinElements(declared)
+            : new RegularMinElementsEffectiveStatement(declared, substatements);
+    }
+
     public static ModifierEffectiveStatement createModifier(final ModifierStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         return substatements.isEmpty() ? new EmptyModifierEffectiveStatement(declared)
             : new RegularModifierEffectiveStatement(declared, substatements);
     }
 
+    public static NamespaceEffectiveStatement createNamespace(final NamespaceStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? new EmptyNamespaceEffectiveStatement(declared)
+            : new RegularNamespaceEffectiveStatement(declared, substatements);
+    }
+
+    public static OrderedByEffectiveStatement createOrderedBy(final OrderedByStatement declared) {
+        return new EmptyOrderedByEffectiveStatement(declared);
+    }
+
+    public static OrderedByEffectiveStatement createOrderedBy(final OrderedByStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createOrderedBy(declared)
+            : new RegularOrderedByEffectiveStatement(declared, substatements);
+    }
+
+    public static OrganizationEffectiveStatement createOrganization(final OrganizationStatement declared) {
+        return new EmptyOrganizationEffectiveStatement(declared);
+    }
+
+    public static OrganizationEffectiveStatement createOrganization(final OrganizationStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createOrganization(declared)
+            : new RegularOrganizationEffectiveStatement(declared, substatements);
+    }
+
+    public static PathEffectiveStatement createPath(final PathStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? new EmptyPathEffectiveStatement(declared)
+            : new RegularPathEffectiveStatement(declared, substatements);
+    }
+
+    public static PositionEffectiveStatement createPosition(final PositionStatement declared) {
+        return new EmptyPositionEffectiveStatement(declared);
+    }
+
+    public static PositionEffectiveStatement createPosition(final PositionStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createPosition(declared)
+            : new RegularPositionEffectiveStatement(declared, substatements);
+    }
+
+    public static ReferenceEffectiveStatement createReference(final ReferenceStatement declared) {
+        return new EmptyReferenceEffectiveStatement(declared);
+    }
+
+    public static ReferenceEffectiveStatement createReference(final ReferenceStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createReference(declared)
+            : new RegularReferenceEffectiveStatement(declared, substatements);
+    }
+
     public static PresenceEffectiveStatement createPresence(final PresenceStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         return substatements.isEmpty() ? new EmptyPresenceEffectiveStatement(declared)
             : new RegularPresenceEffectiveStatement(declared, substatements);
     }
 
+    public static RequireInstanceEffectiveStatement createRequireInstance(final boolean argument) {
+        return argument ? EmptyRequireInstanceEffectiveStatement.TRUE : EmptyRequireInstanceEffectiveStatement.FALSE;
+    }
+
+    public static RequireInstanceEffectiveStatement createRequireInstance(final RequireInstanceStatement declared) {
+        if (EmptyRequireInstanceStatement.TRUE.equals(declared)) {
+            return EmptyRequireInstanceEffectiveStatement.TRUE;
+        } else if (EmptyRequireInstanceStatement.FALSE.equals(declared)) {
+            return EmptyRequireInstanceEffectiveStatement.FALSE;
+        } else {
+            return new EmptyRequireInstanceEffectiveStatement(declared);
+        }
+    }
+
+    public static RequireInstanceEffectiveStatement createRequireInstance(final RequireInstanceStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createRequireInstance(declared)
+            : new RegularRequireInstanceEffectiveStatement(declared, substatements);
+    }
+
     public static RevisionDateEffectiveStatement createRevisionDate(final RevisionDateStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         return substatements.isEmpty() ? new EmptyRevisionDateEffectiveStatement(declared)
             : new RegularRevisionDateEffectiveStatement(declared, substatements);
     }
 
+    public static StatusEffectiveStatement createStatus(final StatusStatement declared) {
+        // Aggressively reuse effective instances which are backed by the corresponding empty declared instance, as this
+        // is the case unless there is a weird extension in use.
+        if (EmptyStatusStatement.DEPRECATED.equals(declared)) {
+            // Most likely to be seen (as current is the default)
+            return EmptyStatusEffectiveStatement.DEPRECATED;
+        } else if (EmptyStatusStatement.OBSOLETE.equals(declared)) {
+            // less likely
+            return EmptyStatusEffectiveStatement.OBSOLETE;
+        } else if (EmptyStatusStatement.CURRENT.equals(declared)) {
+            // ... okay, why is this there? :)
+            return EmptyStatusEffectiveStatement.CURRENT;
+        } else {
+            return new EmptyStatusEffectiveStatement(declared);
+        }
+    }
+
+    public static StatusEffectiveStatement createStatus(final StatusStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createStatus(declared)
+            : new RegularStatusEffectiveStatement(declared, substatements);
+    }
+
     public static UnitsEffectiveStatement createUnits(final UnitsStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         return substatements.isEmpty() ? new EmptyUnitsEffectiveStatement(declared)
             : new RegularUnitsEffectiveStatement(declared, substatements);
     }
 
+    public static ValueEffectiveStatement createValue(final ValueStatement declared) {
+        return new EmptyValueEffectiveStatement(declared);
+    }
+
+    public static ValueEffectiveStatement createValue(final ValueStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createValue(declared)
+            : new RegularValueEffectiveStatement(declared, substatements);
+    }
+
     public static WhenEffectiveStatement createWhen(final WhenStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         return substatements.isEmpty() ? new EmptyWhenEffectiveStatement(declared)
             : new RegularWhenEffectiveStatement(declared, substatements);
     }
+
+    public static YangVersionEffectiveStatement createYangVersion(final YangVersionStatement declared) {
+        if (EmptyYangVersionStatement.VERSION_1.equals(declared)) {
+            return EmptyYangVersionEffectiveStatement.VERSION_1;
+        } else if (EmptyYangVersionStatement.VERSION_1_1.equals(declared)) {
+            return EmptyYangVersionEffectiveStatement.VERSION_1_1;
+        } else {
+            return new EmptyYangVersionEffectiveStatement(declared);
+        }
+    }
+
+    public static YangVersionEffectiveStatement createYangVersion(final YangVersionStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createYangVersion(declared)
+            : new RegularYangVersionEffectiveStatement(declared, substatements);
+    }
+
+    public static YinElementEffectiveStatement createYinElement(final YinElementStatement declared) {
+        return new EmptyYinElementEffectiveStatement(declared);
+    }
+
+    public static YinElementEffectiveStatement createYinElement(final YinElementStatement declared,
+        final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        return substatements.isEmpty() ? createYinElement(declared)
+            : new RegularYinElementEffectiveStatement(declared, substatements);
+    }
 }
index f693f7ca1f139ac11a4096e739ba05dff5a0e019..b283a88e275804f2d4a75ae9b31cdf19742646ed 100644 (file)
@@ -7,11 +7,30 @@
  */
 package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.ArgumentToString;
 
 public final class EmptyFractionDigitsStatement extends ArgumentToString<Integer> implements FractionDigitsStatement {
-    public EmptyFractionDigitsStatement(final Integer argument) {
+    private static final @NonNull EmptyFractionDigitsStatement[] INSTANCES;
+
+    static {
+        final EmptyFractionDigitsStatement[] inst = new EmptyFractionDigitsStatement[18];
+        for (int i = 0; i < 18; ++i) {
+            inst[i] =  new EmptyFractionDigitsStatement(i + 1);
+        }
+        INSTANCES = inst;
+    }
+
+    private EmptyFractionDigitsStatement(final int argument) {
         super(argument);
     }
+
+    public static @NonNull EmptyFractionDigitsStatement of(final int argument) {
+        try {
+            return INSTANCES[argument - 1];
+        } catch (IndexOutOfBoundsException e) {
+            throw new IllegalArgumentException("Invalid fraction-digits argument " + argument, e);
+        }
+    }
 }
index bd50ca72baabac30e8346db8c5205ef837b52af7..97b6814ab23913d1c8df72bb5674cd5cbb5c7448 100644 (file)
@@ -7,11 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.ArgumentToString;
 
 public final class EmptyRequireInstanceStatement extends ArgumentToString<Boolean> implements RequireInstanceStatement {
-    public EmptyRequireInstanceStatement(final Boolean argument) {
+    public static final @NonNull EmptyRequireInstanceStatement FALSE = new EmptyRequireInstanceStatement(false);
+    public static final @NonNull EmptyRequireInstanceStatement TRUE = new EmptyRequireInstanceStatement(true);
+
+    private EmptyRequireInstanceStatement(final boolean argument) {
         super(argument);
     }
 }
index f59e9159a405b14cbd7fbce4ddbc95d880694600..9e7de9029f3f627fc7bcbeff2b36f132b496b7ca 100644 (file)
@@ -7,10 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.Status;
 
 public final class EmptyStatusStatement extends AbstractStatusStatement {
-    public EmptyStatusStatement(final Status argument) {
+    public static final @NonNull EmptyStatusStatement CURRENT = new EmptyStatusStatement(Status.CURRENT);
+    public static final @NonNull EmptyStatusStatement DEPRECATED = new EmptyStatusStatement(Status.DEPRECATED);
+    public static final @NonNull EmptyStatusStatement OBSOLETE = new EmptyStatusStatement(Status.OBSOLETE);
+
+    private EmptyStatusStatement(final Status argument) {
         super(argument);
     }
 }
index 37bf0d3ef8216d13dedaac223b63892e281d8cd5..55bb48470e448b8a532d53516d1425359de7bb59 100644 (file)
@@ -7,12 +7,18 @@
  */
 package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.YangVersion;
 import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.ArgumentToString;
 
 public final class EmptyYangVersionStatement extends ArgumentToString<YangVersion> implements YangVersionStatement {
-    public EmptyYangVersionStatement(final YangVersion argument) {
+    public static final @NonNull EmptyYangVersionStatement VERSION_1 =
+        new EmptyYangVersionStatement(YangVersion.VERSION_1);
+    public static final @NonNull EmptyYangVersionStatement VERSION_1_1 =
+        new EmptyYangVersionStatement(YangVersion.VERSION_1_1);
+
+    private EmptyYangVersionStatement(final @NonNull YangVersion argument) {
         super(argument);
     }
 }
index 30c33b766605cbaaad5ee995d06b6b6119dc4228..9607437054d177f5fa7a3c4f692967aaea2f5ae6 100644 (file)
@@ -7,11 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.ArgumentToString;
 
 public final class EmptyYinElementStatement extends ArgumentToString<Boolean> implements YinElementStatement {
-    public EmptyYinElementStatement(final Boolean argument) {
+    public static final @NonNull EmptyYinElementStatement FALSE = new EmptyYinElementStatement(false);
+    public static final @NonNull EmptyYinElementStatement TRUE = new EmptyYinElementStatement(true);
+
+    private EmptyYinElementStatement(final boolean argument) {
         super(argument);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.belongs_to;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyBelongsToEffectiveStatement extends DefaultArgument<String, BelongsToStatement>
+public final class EmptyBelongsToEffectiveStatement extends DefaultArgument<String, BelongsToStatement>
         implements BelongsToEffectiveStatement {
-    EmptyBelongsToEffectiveStatement(final BelongsToStatement declared) {
+    public EmptyBelongsToEffectiveStatement(final BelongsToStatement declared) {
         super(declared);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_app_tag;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyErrorAppTagEffectiveStatement extends DefaultArgument<String, ErrorAppTagStatement>
+public final class EmptyErrorAppTagEffectiveStatement extends DefaultArgument<String, ErrorAppTagStatement>
         implements ErrorAppTagEffectiveStatement {
-    EmptyErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared) {
+    public EmptyErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared) {
         super(declared);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_message;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyErrorMessageEffectiveStatement extends DefaultArgument<String, ErrorMessageStatement>
+public final class EmptyErrorMessageEffectiveStatement extends DefaultArgument<String, ErrorMessageStatement>
         implements ErrorMessageEffectiveStatement {
-    EmptyErrorMessageEffectiveStatement(final ErrorMessageStatement declared) {
+    public EmptyErrorMessageEffectiveStatement(final ErrorMessageStatement declared) {
         super(declared);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.fraction_digits;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyFractionDigitsEffectiveStatement extends DefaultArgument<Integer, FractionDigitsStatement>
+public final class EmptyFractionDigitsEffectiveStatement extends DefaultArgument<Integer, FractionDigitsStatement>
         implements FractionDigitsEffectiveStatement {
-    EmptyFractionDigitsEffectiveStatement(final FractionDigitsStatement declared) {
+    public EmptyFractionDigitsEffectiveStatement(final FractionDigitsStatement declared) {
         super(declared);
     }
 }
@@ -5,16 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.if_feature;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureExpr;
 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyIfFeatureEffectiveStatement extends DefaultArgument<IfFeatureExpr, IfFeatureStatement>
+public final class EmptyIfFeatureEffectiveStatement extends DefaultArgument<IfFeatureExpr, IfFeatureStatement>
         implements IfFeatureEffectiveStatement {
-    EmptyIfFeatureEffectiveStatement(final IfFeatureStatement declared) {
+    public EmptyIfFeatureEffectiveStatement(final IfFeatureStatement declared) {
         super(declared);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.include;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.IncludeEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyIncludeEffectiveStatement extends DefaultArgument<String, IncludeStatement>
+public final class EmptyIncludeEffectiveStatement extends DefaultArgument<String, IncludeStatement>
         implements IncludeEffectiveStatement {
-    EmptyIncludeEffectiveStatement(final IncludeStatement declared) {
+    public EmptyIncludeEffectiveStatement(final IncludeStatement declared) {
         super(declared);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.mandatory;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyMandatoryEffectiveStatement extends DefaultArgument<Boolean, MandatoryStatement>
+public final class EmptyMandatoryEffectiveStatement extends DefaultArgument<Boolean, MandatoryStatement>
         implements MandatoryEffectiveStatement {
-    EmptyMandatoryEffectiveStatement(final MandatoryStatement declared) {
+    public EmptyMandatoryEffectiveStatement(final MandatoryStatement declared) {
         super(declared);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.max_elements;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyMaxElementsEffectiveStatement extends DefaultArgument<String, MaxElementsStatement>
+public final class EmptyMaxElementsEffectiveStatement extends DefaultArgument<String, MaxElementsStatement>
         implements MaxElementsEffectiveStatement {
-    EmptyMaxElementsEffectiveStatement(final MaxElementsStatement declared) {
+    public EmptyMaxElementsEffectiveStatement(final MaxElementsStatement declared) {
         super(declared);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.min_elements;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyMinElementsEffectiveStatement extends DefaultArgument<Integer, MinElementsStatement>
+public final class EmptyMinElementsEffectiveStatement extends DefaultArgument<Integer, MinElementsStatement>
         implements MinElementsEffectiveStatement {
-    EmptyMinElementsEffectiveStatement(final MinElementsStatement declared) {
+    public EmptyMinElementsEffectiveStatement(final MinElementsStatement declared) {
         super(declared);
     }
 }
@@ -5,16 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.namespace;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.common.XMLNamespace;
 import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyNamespaceEffectiveStatement extends DefaultArgument<XMLNamespace, NamespaceStatement>
+public final class EmptyNamespaceEffectiveStatement extends DefaultArgument<XMLNamespace, NamespaceStatement>
         implements NamespaceEffectiveStatement {
-    EmptyNamespaceEffectiveStatement(final NamespaceStatement declared) {
+    public EmptyNamespaceEffectiveStatement(final NamespaceStatement declared) {
         super(declared);
     }
 }
@@ -5,16 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.ordered_by;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.common.Ordering;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyOrderedByEffectiveStatement extends DefaultArgument<Ordering, OrderedByStatement>
+public final class EmptyOrderedByEffectiveStatement extends DefaultArgument<Ordering, OrderedByStatement>
         implements OrderedByEffectiveStatement {
-    EmptyOrderedByEffectiveStatement(final OrderedByStatement declared) {
+    public EmptyOrderedByEffectiveStatement(final OrderedByStatement declared) {
         super(declared);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.organization;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyOrganizationEffectiveStatement extends DefaultArgument<String, OrganizationStatement>
+public final class EmptyOrganizationEffectiveStatement extends DefaultArgument<String, OrganizationStatement>
         implements OrganizationEffectiveStatement {
-    EmptyOrganizationEffectiveStatement(final OrganizationStatement declared) {
+    public EmptyOrganizationEffectiveStatement(final OrganizationStatement declared) {
         super(declared);
     }
 }
@@ -5,16 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.path;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.PathExpression;
 import org.opendaylight.yangtools.yang.model.api.stmt.PathEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyPathEffectiveStatement extends DefaultArgument<PathExpression, PathStatement>
+public final class EmptyPathEffectiveStatement extends DefaultArgument<PathExpression, PathStatement>
         implements PathEffectiveStatement {
-    EmptyPathEffectiveStatement(final PathStatement declared) {
+    public EmptyPathEffectiveStatement(final PathStatement declared) {
         super(declared);
     }
 }
@@ -5,16 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.position;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.model.api.stmt.PositionEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyPositionEffectiveStatement extends DefaultArgument<Uint32, PositionStatement>
+public final class EmptyPositionEffectiveStatement extends DefaultArgument<Uint32, PositionStatement>
         implements PositionEffectiveStatement {
-    EmptyPositionEffectiveStatement(final PositionStatement declared) {
+    public EmptyPositionEffectiveStatement(final PositionStatement declared) {
         super(declared);
     }
 }
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.reference;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyReferenceEffectiveStatement extends DefaultArgument<String, ReferenceStatement>
+public final class EmptyReferenceEffectiveStatement extends DefaultArgument<String, ReferenceStatement>
         implements ReferenceEffectiveStatement {
-    EmptyReferenceEffectiveStatement(final ReferenceStatement declared) {
+    public EmptyReferenceEffectiveStatement(final ReferenceStatement declared) {
         super(declared);
     }
 }
diff --git a/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyRequireInstanceEffectiveStatement.java b/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyRequireInstanceEffectiveStatement.java
new file mode 100644 (file)
index 0000000..b0c7851
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
+import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyRequireInstanceStatement;
+
+public final class EmptyRequireInstanceEffectiveStatement extends DefaultArgument<Boolean, RequireInstanceStatement>
+        implements RequireInstanceEffectiveStatement {
+    public static final @NonNull EmptyRequireInstanceEffectiveStatement FALSE =
+        new EmptyRequireInstanceEffectiveStatement(EmptyRequireInstanceStatement.FALSE);
+    public static final @NonNull EmptyRequireInstanceEffectiveStatement TRUE =
+        new EmptyRequireInstanceEffectiveStatement(EmptyRequireInstanceStatement.TRUE);
+
+    public EmptyRequireInstanceEffectiveStatement(final RequireInstanceStatement declared) {
+        super(declared);
+    }
+}
diff --git a/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyStatusEffectiveStatement.java b/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyStatusEffectiveStatement.java
new file mode 100644 (file)
index 0000000..eb904ec
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
+import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyStatusStatement;
+
+public final class EmptyStatusEffectiveStatement extends DefaultArgument<Status, StatusStatement>
+        implements StatusEffectiveStatement {
+    /*
+     * status has low argument cardinality, hence we can reuse them in case declaration does not have any
+     * substatements (which is the usual case). Yeah, we could consider an EnumMap, but this is not too bad, either.
+     */
+    public static final @NonNull EmptyStatusEffectiveStatement CURRENT =
+        new EmptyStatusEffectiveStatement(EmptyStatusStatement.CURRENT);
+    public static final @NonNull EmptyStatusEffectiveStatement DEPRECATED =
+        new EmptyStatusEffectiveStatement(EmptyStatusStatement.DEPRECATED);
+    public static final @NonNull EmptyStatusEffectiveStatement OBSOLETE =
+        new EmptyStatusEffectiveStatement(EmptyStatusStatement.OBSOLETE);
+
+    public EmptyStatusEffectiveStatement(final StatusStatement declared) {
+        super(declared);
+    }
+}
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.value;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.ValueEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyValueEffectiveStatement extends DefaultArgument<Integer, ValueStatement>
+public final class EmptyValueEffectiveStatement extends DefaultArgument<Integer, ValueStatement>
         implements ValueEffectiveStatement {
-    EmptyValueEffectiveStatement(final ValueStatement declared) {
+    public EmptyValueEffectiveStatement(final ValueStatement declared) {
         super(declared);
     }
 }
diff --git a/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyYangVersionEffectiveStatement.java b/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/stmt/impl/eff/EmptyYangVersionEffectiveStatement.java
new file mode 100644 (file)
index 0000000..c46826d
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.common.YangVersion;
+import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
+import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
+import org.opendaylight.yangtools.yang.model.spi.stmt.impl.decl.EmptyYangVersionStatement;
+
+public final class EmptyYangVersionEffectiveStatement extends DefaultArgument<YangVersion, YangVersionStatement>
+        implements YangVersionEffectiveStatement {
+    public static final @NonNull EmptyYangVersionEffectiveStatement VERSION_1 =
+        new EmptyYangVersionEffectiveStatement(EmptyYangVersionStatement.VERSION_1);
+    public static final @NonNull EmptyYangVersionEffectiveStatement VERSION_1_1 =
+        new EmptyYangVersionEffectiveStatement(EmptyYangVersionStatement.VERSION_1_1);
+
+    public EmptyYangVersionEffectiveStatement(final YangVersionStatement declared) {
+        super(declared);
+    }
+}
@@ -5,15 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yin_element;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.YinElementEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
 
-final class EmptyYinElementEffectiveStatement extends DefaultArgument<Boolean, YinElementStatement>
+public final class EmptyYinElementEffectiveStatement extends DefaultArgument<Boolean, YinElementStatement>
         implements YinElementEffectiveStatement {
-    EmptyYinElementEffectiveStatement(final YinElementStatement declared) {
+    public EmptyYinElementEffectiveStatement(final YinElementStatement declared) {
         super(declared);
     }
 }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.belongs_to;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToEffectiveStatemen
 import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularBelongsToEffectiveStatement extends WithSubstatements<String, BelongsToStatement>
+public final class RegularBelongsToEffectiveStatement extends WithSubstatements<String, BelongsToStatement>
         implements BelongsToEffectiveStatement {
-    RegularBelongsToEffectiveStatement(final BelongsToStatement declared,
+    public RegularBelongsToEffectiveStatement(final BelongsToStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_app_tag;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagEffectiveStatem
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularErrorAppTagEffectiveStatement extends WithSubstatements<String, ErrorAppTagStatement>
+public final class RegularErrorAppTagEffectiveStatement extends WithSubstatements<String, ErrorAppTagStatement>
         implements ErrorAppTagEffectiveStatement {
-    RegularErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared,
+    public RegularErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_message;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageEffectiveState
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularErrorMessageEffectiveStatement extends WithSubstatements<String, ErrorMessageStatement>
+public final class RegularErrorMessageEffectiveStatement extends WithSubstatements<String, ErrorMessageStatement>
         implements ErrorMessageEffectiveStatement {
-    RegularErrorMessageEffectiveStatement(final ErrorMessageStatement declared,
+    public RegularErrorMessageEffectiveStatement(final ErrorMessageStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.fraction_digits;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsEffectiveSta
 import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularFractionDigitsEffectiveStatement extends WithSubstatements<Integer, FractionDigitsStatement>
+public final class RegularFractionDigitsEffectiveStatement extends WithSubstatements<Integer, FractionDigitsStatement>
         implements FractionDigitsEffectiveStatement {
-    RegularFractionDigitsEffectiveStatement(final FractionDigitsStatement declared,
+    public RegularFractionDigitsEffectiveStatement(final FractionDigitsStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.if_feature;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -14,9 +14,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureExpr;
 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularIfFeatureEffectiveStatement extends WithSubstatements<IfFeatureExpr, IfFeatureStatement>
+public final class RegularIfFeatureEffectiveStatement extends WithSubstatements<IfFeatureExpr, IfFeatureStatement>
         implements IfFeatureEffectiveStatement {
-    RegularIfFeatureEffectiveStatement(final IfFeatureStatement declared,
+    public RegularIfFeatureEffectiveStatement(final IfFeatureStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.include;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.IncludeEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularIncludeEffectiveStatement extends WithSubstatements<String, IncludeStatement>
+public final class RegularIncludeEffectiveStatement extends WithSubstatements<String, IncludeStatement>
         implements IncludeEffectiveStatement {
-    RegularIncludeEffectiveStatement(final IncludeStatement declared,
+    public RegularIncludeEffectiveStatement(final IncludeStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.mandatory;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryEffectiveStatemen
 import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularMandatoryEffectiveStatement extends WithSubstatements<Boolean, MandatoryStatement>
+public final class RegularMandatoryEffectiveStatement extends WithSubstatements<Boolean, MandatoryStatement>
         implements MandatoryEffectiveStatement {
-    RegularMandatoryEffectiveStatement(final MandatoryStatement declared,
+    public RegularMandatoryEffectiveStatement(final MandatoryStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.max_elements;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsEffectiveStatem
 import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularMaxElementsEffectiveStatement extends WithSubstatements<String, MaxElementsStatement>
+public final class RegularMaxElementsEffectiveStatement extends WithSubstatements<String, MaxElementsStatement>
         implements MaxElementsEffectiveStatement {
-    RegularMaxElementsEffectiveStatement(final MaxElementsStatement declared,
+    public RegularMaxElementsEffectiveStatement(final MaxElementsStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.min_elements;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsEffectiveStatem
 import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularMinElementsEffectiveStatement extends WithSubstatements<Integer, MinElementsStatement>
+public final class RegularMinElementsEffectiveStatement extends WithSubstatements<Integer, MinElementsStatement>
         implements MinElementsEffectiveStatement {
-    RegularMinElementsEffectiveStatement(final MinElementsStatement declared,
+    public RegularMinElementsEffectiveStatement(final MinElementsStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.namespace;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.common.XMLNamespace;
@@ -14,9 +14,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceEffectiveStatemen
 import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularNamespaceEffectiveStatement extends WithSubstatements<XMLNamespace, NamespaceStatement>
+public final class RegularNamespaceEffectiveStatement extends WithSubstatements<XMLNamespace, NamespaceStatement>
         implements NamespaceEffectiveStatement {
-    RegularNamespaceEffectiveStatement(final NamespaceStatement declared,
+    public RegularNamespaceEffectiveStatement(final NamespaceStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.ordered_by;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.common.Ordering;
@@ -14,9 +14,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatemen
 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularOrderedByEffectiveStatement extends WithSubstatements<Ordering, OrderedByStatement>
+public final class RegularOrderedByEffectiveStatement extends WithSubstatements<Ordering, OrderedByStatement>
         implements OrderedByEffectiveStatement {
-    RegularOrderedByEffectiveStatement(final OrderedByStatement declared,
+    public RegularOrderedByEffectiveStatement(final OrderedByStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.organization;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationEffectiveState
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularOrganizationEffectiveStatement extends WithSubstatements<String, OrganizationStatement>
+public final class RegularOrganizationEffectiveStatement extends WithSubstatements<String, OrganizationStatement>
         implements OrganizationEffectiveStatement {
-    RegularOrganizationEffectiveStatement(final OrganizationStatement declared,
+    public RegularOrganizationEffectiveStatement(final OrganizationStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.path;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.PathExpression;
@@ -14,9 +14,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.PathEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularPathEffectiveStatement extends WithSubstatements<PathExpression, PathStatement>
+public final class RegularPathEffectiveStatement extends WithSubstatements<PathExpression, PathStatement>
         implements PathEffectiveStatement {
-    RegularPathEffectiveStatement(final PathStatement declared,
+    public RegularPathEffectiveStatement(final PathStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.position;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.common.Uint32;
@@ -14,9 +14,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.PositionEffectiveStatement
 import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularPositionEffectiveStatement extends WithSubstatements<Uint32, PositionStatement>
+public final class RegularPositionEffectiveStatement extends WithSubstatements<Uint32, PositionStatement>
         implements PositionEffectiveStatement {
-    RegularPositionEffectiveStatement(final PositionStatement declared,
+    public RegularPositionEffectiveStatement(final PositionStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.reference;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatemen
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularReferenceEffectiveStatement extends WithSubstatements<String, ReferenceStatement>
+public final class RegularReferenceEffectiveStatement extends WithSubstatements<String, ReferenceStatement>
         implements ReferenceEffectiveStatement {
-    RegularReferenceEffectiveStatement(final ReferenceStatement declared,
+    public RegularReferenceEffectiveStatement(final ReferenceStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.require_instance;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveSt
 import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularRequireInstanceEffectiveStatement extends WithSubstatements<Boolean, RequireInstanceStatement>
+public final class RegularRequireInstanceEffectiveStatement extends WithSubstatements<Boolean, RequireInstanceStatement>
         implements RequireInstanceEffectiveStatement {
-    RegularRequireInstanceEffectiveStatement(final RequireInstanceStatement declared,
+    public RegularRequireInstanceEffectiveStatement(final RequireInstanceStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.status;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.Status;
@@ -14,9 +14,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularStatusEffectiveStatement extends WithSubstatements<Status, StatusStatement>
+public final class RegularStatusEffectiveStatement extends WithSubstatements<Status, StatusStatement>
         implements StatusEffectiveStatement {
-    RegularStatusEffectiveStatement(final StatusStatement declared,
+    public RegularStatusEffectiveStatement(final StatusStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.value;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.ValueEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularValueEffectiveStatement extends WithSubstatements<Integer, ValueStatement>
+public final class RegularValueEffectiveStatement extends WithSubstatements<Integer, ValueStatement>
         implements ValueEffectiveStatement {
-    RegularValueEffectiveStatement(final ValueStatement declared,
+    public RegularValueEffectiveStatement(final ValueStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yang_version;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.common.YangVersion;
@@ -14,9 +14,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionEffectiveStatem
 import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularYangVersionEffectiveStatement extends WithSubstatements<YangVersion, YangVersionStatement>
+public final class RegularYangVersionEffectiveStatement extends WithSubstatements<YangVersion, YangVersionStatement>
         implements YangVersionEffectiveStatement {
-    RegularYangVersionEffectiveStatement(final YangVersionStatement declared,
+    public RegularYangVersionEffectiveStatement(final YangVersionStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yin_element;
+package org.opendaylight.yangtools.yang.model.spi.stmt.impl.eff;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,9 +13,9 @@ import org.opendaylight.yangtools.yang.model.api.stmt.YinElementEffectiveStateme
 import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
 
-final class RegularYinElementEffectiveStatement extends WithSubstatements<Boolean, YinElementStatement>
+public final class RegularYinElementEffectiveStatement extends WithSubstatements<Boolean, YinElementStatement>
         implements YinElementEffectiveStatement {
-    RegularYinElementEffectiveStatement(final YinElementStatement declared,
+    public RegularYinElementEffectiveStatement(final YinElementStatement declared,
         final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(declared, substatements);
     }
index 166c197bfe0749fc6263186395c2bff2d7eb20c3..5d9358402e7df59e76895fa157e93f0a98396474 100644 (file)
@@ -473,7 +473,7 @@ public final class EffectiveStatementMixins {
      */
     public interface EffectiveStatementWithFlags<A, D extends DeclaredStatement<A>> extends Mixin<A, D> {
         /**
-         * Return flags assicated with this statements. Flags can be built using {@link FlagsBuilder}.
+         * Return flags associated with this statements. Flags can be built using {@link FlagsBuilder}.
          *
          * @return Flag field value (32 bits).
          */
index 1e498be71ffdc8b69f4faaa9789d76cd796043c6..267e6858fded934a7d15e4a0121267f372f9b170 100644 (file)
@@ -20,6 +20,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
@@ -97,8 +98,7 @@ public final class BelongsToStatementSupport
     @Override
     protected BelongsToEffectiveStatement createEffective(final Current<String, BelongsToStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? new EmptyBelongsToEffectiveStatement(stmt.declared())
-            : new RegularBelongsToEffectiveStatement(stmt.declared(), substatements);
+        return EffectiveStatements.createBelongsTo(stmt.declared(), substatements);
     }
 
     private static SourceIdentifier getSourceIdentifier(final StmtContext<String, BelongsToStatement,
index cf764bf6e800564dcc401a342af70083c4e66959..701b593114dc92f55bbcd10413d08e18d132abac 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -52,7 +53,6 @@ public final class ErrorAppTagStatementSupport
     @Override
     protected ErrorAppTagEffectiveStatement createEffective(final Current<String, ErrorAppTagStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? new EmptyErrorAppTagEffectiveStatement(stmt.declared())
-            : new RegularErrorAppTagEffectiveStatement(stmt.declared(), substatements);
+        return EffectiveStatements.createErrorAppTag(stmt.declared(), substatements);
     }
 }
\ No newline at end of file
index 25f7aa996321eb40e0dbf2e2d3f96a17a0ed9a06..1492d0ef6499b943eec33e3c5cd90940e248f136 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -52,7 +53,6 @@ public final class ErrorMessageStatementSupport
     @Override
     protected ErrorMessageEffectiveStatement createEffective(final Current<String, ErrorMessageStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? new EmptyErrorMessageEffectiveStatement(stmt.declared())
-            : new RegularErrorMessageEffectiveStatement(stmt.declared(), substatements);
+        return EffectiveStatements.createErrorMessage(stmt.declared(), substatements);
     }
 }
index c35953b099bb51f6fe8af1fd10147f6007886767..82954b52508c088465fadd77e2cc7b19efb3d16b 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.fraction_digits;
 
-import static com.google.common.base.Verify.verifyNotNull;
-
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
@@ -19,6 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -31,22 +30,15 @@ public final class FractionDigitsStatementSupport
             SubstatementValidator.builder(YangStmtMapping.FRACTION_DIGITS).build();
     private static final FractionDigitsStatementSupport INSTANCE = new FractionDigitsStatementSupport();
 
-    private static final ImmutableMap<Integer, FractionDigitsStatement> EMPTY_DECLS;
-    private static final ImmutableMap<FractionDigitsStatement, EmptyFractionDigitsEffectiveStatement> EMPTY_EFF;
+    // FIXME: move this to yang-model-spi
+    private static final ImmutableMap<FractionDigitsStatement, FractionDigitsEffectiveStatement> EMPTY_EFF;
 
     static {
-        final Builder<Integer, FractionDigitsStatement> declBuilder = ImmutableMap.builder();
-        final Builder<FractionDigitsStatement, EmptyFractionDigitsEffectiveStatement> effBuilder =
-                ImmutableMap.builder();
-
+        final Builder<FractionDigitsStatement, FractionDigitsEffectiveStatement> effBuilder = ImmutableMap.builder();
         for (int i = 1; i <= 18; ++i) {
-            final Integer argument = i;
-            final FractionDigitsStatement decl = DeclaredStatements.createFractionDigits(argument);
-            declBuilder.put(argument, decl);
-            effBuilder.put(decl, new EmptyFractionDigitsEffectiveStatement(decl));
+            final FractionDigitsStatement decl = DeclaredStatements.createFractionDigits(i);
+            effBuilder.put(decl, EffectiveStatements.createFractionDigits(decl));
         }
-
-        EMPTY_DECLS = declBuilder.build();
         EMPTY_EFF = effBuilder.build();
     }
 
@@ -85,20 +77,19 @@ public final class FractionDigitsStatementSupport
 
     @Override
     protected FractionDigitsStatement createEmptyDeclared(final StmtContext<Integer, FractionDigitsStatement, ?> ctx) {
-        final Integer argument = ctx.getArgument();
-        return verifyNotNull(EMPTY_DECLS.get(argument), "No declared instance for %s", argument);
+        return DeclaredStatements.createFractionDigits(ctx.getArgument());
     }
 
     @Override
     protected FractionDigitsEffectiveStatement createEffective(final Current<Integer, FractionDigitsStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         return substatements.isEmpty() ? createEmptyEffective(stmt.declared())
-            : new RegularFractionDigitsEffectiveStatement(stmt.declared(), substatements);
+            : EffectiveStatements.createFractionDigits(stmt.declared(), substatements);
     }
 
     private static @NonNull FractionDigitsEffectiveStatement createEmptyEffective(
             final FractionDigitsStatement declared) {
-        final EmptyFractionDigitsEffectiveStatement shared = EMPTY_EFF.get(declared);
-        return shared != null ? shared :  new EmptyFractionDigitsEffectiveStatement(declared);
+        final FractionDigitsEffectiveStatement shared = EMPTY_EFF.get(declared);
+        return shared != null ? shared : EffectiveStatements.createFractionDigits(declared);
     }
 }
index 5a7a8e6865c2d607c8ede3401d4379d83d534064..3f056023ca8b3d64209fe30c1e893c941cea6c60 100644 (file)
@@ -23,6 +23,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureEffectiveStatemen
 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureExpr;
 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.FeatureNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
@@ -100,7 +101,6 @@ abstract class AbstractIfFeatureStatementSupport
     @Override
     protected final IfFeatureEffectiveStatement createEffective(final Current<IfFeatureExpr, IfFeatureStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? new EmptyIfFeatureEffectiveStatement(stmt.declared())
-            : new RegularIfFeatureEffectiveStatement(stmt.declared(), substatements);
+        return EffectiveStatements.createIfFeature(stmt.declared(), substatements);
     }
 }
index 21a4d5f53107fefc4dba5adea1aac723adfc64c3..4130794992cc6d7dc1f3d6a8ac0eec46f710243b 100644 (file)
@@ -25,6 +25,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateStatement;
 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.SubmoduleNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
@@ -128,7 +129,6 @@ public final class IncludeStatementSupport
     @Override
     protected IncludeEffectiveStatement createEffective(final Current<String, IncludeStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? new EmptyIncludeEffectiveStatement(stmt.declared())
-            : new RegularIncludeEffectiveStatement(stmt.declared(), substatements);
+        return EffectiveStatements.createInclude(stmt.declared(), substatements);
     }
 }
index ce248e1bf75d9f0bc625f21f66d156638c3d5c7a..c001d3a0357c865aeae76bd14d0be858eef6b257 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@@ -26,8 +27,8 @@ public final class MandatoryStatementSupport extends
 
     private MandatoryStatementSupport() {
         super(YangStmtMapping.MANDATORY,
-            new EmptyMandatoryEffectiveStatement(DeclaredStatements.createMandatory(Boolean.FALSE)),
-            new EmptyMandatoryEffectiveStatement(DeclaredStatements.createMandatory(Boolean.TRUE)),
+            EffectiveStatements.createMandatory(DeclaredStatements.createMandatory(Boolean.FALSE)),
+            EffectiveStatements.createMandatory(DeclaredStatements.createMandatory(Boolean.TRUE)),
             StatementPolicy.contextIndependent());
     }
 
@@ -49,11 +50,11 @@ public final class MandatoryStatementSupport extends
     @Override
     protected MandatoryEffectiveStatement createEffective(final MandatoryStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return new RegularMandatoryEffectiveStatement(declared, substatements);
+        return EffectiveStatements.createMandatory(declared, substatements);
     }
 
     @Override
     protected MandatoryEffectiveStatement createEmptyEffective(final MandatoryStatement declared) {
-        return new EmptyMandatoryEffectiveStatement(declared);
+        return EffectiveStatements.createMandatory(declared);
     }
 }
index 6b44b6631aa41c941c4fe19dc567b24020c9beaf..9cad9a845745741f35957fe08b11fb7ddf710d87 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -58,7 +59,6 @@ public final class MaxElementsStatementSupport
     @Override
     protected MaxElementsEffectiveStatement createEffective(final Current<String, MaxElementsStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? new EmptyMaxElementsEffectiveStatement(stmt.declared())
-            : new RegularMaxElementsEffectiveStatement(stmt.declared(), substatements);
+        return EffectiveStatements.createMaxElements(stmt.declared(), substatements);
     }
 }
index 95567d813657f2c523d22f157566c91c56f37c46..a39a866c7d73f5ec6c782a326dd0e0981b7a8e15 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@@ -62,11 +63,11 @@ public final class MinElementsStatementSupport
     @Override
     protected MinElementsEffectiveStatement createEffective(final MinElementsStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return new RegularMinElementsEffectiveStatement(declared, substatements);
+        return EffectiveStatements.createMinElements(declared, substatements);
     }
 
     @Override
     protected MinElementsEffectiveStatement createEmptyEffective(final MinElementsStatement declared) {
-        return new EmptyMinElementsEffectiveStatement(declared);
+        return EffectiveStatements.createMinElements(declared);
     }
 }
\ No newline at end of file
index 6d3b995c0b355122080f7ad996217b0d5adb9221..2aac1cb0d5e0eb532349de94a8c554e08bb8c2c0 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.NamespaceStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -65,7 +66,6 @@ public final class NamespaceStatementSupport
     @Override
     protected NamespaceEffectiveStatement createEffective(final Current<XMLNamespace, NamespaceStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? new EmptyNamespaceEffectiveStatement(stmt.declared())
-            : new RegularNamespaceEffectiveStatement(stmt.declared(), substatements);
+        return EffectiveStatements.createNamespace(stmt.declared(), substatements);
     }
 }
\ No newline at end of file
index 170c7022702a93102f147dd99297a46c1c3b53e3..7505318b0ccb8876e548bc3115bf944fede0710d 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -32,14 +33,15 @@ public final class OrderedByStatementSupport
      * Ordered-by has low argument cardinality, hence we can reuse them in case declaration does not have any
      * substatements (which is the usual case).
      */
+    // FIXME: move this to yang-model-spi
     private static final @NonNull OrderedByStatement EMPTY_SYSTEM_DECL =
         DeclaredStatements.createOrderedBy(Ordering.SYSTEM);
     private static final @NonNull OrderedByStatement EMPTY_USER_DECL =
         DeclaredStatements.createOrderedBy(Ordering.USER);
-    private static final @NonNull EmptyOrderedByEffectiveStatement EMPTY_SYSTEM_EFF =
-        new EmptyOrderedByEffectiveStatement(EMPTY_SYSTEM_DECL);
-    private static final @NonNull EmptyOrderedByEffectiveStatement EMPTY_USER_EFF =
-        new EmptyOrderedByEffectiveStatement(EMPTY_USER_DECL);
+    private static final @NonNull OrderedByEffectiveStatement EMPTY_SYSTEM_EFF =
+        EffectiveStatements.createOrderedBy(EMPTY_SYSTEM_DECL);
+    private static final @NonNull OrderedByEffectiveStatement EMPTY_USER_EFF =
+        EffectiveStatements.createOrderedBy(EMPTY_USER_DECL);
 
     private OrderedByStatementSupport() {
         super(YangStmtMapping.ORDERED_BY, StatementPolicy.contextIndependent());
@@ -97,7 +99,7 @@ public final class OrderedByStatementSupport
     protected OrderedByEffectiveStatement createEffective(final Current<Ordering, OrderedByStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         return substatements.isEmpty() ? createEmptyEffective(stmt.declared())
-            : new RegularOrderedByEffectiveStatement(stmt.declared(), substatements);
+            : EffectiveStatements.createOrderedBy(stmt.declared(), substatements);
     }
 
     private static @NonNull OrderedByEffectiveStatement createEmptyEffective(final OrderedByStatement declared) {
@@ -109,7 +111,7 @@ public final class OrderedByStatementSupport
         } else if (EMPTY_SYSTEM_DECL.equals(declared)) {
             return EMPTY_SYSTEM_EFF;
         } else {
-            return new EmptyOrderedByEffectiveStatement(declared);
+            return EffectiveStatements.createOrderedBy(declared);
         }
     }
 }
index 01260e0fc14ddadb6230d07d5dd14568737f3376..621bfd25e584cd431ce5f87c61ec9f32d1f6c099 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStringStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
 
@@ -51,11 +52,11 @@ public final class OrganizationStatementSupport
     @Override
     protected OrganizationEffectiveStatement createEffective(final OrganizationStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return new RegularOrganizationEffectiveStatement(declared, substatements);
+        return EffectiveStatements.createOrganization(declared, substatements);
     }
 
     @Override
     protected OrganizationEffectiveStatement createEmptyEffective(final OrganizationStatement declared) {
-        return new EmptyOrganizationEffectiveStatement(declared);
+        return EffectiveStatements.createOrganization(declared);
     }
 }
\ No newline at end of file
index 033a994294d60b6373157f4700dcfde1213cdb27..4971c1a313f5188cf7e4cdc526c535b46ef6cd58 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PathEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PathStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -71,7 +72,6 @@ public final class PathStatementSupport
     @Override
     protected PathEffectiveStatement createEffective(final Current<PathExpression, PathStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? new EmptyPathEffectiveStatement(stmt.declared())
-            : new RegularPathEffectiveStatement(stmt.declared(), substatements);
+        return EffectiveStatements.createPath(stmt.declared(), substatements);
     }
 }
\ No newline at end of file
index 395e571c401f0525f1bead22407b57990bf78fa9..e1eda6c603c88978498dceec7b9741b537818072 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PositionEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@@ -62,11 +63,11 @@ public final class PositionStatementSupport
     @Override
     protected PositionEffectiveStatement createEffective(final PositionStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return new RegularPositionEffectiveStatement(declared, substatements);
+        return EffectiveStatements.createPosition(declared, substatements);
     }
 
     @Override
     protected PositionEffectiveStatement createEmptyEffective(final PositionStatement declared) {
-        return new EmptyPositionEffectiveStatement(declared);
+        return EffectiveStatements.createPosition(declared);
     }
 }
\ No newline at end of file
index 7fe3d4c35bb0bbc55079dc9c98454318d8cf3e48..d299d1e9876a86da4bf7fb4190340044f2868982 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStringStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
 
@@ -51,11 +52,11 @@ public final class ReferenceStatementSupport
     @Override
     protected ReferenceEffectiveStatement createEffective(final ReferenceStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return new RegularReferenceEffectiveStatement(declared, substatements);
+        return EffectiveStatements.createReference(declared, substatements);
     }
 
     @Override
     protected ReferenceEffectiveStatement createEmptyEffective(final ReferenceStatement declared) {
-        return new EmptyReferenceEffectiveStatement(declared);
+        return EffectiveStatements.createReference(declared);
     }
 }
diff --git a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/require_instance/EmptyRequireInstanceEffectiveStatement.java b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/require_instance/EmptyRequireInstanceEffectiveStatement.java
deleted file mode 100644 (file)
index 6890f17..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.require_instance;
-
-import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
-import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-
-final class EmptyRequireInstanceEffectiveStatement extends DefaultArgument<Boolean, RequireInstanceStatement>
-        implements RequireInstanceEffectiveStatement {
-    EmptyRequireInstanceEffectiveStatement(final RequireInstanceStatement declared) {
-        super(declared);
-    }
-}
index 3dac1e1df96979b2fcd189cbd49f1060705088e4..027d5595f1fd4ecd32141f16c6728bf51b395d24 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@@ -26,8 +27,7 @@ public final class RequireInstanceStatementSupport
 
     private RequireInstanceStatementSupport() {
         super(YangStmtMapping.REQUIRE_INSTANCE,
-            new EmptyRequireInstanceEffectiveStatement(DeclaredStatements.createRequireInstance(Boolean.FALSE)),
-            new EmptyRequireInstanceEffectiveStatement(DeclaredStatements.createRequireInstance(Boolean.TRUE)),
+            EffectiveStatements.createRequireInstance(false), EffectiveStatements.createRequireInstance(true),
             StatementPolicy.contextIndependent());
     }
 
@@ -49,11 +49,11 @@ public final class RequireInstanceStatementSupport
     @Override
     protected RequireInstanceEffectiveStatement createEffective(final RequireInstanceStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return new RegularRequireInstanceEffectiveStatement(declared, substatements);
+        return EffectiveStatements.createRequireInstance(declared, substatements);
     }
 
     @Override
-    protected EmptyRequireInstanceEffectiveStatement createEmptyEffective(final RequireInstanceStatement declared) {
-        return new EmptyRequireInstanceEffectiveStatement(declared);
+    protected RequireInstanceEffectiveStatement createEmptyEffective(final RequireInstanceStatement declared) {
+        return EffectiveStatements.createRequireInstance(declared);
     }
 }
diff --git a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/status/EmptyStatusEffectiveStatement.java b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/status/EmptyStatusEffectiveStatement.java
deleted file mode 100644 (file)
index b014385..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.status;
-
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
-import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-
-final class EmptyStatusEffectiveStatement extends DefaultArgument<Status, StatusStatement>
-        implements StatusEffectiveStatement {
-    EmptyStatusEffectiveStatement(final StatusStatement declared) {
-        super(declared);
-    }
-}
index 4d81ab9a2976877cb97caf8bc236c9d13dd2ddcc..13e1b24bce3ab0dbc67ee9ee5691507998eb2efd 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.status;
 
 import com.google.common.collect.ImmutableList;
-import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.Status;
 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@@ -16,6 +15,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -24,27 +24,10 @@ import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
 public final class StatusStatementSupport
         extends AbstractStatementSupport<Status, StatusStatement, StatusEffectiveStatement> {
-    private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
-        .STATUS)
-        .build();
+    private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+        SubstatementValidator.builder(YangStmtMapping.STATUS).build();
     private static final StatusStatementSupport INSTANCE = new StatusStatementSupport();
 
-    /*
-     * status has low argument cardinality, hence we can reuse them in case declaration does not have any
-     * substatements (which is the usual case). Yeah, we could consider an EnumMap, but this is not too bad, either.
-     */
-    private static final @NonNull StatusStatement EMPTY_CURRENT_DECL = DeclaredStatements.createStatus(Status.CURRENT);
-    private static final @NonNull StatusStatement EMPTY_DEPRECATED_DECL =
-        DeclaredStatements.createStatus(Status.DEPRECATED);
-    private static final @NonNull StatusStatement EMPTY_OBSOLETE_DECL =
-        DeclaredStatements.createStatus(Status.OBSOLETE);
-    private static final @NonNull EmptyStatusEffectiveStatement EMPTY_CURRENT_EFF =
-        new EmptyStatusEffectiveStatement(EMPTY_CURRENT_DECL);
-    private static final @NonNull EmptyStatusEffectiveStatement EMPTY_DEPRECATED_EFF =
-        new EmptyStatusEffectiveStatement(EMPTY_DEPRECATED_DECL);
-    private static final @NonNull EmptyStatusEffectiveStatement EMPTY_OBSOLETE_EFF =
-        new EmptyStatusEffectiveStatement(EMPTY_OBSOLETE_DECL);
-
     private StatusStatementSupport() {
         super(YangStmtMapping.STATUS, StatementPolicy.contextIndependent());
     }
@@ -94,40 +77,12 @@ public final class StatusStatementSupport
 
     @Override
     protected StatusStatement createEmptyDeclared(final StmtContext<Status, StatusStatement, ?> ctx) {
-        final Status argument = ctx.getArgument();
-        switch (argument) {
-            case CURRENT:
-                return EMPTY_CURRENT_DECL;
-            case DEPRECATED:
-                return EMPTY_DEPRECATED_DECL;
-            case OBSOLETE:
-                return EMPTY_OBSOLETE_DECL;
-            default:
-                throw new IllegalStateException("Unhandled argument " + argument);
-        }
+        return DeclaredStatements.createStatus(ctx.getArgument());
     }
 
     @Override
     protected StatusEffectiveStatement createEffective(final Current<Status, StatusStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? createEmptyEffective(stmt.declared())
-            : new RegularStatusEffectiveStatement(stmt.declared(), substatements);
-    }
-
-    private static @NonNull StatusEffectiveStatement createEmptyEffective(final StatusStatement declared) {
-        // Aggressively reuse effective instances which are backed by the corresponding empty declared instance, as this
-        // is the case unless there is a weird extension in use.
-        if (EMPTY_DEPRECATED_DECL.equals(declared)) {
-            // Most likely to be seen (as current is the default)
-            return EMPTY_DEPRECATED_EFF;
-        } else if (EMPTY_OBSOLETE_DECL.equals(declared)) {
-            // less likely
-            return EMPTY_OBSOLETE_EFF;
-        } else if (EMPTY_CURRENT_DECL.equals(declared)) {
-            // ... okay, why is this there? :)
-            return EMPTY_CURRENT_EFF;
-        } else {
-            return new EmptyStatusEffectiveStatement(declared);
-        }
+        return EffectiveStatements.createStatus(stmt.declared(), substatements);
     }
 }
index a5f86d8e9c87d6b9ce7bb685ec1e1e4cd54ca025..7e42424f3aba7a1b06cda11fcf11e759fa4c8d02 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ValueEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractInternedStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@@ -63,11 +64,11 @@ public final class ValueStatementSupport
     @Override
     protected ValueEffectiveStatement createEffective(final ValueStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return new RegularValueEffectiveStatement(declared, substatements);
+        return EffectiveStatements.createValue(declared, substatements);
     }
 
     @Override
     protected ValueEffectiveStatement createEmptyEffective(@NonNull final ValueStatement declared) {
-        return new EmptyValueEffectiveStatement(declared);
+        return EffectiveStatements.createValue(declared);
     }
 }
diff --git a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/yang_version/EmptyYangVersionEffectiveStatement.java b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/yang_version/EmptyYangVersionEffectiveStatement.java
deleted file mode 100644 (file)
index 8ce29f9..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yang_version;
-
-import org.opendaylight.yangtools.yang.common.YangVersion;
-import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionEffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
-import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument;
-
-final class EmptyYangVersionEffectiveStatement extends DefaultArgument<YangVersion, YangVersionStatement>
-        implements YangVersionEffectiveStatement {
-    EmptyYangVersionEffectiveStatement(final YangVersionStatement declared) {
-        super(declared);
-    }
-}
index 0a4428cd2e2531adc2830e58f34b042ef32cc997..893dead40f0674866d583eba6e3b983ac19e5170 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yang_version;
 
 import com.google.common.collect.ImmutableList;
-import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.YangVersion;
 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@@ -16,6 +15,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -25,20 +25,10 @@ import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
 public final class YangVersionStatementSupport
         extends AbstractStatementSupport<YangVersion, YangVersionStatement, YangVersionEffectiveStatement> {
-    private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
-        .YANG_VERSION)
-        .build();
+    private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+        SubstatementValidator.builder(YangStmtMapping.YANG_VERSION).build();
     private static final YangVersionStatementSupport INSTANCE = new YangVersionStatementSupport();
 
-    private static final @NonNull YangVersionStatement EMPTY_VER1_DECL =
-        DeclaredStatements.createYangVersion(YangVersion.VERSION_1);
-    private static final @NonNull YangVersionStatement EMPTY_VER1_1_DECL =
-        DeclaredStatements.createYangVersion(YangVersion.VERSION_1_1);
-    private static final @NonNull EmptyYangVersionEffectiveStatement EMPTY_VER1_EFF =
-        new EmptyYangVersionEffectiveStatement(EMPTY_VER1_DECL);
-    private static final @NonNull EmptyYangVersionEffectiveStatement EMPTY_VER1_1_EFF =
-        new EmptyYangVersionEffectiveStatement(EMPTY_VER1_1_DECL);
-
     private YangVersionStatementSupport() {
         super(YangStmtMapping.YANG_VERSION, StatementPolicy.reject());
     }
@@ -71,31 +61,12 @@ public final class YangVersionStatementSupport
 
     @Override
     protected YangVersionStatement createEmptyDeclared(final StmtContext<YangVersion, YangVersionStatement, ?> ctx) {
-        final YangVersion argument = ctx.getArgument();
-        switch (argument) {
-            case VERSION_1:
-                return EMPTY_VER1_DECL;
-            case VERSION_1_1:
-                return EMPTY_VER1_1_DECL;
-            default:
-                throw new IllegalStateException("Unhandled version " + argument);
-        }
+        return DeclaredStatements.createYangVersion(ctx.getArgument());
     }
 
     @Override
     protected YangVersionEffectiveStatement createEffective(final Current<YangVersion, YangVersionStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return substatements.isEmpty() ? createEmptyEffective(stmt.declared())
-            : new RegularYangVersionEffectiveStatement(stmt.declared(), substatements);
-    }
-
-    private static @NonNull YangVersionEffectiveStatement createEmptyEffective(final YangVersionStatement declared) {
-        if (EMPTY_VER1_DECL.equals(declared)) {
-            return EMPTY_VER1_EFF;
-        } else if (EMPTY_VER1_1_DECL.equals(declared)) {
-            return EMPTY_VER1_1_EFF;
-        } else {
-            return new EmptyYangVersionEffectiveStatement(declared);
-        }
+        return EffectiveStatements.createYangVersion(stmt.declared(), substatements);
     }
 }
index 664a52af0277ebf44949dfde766832516c7aaf0d..1af5c42c5368fd3b9a423d511648c4d0b72e7eab 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.YinElementEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
+import org.opendaylight.yangtools.yang.model.spi.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
@@ -26,8 +27,8 @@ public final class YinElementStatementSupport
 
     private YinElementStatementSupport() {
         super(YangStmtMapping.YIN_ELEMENT,
-            new EmptyYinElementEffectiveStatement(DeclaredStatements.createYinElement(Boolean.FALSE)),
-            new EmptyYinElementEffectiveStatement(DeclaredStatements.createYinElement(Boolean.TRUE)),
+            EffectiveStatements.createYinElement(DeclaredStatements.createYinElement(false)),
+            EffectiveStatements.createYinElement(DeclaredStatements.createYinElement(true)),
             StatementPolicy.reject());
     }
 
@@ -49,11 +50,11 @@ public final class YinElementStatementSupport
     @Override
     protected YinElementEffectiveStatement createEffective(final YinElementStatement declared,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return new RegularYinElementEffectiveStatement(declared, substatements);
+        return EffectiveStatements.createYinElement(declared, substatements);
     }
 
     @Override
     protected YinElementEffectiveStatement createEmptyEffective(final YinElementStatement declared) {
-        return new EmptyYinElementEffectiveStatement(declared);
+        return EffectiveStatements.createYinElement(declared);
     }
 }