BUG-865: remove pre-Beryllium parser 93/39893/6
authorRobert Varga <rovarga@cisco.com>
Mon, 6 Jun 2016 15:44:02 +0000 (17:44 +0200)
committerPeter Kajsa <pkajsa@cisco.com>
Tue, 14 Jun 2016 09:03:28 +0000 (11:03 +0200)
This parser and implementation elements have been deprecated
in Beryllium. We do not have any in-tree users anymore, remove
them.

Change-Id: I3c04db2b93423596b9815656adf8ca051868e830
Signed-off-by: Robert Varga <rovarga@cisco.com>
89 files changed:
yang/yang-parser-api/src/main/java/org/opendaylight/yangtools/yang/model/parser/api/YangContextParser.java [deleted file]
yang/yang-parser-api/src/main/java/org/opendaylight/yangtools/yang/model/parser/api/YangModelParser.java [deleted file]
yang/yang-parser-impl/src/main/antlr/YangLexer.g4 [deleted file]
yang/yang-parser-impl/src/main/antlr/YangParser.g4 [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/AugmentationSchemaBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/AugmentationTargetBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/Builder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/ConstraintsBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/DataNodeContainerBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/DataSchemaNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/DocumentedNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/ExtensionBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/GroupingBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/GroupingMember.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/RefineBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/SchemaNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/TypeAwareBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/TypeDefinitionBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/UnknownSchemaNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/UsesNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AnyXmlBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AnyXmlSchemaNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AugmentationSchemaImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/BuilderUtils.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceCaseBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceCaseNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceSchemaNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ConstraintsBuilderImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ContainerSchemaNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ContainerSchemaNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/CopyUtils.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/DeviationBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ExtensionBuilderImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ExtensionDefinitionImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/FeatureBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/GroupingBuilderImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/GroupingDefinitionImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/GroupingUtils.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/IdentitySchemaNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/IdentitySchemaNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/IdentityrefTypeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafListSchemaNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafListSchemaNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafSchemaNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafSchemaNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ListSchemaNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ListSchemaNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ModuleBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ModuleImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/NotificationBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/NotificationDefinitionImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RefineHolderImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RefineUtils.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RpcDefinitionBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RpcDefinitionImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/TypeDefinitionBuilderImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/TypeUtils.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnionTypeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnknownSchemaNodeBuilderImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnknownSchemaNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UsesNodeBuilderImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UsesNodeImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedDataNodeContainer.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedDataNodeContainerBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedNode.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractSchemaNodeBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractTypeAwareBuilder.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/Comparators.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/BasicValidations.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/GroupingSort.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/ParserListenerUtils.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/SchemaPathStack.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/ValidationUtil.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangModelBasicValidationListener.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangModelBasicValidator.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangParserImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangParserListenerImpl.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/util/YangModelDependencyInfo.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ChoiceEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ModuleDependencySort.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ModuleOrModuleBuilder.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationListTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationModuleTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationSubModuleTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationTest.java [deleted file]

diff --git a/yang/yang-parser-api/src/main/java/org/opendaylight/yangtools/yang/model/parser/api/YangContextParser.java b/yang/yang-parser-api/src/main/java/org/opendaylight/yangtools/yang/model/parser/api/YangContextParser.java
deleted file mode 100644 (file)
index 7c1b4dc..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2013 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.parser.api;
-
-import com.google.common.io.ByteSource;
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-/**
- * Parse YANG models and convert data to SchemaContext.
- *
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory} and related classes
- *             instead.
- */
-@Deprecated
-public interface YangContextParser extends YangModelParser {
-
-    /**
-     * Parse yangFile file and all yang files found in directory.
-     *
-     * @param yangFile
-     *            file to parse
-     * @param dependenciesDirectory
-     *            directory which contains additional yang files
-     * @return parsed data as SchemaContext. Resulting context will contains
-     *         only module parsed from yangFile and modules which yangFile needs
-     *         as dependencies.
-     */
-    SchemaContext parseFile(final File yangFile, final File dependenciesDirectory) throws IOException, YangSyntaxErrorException;
-
-    /**
-     * Parse one or more Yang model files and return the definitions of Yang
-     * modules defined in *.yang files; <br>
-     * This method SHOULD be used if user need to parse multiple yang models
-     * that are referenced either through import or include statements.
-     *
-     * @param yangFiles
-     *            yang files to parse
-     * @return parsed data as SchemaContext
-     */
-    SchemaContext parseFiles(final Collection<File> yangFiles) throws IOException;
-
-    /**
-     * Parse one or more Yang model files and return the definitions of Yang
-     * modules defined in *.yang files. <br>
-     * This method SHOULD be used if user has already parsed context and need to
-     * parse additinal yang models which can have dependencies on models in this
-     * context.
-     *
-     * @param yangFiles
-     *            yang files to parse
-     * @param context
-     *            SchemaContext containing already parsed yang models
-     * @return parsed data as SchemaContext
-     */
-    SchemaContext parseFiles(final Collection<File> yangFiles, final SchemaContext context) throws IOException, YangSyntaxErrorException;
-
-    /**
-     * Parse one or more Yang model streams and return the definitions of Yang
-     * modules defined in *.yang files; <br>
-     * This method SHOULD be used if user need to parse multiple yang models
-     * that are referenced either through import or include statements.
-     *
-     * @param sources
-     *            yang streams to parse
-     * @return parsed data as SchemaContext
-     */
-    SchemaContext parseSources(final Collection<ByteSource> sources) throws IOException, YangSyntaxErrorException;
-
-    /**
-     * Parse one or more Yang model streams and return the definitions of Yang
-     * modules defined in *.yang files. <br>
-     * This method SHOULD be used if user has already parsed context and need to
-     * parse additinal yang models which can have dependencies on models in this
-     * context.
-     *
-     * @param sources
-     *            yang streams to parse
-     * @param context
-     *            SchemaContext containing already parsed yang models
-     * @return parsed data as SchemaContext
-     */
-    SchemaContext parseSources(final Collection<ByteSource> sources, final SchemaContext context) throws IOException, YangSyntaxErrorException;
-
-}
diff --git a/yang/yang-parser-api/src/main/java/org/opendaylight/yangtools/yang/model/parser/api/YangModelParser.java b/yang/yang-parser-api/src/main/java/org/opendaylight/yangtools/yang/model/parser/api/YangModelParser.java
deleted file mode 100644 (file)
index 98fed32..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2013 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.parser.api;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.type.UnknownTypeDefinition;
-
-/**
- * Yang Model Parser interface is designed for parsing yang models and convert
- * the information to Data Schema Tree.
- * @deprecated Use {@link YangContextParser} instead
- */
-@Deprecated
-public interface YangModelParser {
-
-    /**
-     * Parse yangFile file and all yang files found in directory.
-     *
-     * @param yangFile
-     *            file to parse
-     * @param directory
-     *            directory which contains additional yang files
-     * @return Set of Yang Modules
-     * @deprecated Use {@link YangContextParser#parseFile(File, File)} instead
-     */
-    @Deprecated
-    Set<Module> parseYangModels(final File yangFile, final File directory);
-
-    /**
-     * Parse one or more Yang model files and return the definitions of Yang
-     * modules defined in *.yang files; <br>
-     * This method SHOULD be used if user need to parse multiple yang models
-     * that are referenced either through import or include statements.
-     *
-     * @param yangFiles
-     *            yang files to parse
-     * @return Set of Yang Modules
-     * @deprecated Use {@link YangContextParser#parseFiles(Collection)} instead
-     */
-    @Deprecated
-    Set<Module> parseYangModels(final List<File> yangFiles);
-
-    /**
-     * Parse one or more Yang model files and return the definitions of Yang
-     * modules defined in *.yang files. <br>
-     * This method SHOULD be used if user has already parsed context and need to
-     * parse additinal yang models which can have dependencies on models in this
-     * context.
-     *
-     * @param yangFiles
-     *            yang files to parse
-     * @param context
-     *            SchemaContext containing already parsed yang models
-     * @return Set of Yang Modules
-     * @deprecated Use {@link YangContextParser#parseFiles(Collection, SchemaContext)} instead
-     */
-    @Deprecated
-    Set<Module> parseYangModels(final List<File> yangFiles, final SchemaContext context);
-
-    /**
-     * Equivalent to {@link #parseYangModels(List)} that returns parsed modules
-     * mapped to Files from which they were parsed.
-     *
-     * @param yangFiles
-     *            yang files to parse
-     * @return Map of Yang Modules
-     */
-    Map<File, Module> parseYangModelsMapped(final Collection<File> yangFiles);
-
-    /**
-     * Parse one or more Yang model streams and return the definitions of Yang
-     * modules defined in *.yang files; <br>
-     * This method SHOULD be used if user need to parse multiple yang models
-     * that are referenced either through import or include statements.
-     *
-     * @param yangModelStreams
-     *            yang streams to parse
-     * @return Set of Yang Modules
-     * @deprecated Use {@link YangContextParser#parseSources(Collection)} instead
-     */
-    @Deprecated
-    Set<Module> parseYangModelsFromStreams(final List<InputStream> yangModelStreams);
-
-    /**
-     * Parse one or more Yang model streams and return the definitions of Yang
-     * modules defined in *.yang files. <br>
-     * This method SHOULD be used if user has already parsed context and need to
-     * parse additional yang models which can have dependencies on models in this
-     * context.
-     *
-     * @param yangModelStreams
-     *            yang streams to parse
-     * @param context
-     *            SchemaContext containing already parsed yang models
-     * @return Set of Yang Modules
-     * @deprecated Use {@link YangContextParser#parseSources(Collection, SchemaContext)} instead
-     */
-    @Deprecated
-    Set<Module> parseYangModelsFromStreams(final List<InputStream> yangModelStreams, final SchemaContext context);
-
-    /**
-     * Equivalent to {@link #parseYangModels(List)} that returns parsed modules
-     * mapped to InputStreams from which they were parsed.
-     *
-     * @param yangModelStreams
-     *            yang streams to parse
-     * @return Map of Yang Modules
-     * @deprecated Use {@link YangContextParser#parseSources(java.util.Collection)}
-     */
-    //TODO: when working with input streams do not swallow IOException, it should be propagated without having to wrap it in a runtime exception
-    //FIXME: it is not defined in which state are the returning streams.
-    @Deprecated
-    Map<InputStream, Module> parseYangModelsFromStreamsMapped(final Collection<InputStream> yangModelStreams);
-
-    /**
-     * Creates {@link SchemaContext} from specified Modules. The modules SHOULD
-     * not contain any unresolved Schema Nodes or Type Definitions. By
-     * unresolved Schema Nodes or Type Definitions we mean that the Module
-     * should not contain ANY Schema Nodes that contains
-     * {@link UnknownTypeDefinition} and all dependencies although via import or
-     * include definitions are resolved.
-     *
-     * @param modules
-     *            Set of Yang Modules
-     * @return Schema Context instance constructed from whole Set of Modules.
-     * @deprecated use {@link YangContextParser} methods that return SchemaContext in one step
-     */
-    @Deprecated
-    SchemaContext resolveSchemaContext(final Set<Module> modules);
-}
diff --git a/yang/yang-parser-impl/src/main/antlr/YangLexer.g4 b/yang/yang-parser-impl/src/main/antlr/YangLexer.g4
deleted file mode 100644 (file)
index 48d75a0..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-// Copyright (c) 2013 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
-//
-lexer grammar YangLexer;
-
-@header {
-package org.opendaylight.yangtools.antlrv4.code.gen;
-}
-
-tokens{
-    SEMICOLON,
-    LEFT_BRACE,
-    RIGHT_BRACE
-}
-
-
-PLUS : '+'-> pushMode(VALUE_MODE);
-WS : [ \n\r\t] -> skip;
-LINE_COMMENT :  ('//' (~( '\r' | '\n' )*)) -> skip;
-
-START_BLOCK_COMMENT : '/*' ->pushMode(BLOCK_COMMENT_MODE), skip ;
-
-
-SEMICOLON : ';' ->type(SEMICOLON);
-LEFT_BRACE : '{' ->type(LEFT_BRACE);
-RIGHT_BRACE : '}' ->type(RIGHT_BRACE);
-
-YIN_ELEMENT_KEYWORD : 'yin-element'-> pushMode(VALUE_MODE);
-YANG_VERSION_KEYWORD: 'yang-version'-> pushMode(VALUE_MODE);
-WHEN_KEYWORD : 'when'-> pushMode(VALUE_MODE);
-VALUE_KEYWORD : 'value'-> pushMode(VALUE_MODE);
-USES_KEYWORD : 'uses'-> pushMode(VALUE_MODE);
-UNITS_KEYWORD : 'units'-> pushMode(VALUE_MODE);
-UNIQUE_KEYWORD : 'unique'-> pushMode(VALUE_MODE);
-TYPEDEF_KEYWORD : 'typedef'-> pushMode(VALUE_MODE);
-TYPE_KEYWORD : 'type'-> pushMode(VALUE_MODE);
-SUBMODULE_KEYWORD : 'submodule'-> pushMode(VALUE_MODE);
-STATUS_KEYWORD : 'status'-> pushMode(VALUE_MODE);
-RPC_KEYWORD : 'rpc'-> pushMode(VALUE_MODE);
-REVISION_DATE_KEYWORD : 'revision-date'-> pushMode(VALUE_MODE);
-REVISION_KEYWORD : 'revision'-> pushMode(VALUE_MODE);
-REQUIRE_INSTANCE_KEYWORD : 'require-instance'-> pushMode(VALUE_MODE);
-REFINE_KEYWORD : 'refine'-> pushMode(VALUE_MODE);
-REFERENCE_KEYWORD : 'reference'-> pushMode(VALUE_MODE);
-RANGE_KEYWORD : 'range'-> pushMode(VALUE_MODE);
-PRESENCE_KEYWORD : 'presence'-> pushMode(VALUE_MODE);
-PREFIX_KEYWORD : 'prefix'-> pushMode(VALUE_MODE);
-POSITION_KEYWORD : 'position'-> pushMode(VALUE_MODE);
-PATTERN_KEYWORD : 'pattern'-> pushMode(VALUE_MODE);
-PATH_KEYWORD : 'path'-> pushMode(VALUE_MODE);
-OUTPUT_KEYWORD : 'output';
-ORGANIZATION_KEYWORD: 'organization'-> pushMode(VALUE_MODE);
-ORDERED_BY_KEYWORD : 'ordered-by'-> pushMode(VALUE_MODE);
-NOTIFICATION_KEYWORD: 'notification'-> pushMode(VALUE_MODE);
-NAMESPACE_KEYWORD : 'namespace'-> pushMode(VALUE_MODE);
-MUST_KEYWORD : 'must'-> pushMode(VALUE_MODE);
-MODULE_KEYWORD : 'module'-> pushMode(VALUE_MODE);
-MIN_ELEMENTS_KEYWORD : 'min-elements'-> pushMode(VALUE_MODE);
-MAX_ELEMENTS_KEYWORD : 'max-elements'-> pushMode(VALUE_MODE);
-MANDATORY_KEYWORD : 'mandatory'-> pushMode(VALUE_MODE);
-LIST_KEYWORD : 'list'-> pushMode(VALUE_MODE);
-LENGTH_KEYWORD : 'length'-> pushMode(VALUE_MODE);
-LEAF_LIST_KEYWORD : 'leaf-list'-> pushMode(VALUE_MODE);
-LEAF_KEYWORD : 'leaf'-> pushMode(VALUE_MODE);
-KEY_KEYWORD : 'key'-> pushMode(VALUE_MODE);
-INPUT_KEYWORD : 'input';
-INCLUDE_KEYWORD : 'include'-> pushMode(VALUE_MODE);
-IMPORT_KEYWORD : 'import'-> pushMode(VALUE_MODE);
-IF_FEATURE_KEYWORD : 'if-feature'-> pushMode(VALUE_MODE);
-IDENTITY_KEYWORD : 'identity'-> pushMode(VALUE_MODE);
-GROUPING_KEYWORD : 'grouping'-> pushMode(VALUE_MODE);
-FRACTION_DIGITS_KEYWORD : 'fraction-digits'-> pushMode(VALUE_MODE);
-FEATURE_KEYWORD : 'feature'-> pushMode(VALUE_MODE);
-DEVIATE_KEYWORD : 'deviate'-> pushMode(VALUE_MODE);
-DEVIATION_KEYWORD : 'deviation'-> pushMode(VALUE_MODE);
-EXTENSION_KEYWORD : 'extension'-> pushMode(VALUE_MODE);
-ERROR_MESSAGE_KEYWORD : 'error-message'-> pushMode(VALUE_MODE);
-ERROR_APP_TAG_KEYWORD : 'error-app-tag'-> pushMode(VALUE_MODE);
-ENUM_KEYWORD : 'enum'-> pushMode(VALUE_MODE);
-DESCRIPTION_KEYWORD : 'description'-> pushMode(VALUE_MODE);
-DEFAULT_KEYWORD : 'default'-> pushMode(VALUE_MODE);
-CONTAINER_KEYWORD : 'container'-> pushMode(VALUE_MODE);
-CONTACT_KEYWORD : 'contact'-> pushMode(VALUE_MODE);
-CONFIG_KEYWORD : 'config'-> pushMode(VALUE_MODE);
-CHOICE_KEYWORD: 'choice'-> pushMode(VALUE_MODE);
-CASE_KEYWORD : 'case'-> pushMode(VALUE_MODE);
-BIT_KEYWORD : 'bit'-> pushMode(VALUE_MODE);
-BELONGS_TO_KEYWORD : 'belongs-to'-> pushMode(VALUE_MODE);
-BASE_KEYWORD : 'base'-> pushMode(VALUE_MODE);
-AUGMENT_KEYWORD : 'augment'-> pushMode(VALUE_MODE);
-ARGUMENT_KEYWORD : 'argument'-> pushMode(VALUE_MODE);
-ANYXML_KEYWORD : 'anyxml'-> pushMode(VALUE_MODE);
-
-IDENTIFIER : [/.a-zA-Z_0-9\-][a-zA-Z0-9_\-.:]* -> pushMode(VALUE_MODE);
-
-mode VALUE_MODE;
-
-fragment ESC :  '\\' (["\\/bfnrt] | UNICODE) ;
-fragment UNICODE : 'u' HEX HEX HEX HEX ;
-fragment HEX : [0-9a-fA-F] ;
-          
-END_IDENTIFIER_SEMICOLON : ';' -> type(SEMICOLON),popMode;
-END_IDENTIFIER_LEFT_BRACE : '{' ->type(LEFT_BRACE), popMode;
-
-START_INNER_BLOCK_COMMENT : '/*' ->pushMode(BLOCK_COMMENT_MODE), skip ;
-
-fragment SUB_STRING : ('"' (ESC | ~["])*'"') | ('\'' (ESC | ~['])*'\'') ;
-
-STRING: ((~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '"' | '\'')~( '\r' | '\n' | '\t' | ' ' | ';' | '{' )* ) | SUB_STRING ) ->popMode;// IDENTIFIER ;
-S : [ \n\r\t] -> skip;    
-
-mode BLOCK_COMMENT_MODE;
-END_BLOCK_COMMENT : '*/' -> popMode,skip;
-BLOCK_COMMENT :  . ->more,skip;
diff --git a/yang/yang-parser-impl/src/main/antlr/YangParser.g4 b/yang/yang-parser-impl/src/main/antlr/YangParser.g4
deleted file mode 100644 (file)
index 13b1196..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-//
-// Copyright (c) 2013 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
-//
-parser grammar YangParser;
-
-@header {
-package org.opendaylight.yangtools.antlrv4.code.gen;
-}
-
-options{
-    tokenVocab=YangLexer;
-}
-
-
-yang : module_stmt | submodule_stmt ;
-
-string : STRING (PLUS STRING)*;
-
-// string validated in YangParserListenerImpl.handleUnknownNode()
-identifier_stmt : IDENTIFIER string? (stmtend | (LEFT_BRACE unknown_statement* RIGHT_BRACE));
-// string validated in YangParserListenerImpl.handleUnknownNode()
-unknown_statement : (YIN_ELEMENT_KEYWORD | YANG_VERSION_KEYWORD | WHEN_KEYWORD | VALUE_KEYWORD | USES_KEYWORD | UNITS_KEYWORD | UNIQUE_KEYWORD |
-                    TYPEDEF_KEYWORD | TYPE_KEYWORD | SUBMODULE_KEYWORD | RPC_KEYWORD | REVISION_DATE_KEYWORD | REVISION_KEYWORD |
-                    REQUIRE_INSTANCE_KEYWORD | REFINE_KEYWORD | RANGE_KEYWORD | PRESENCE_KEYWORD | PREFIX_KEYWORD |
-                    POSITION_KEYWORD | PATTERN_KEYWORD | PATH_KEYWORD | OUTPUT_KEYWORD | ORGANIZATION_KEYWORD|  ORDERED_BY_KEYWORD | NOTIFICATION_KEYWORD|
-                    NAMESPACE_KEYWORD | MUST_KEYWORD | MODULE_KEYWORD | MIN_ELEMENTS_KEYWORD | MAX_ELEMENTS_KEYWORD | MANDATORY_KEYWORD | LIST_KEYWORD |
-                    LENGTH_KEYWORD | LEAF_LIST_KEYWORD | LEAF_KEYWORD | KEY_KEYWORD | INPUT_KEYWORD | INCLUDE_KEYWORD | IMPORT_KEYWORD | IF_FEATURE_KEYWORD |
-                    IDENTITY_KEYWORD | GROUPING_KEYWORD | FRACTION_DIGITS_KEYWORD | FEATURE_KEYWORD | DEVIATE_KEYWORD | DEVIATION_KEYWORD | EXTENSION_KEYWORD |
-                    ERROR_MESSAGE_KEYWORD | ERROR_APP_TAG_KEYWORD | ENUM_KEYWORD | DESCRIPTION_KEYWORD | STATUS_KEYWORD | DEFAULT_KEYWORD | CONTAINER_KEYWORD | CONTACT_KEYWORD |
-                    CONFIG_KEYWORD | CHOICE_KEYWORD |  CASE_KEYWORD | BIT_KEYWORD | BELONGS_TO_KEYWORD | BASE_KEYWORD | AUGMENT_KEYWORD |
-                    ANYXML_KEYWORD | REFERENCE_KEYWORD | IDENTIFIER) string? (SEMICOLON | (LEFT_BRACE
-                    (unknown_statement |
-                    identifier_stmt)* RIGHT_BRACE)*);
-
-stmtend : (SEMICOLON) | (LEFT_BRACE identifier_stmt? RIGHT_BRACE);
-
-/* DO NOT replace stmtsep in rest of grammar with identifier_stmt!!! It might seems as code duplicity here, but this one is necessary.
-   Body of identifier_stmt generated from this grammar in YangParserListener is implemented in YangParserListenerImpl.
-   To ensure that all of the identifier_stmts will be resolved correctly the YangParserListenerImpl contains code that handles
-   specifcly identifier_stmts -> i.e. transforms identifier_stmt into QName. The stmtsep is used for parsing extension statements
-   placed outside of body_stmt.
- */
-stmtsep : IDENTIFIER string? (stmtend | (LEFT_BRACE unknown_statement* RIGHT_BRACE));
-// string validated in DeviationBuilder.setDeviate() as REPLACE_KEYWORD
-deviate_replace_stmt : DEVIATE_KEYWORD string (SEMICOLON | (LEFT_BRACE (identifier_stmt |type_stmt | units_stmt | default_stmt | config_stmt | mandatory_stmt | min_elements_stmt | max_elements_stmt )* RIGHT_BRACE));
-// string validated in DeviationBuilder.setDeviate() as DELETE_KEYWORD
-deviate_delete_stmt : DEVIATE_KEYWORD string (SEMICOLON | (LEFT_BRACE (identifier_stmt |units_stmt | must_stmt | unique_stmt | default_stmt )* RIGHT_BRACE));
-// string validated in DeviationBuilder.setDeviate() as ADD_KEYWORD
-deviate_add_stmt : DEVIATE_KEYWORD string (SEMICOLON | (LEFT_BRACE (identifier_stmt |units_stmt | must_stmt | unique_stmt | default_stmt | config_stmt | mandatory_stmt  | min_elements_stmt  | max_elements_stmt )* RIGHT_BRACE));
-// string validated in DeviationBuilder.setDeviate() as NOT_SUPPORTED_KEYWORD
-deviate_not_supported_stmt : DEVIATE_KEYWORD string (SEMICOLON | (LEFT_BRACE identifier_stmt? RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterDeviation_stmt()
-deviation_stmt : DEVIATION_KEYWORD string LEFT_BRACE (identifier_stmt |description_stmt | reference_stmt | deviate_not_supported_stmt | deviate_add_stmt | deviate_replace_stmt | deviate_delete_stmt)+ RIGHT_BRACE;
-// string validated in YangModelBasicValidationListener.enterNotification_stmt()
-notification_stmt : NOTIFICATION_KEYWORD string (SEMICOLON | (LEFT_BRACE (identifier_stmt |if_feature_stmt | status_stmt | description_stmt | reference_stmt | typedef_stmt | grouping_stmt | data_def_stmt )* RIGHT_BRACE));
-output_stmt : OUTPUT_KEYWORD LEFT_BRACE (identifier_stmt |typedef_stmt | grouping_stmt | data_def_stmt )* RIGHT_BRACE;
-input_stmt : INPUT_KEYWORD LEFT_BRACE (identifier_stmt |typedef_stmt | grouping_stmt | data_def_stmt )* RIGHT_BRACE;
-// string valided in YangModelBasicValidationListener.enterRpc_stmt()
-rpc_stmt : RPC_KEYWORD string (SEMICOLON | (LEFT_BRACE (identifier_stmt |if_feature_stmt  | status_stmt | description_stmt | reference_stmt | typedef_stmt | grouping_stmt | input_stmt | output_stmt )* RIGHT_BRACE));
-// string validated in ParserListenerUtils.stringFromStringContext()
-when_stmt : WHEN_KEYWORD string (SEMICOLON | (LEFT_BRACE (identifier_stmt |description_stmt | reference_stmt )* RIGHT_BRACE));
-
-// string validated in YangModelBasicValidationListener.enterAugment_stmt()
-augment_stmt : AUGMENT_KEYWORD string LEFT_BRACE  (identifier_stmt |when_stmt | if_feature_stmt | status_stmt | description_stmt | reference_stmt | data_def_stmt | case_stmt)* RIGHT_BRACE;
-// string not validated
-uses_augment_stmt : AUGMENT_KEYWORD string LEFT_BRACE (identifier_stmt |when_stmt | if_feature_stmt | status_stmt | description_stmt | reference_stmt | data_def_stmt | case_stmt)* RIGHT_BRACE;
-refine_anyxml_stmts : (identifier_stmt |must_stmt | config_stmt | mandatory_stmt | description_stmt | reference_stmt )*;
-refine_case_stmts : (identifier_stmt |description_stmt | reference_stmt )*;
-refine_choice_stmts : (identifier_stmt |default_stmt | config_stmt | mandatory_stmt | description_stmt | reference_stmt )*;
-refine_list_stmts : (identifier_stmt |must_stmt | config_stmt | min_elements_stmt | max_elements_stmt | description_stmt | reference_stmt )*;
-refine_leaf_list_stmts : (identifier_stmt |must_stmt | config_stmt | min_elements_stmt | max_elements_stmt | description_stmt | reference_stmt )*;
-refine_leaf_stmts : (identifier_stmt |must_stmt | default_stmt | config_stmt | mandatory_stmt | description_stmt | reference_stmt )*;
-refine_container_stmts : (identifier_stmt |must_stmt | presence_stmt | config_stmt | description_stmt | reference_stmt )*;
-refine_pom : (refine_container_stmts | refine_leaf_stmts | refine_leaf_list_stmts | refine_list_stmts | refine_choice_stmts | refine_case_stmts | refine_anyxml_stmts);
-// string validated in YangModelBasicValidationListener.enterRefine_stmt()
-refine_stmt : REFINE_KEYWORD string (SEMICOLON | (LEFT_BRACE  (refine_pom) RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterUses_stmt()
-uses_stmt : USES_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |when_stmt | if_feature_stmt | status_stmt | description_stmt | reference_stmt | refine_stmt | uses_augment_stmt )* RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterAnyxml_stmt()
-anyxml_stmt : ANYXML_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |when_stmt | if_feature_stmt | must_stmt | config_stmt | mandatory_stmt | status_stmt | description_stmt | reference_stmt )* RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterCase_stmt()
-case_stmt : CASE_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |when_stmt | if_feature_stmt | status_stmt | description_stmt | reference_stmt | data_def_stmt )* RIGHT_BRACE));
-short_case_stmt : container_stmt | leaf_stmt | leaf_list_stmt | list_stmt | anyxml_stmt;
-// string validated in YangModelBasicValidationListener.enterChoice_stmt()
-choice_stmt : CHOICE_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |when_stmt | if_feature_stmt | default_stmt | config_stmt | mandatory_stmt | status_stmt | description_stmt | reference_stmt | short_case_stmt | case_stmt)* RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterUnique_stmt()
-unique_stmt : UNIQUE_KEYWORD string stmtend;
-// string validated in YangModelBasicValidationListener.enterKey_stmt()
-key_stmt : KEY_KEYWORD string stmtend;
-// string validated in YangModelBasicValidationListener.enterList_stmt()
-list_stmt : LIST_KEYWORD string LEFT_BRACE  (when_stmt | if_feature_stmt | must_stmt | key_stmt | unique_stmt | config_stmt | min_elements_stmt | max_elements_stmt | ordered_by_stmt | status_stmt | description_stmt | reference_stmt | typedef_stmt | grouping_stmt | data_def_stmt | identifier_stmt)* RIGHT_BRACE;
-// string validated in YangModelBasicValidationListener.enterLeaf_list_stmt()
-leaf_list_stmt : LEAF_LIST_KEYWORD string LEFT_BRACE  (identifier_stmt |when_stmt | if_feature_stmt | type_stmt | units_stmt | must_stmt | config_stmt | min_elements_stmt | max_elements_stmt | ordered_by_stmt | status_stmt | description_stmt | reference_stmt )* RIGHT_BRACE;
-// string validated in YangModelBasicValidationListener.enterLeaf_stmt()
-leaf_stmt : LEAF_KEYWORD string LEFT_BRACE  (identifier_stmt |when_stmt | if_feature_stmt | type_stmt | units_stmt | must_stmt | default_stmt | config_stmt | mandatory_stmt | status_stmt | description_stmt | reference_stmt )* RIGHT_BRACE;
-// string validated in YangModelBasicValidationListener.enterContainer_stmt()
-container_stmt : CONTAINER_KEYWORD string (SEMICOLON | (LEFT_BRACE  (when_stmt | if_feature_stmt | must_stmt | presence_stmt | config_stmt | status_stmt | description_stmt | reference_stmt | typedef_stmt | grouping_stmt | data_def_stmt | identifier_stmt)* RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterGrouping_stmt()
-grouping_stmt : GROUPING_KEYWORD string (SEMICOLON | (LEFT_BRACE (status_stmt | description_stmt | reference_stmt | typedef_stmt | grouping_stmt | data_def_stmt | identifier_stmt)* RIGHT_BRACE));
-// string validated in ParserListenerUtils.createEnumPair()
-value_stmt : VALUE_KEYWORD string stmtend;
-// string validated in ParserListenerUtils.parseMaxElements()
-max_value_arg : string;
-// string validated in ParserListenerUtils.parseMinElements()
-min_value_arg : string;
-max_elements_stmt : MAX_ELEMENTS_KEYWORD max_value_arg stmtend;
-min_elements_stmt : MIN_ELEMENTS_KEYWORD min_value_arg stmtend;
-// string validated in ParserListenerUtils.parseMust()
-error_app_tag_stmt : ERROR_APP_TAG_KEYWORD string stmtend;
-// string validated in ParserListenerUtils.parseMust()
-error_message_stmt : ERROR_MESSAGE_KEYWORD string stmtend;
-// string validated in ParserListenerUtils.parseMust()
-must_stmt : MUST_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |error_message_stmt | error_app_tag_stmt | description_stmt | reference_stmt )* RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterOrdered_by_arg() as USER_KEYWORD | SYSTEM_KEYWORD
-ordered_by_arg : string;
-ordered_by_stmt : ORDERED_BY_KEYWORD ordered_by_arg stmtend;
-// string not validated
-presence_stmt : PRESENCE_KEYWORD string stmtend;
-// string validated in YangModelBasicValidationListener.enterMandatory_arg() as TRUE_KEYWORD | FALSE_KEYWORD
-mandatory_arg :string;
-mandatory_stmt : MANDATORY_KEYWORD mandatory_arg stmtend;
-// string validated in YangModelBasicValidationListener.enterConfig_arg() as TRUE_KEYWORD | FALSE_KEYWORD
-config_arg : string;
-config_stmt : CONFIG_KEYWORD config_arg stmtend;
-// string validated in YangModelBasicValidationListener.enterStatus_arg() as CURRENT_KEYWORD | OBSOLETE_KEYWORD | DEPRECATED_KEYWORD
-status_arg : string;
-status_stmt : STATUS_KEYWORD status_arg stmtend;
-// string validated in ParserListenerUtils.parseBit()
-position_stmt : POSITION_KEYWORD string stmtend;
-// string validated in ParserListenerUtils.parseBit()
-bit_stmt : BIT_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |position_stmt | status_stmt | description_stmt | reference_stmt )* RIGHT_BRACE));
-bits_specification : bit_stmt (bit_stmt | identifier_stmt)*;
-union_specification : type_stmt (identifier_stmt | type_stmt )*;
-identityref_specification : base_stmt  ;
-instance_identifier_specification : (require_instance_stmt )?;
-// string validated in ParserListenerUtils.isRequireInstance() as TRUE_KEYWORD | FALSE_KEYWORD
-require_instance_arg :string;
-require_instance_stmt : REQUIRE_INSTANCE_KEYWORD require_instance_arg stmtend;
-// string validated in ParserListenerUtils.parseLeafrefPath()
-path_stmt : PATH_KEYWORD string stmtend;
-leafref_specification : path_stmt;
-// string validated in ParserListenerUtils.createEnumPair()
-enum_stmt : ENUM_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |value_stmt | status_stmt | description_stmt | reference_stmt )* RIGHT_BRACE));
-enum_specification : enum_stmt (identifier_stmt | enum_stmt )*;
-// string not validated
-default_stmt : DEFAULT_KEYWORD string stmtend;
-// string validated in ParserListenerUtils.parsePatternConstraint()
-pattern_stmt : PATTERN_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |error_message_stmt | error_app_tag_stmt | description_stmt | reference_stmt )* RIGHT_BRACE));
-// string validated in ParserListenerUtils.parseLengthConstraints()
-length_stmt : LENGTH_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |error_message_stmt | error_app_tag_stmt | description_stmt | reference_stmt )* RIGHT_BRACE));
-string_restrictions : (length_stmt | identifier_stmt | pattern_stmt)*;
-// string validated in ParserListenerUtils.parseFractionDigits()
-fraction_digits_stmt : FRACTION_DIGITS_KEYWORD string stmtend;
-decimal64_specification : (numerical_restrictions? (identifier_stmt)* fraction_digits_stmt | fraction_digits_stmt (identifier_stmt)* numerical_restrictions?);
-// string validated in ParserListenerUtils.parseRangeConstraints()
-range_stmt : RANGE_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt |error_message_stmt | error_app_tag_stmt | description_stmt | reference_stmt )* RIGHT_BRACE));
-numerical_restrictions : range_stmt ;
-type_body_stmts : (identifier_stmt)* (numerical_restrictions | decimal64_specification | string_restrictions | enum_specification | leafref_specification | identityref_specification | instance_identifier_specification | bits_specification | union_specification) (identifier_stmt)*;
-// string validated in YangModelBasicValidationListener.enterType_stmt()
-type_stmt : TYPE_KEYWORD string (SEMICOLON | (LEFT_BRACE  type_body_stmts RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterTypedef_stmt()
-typedef_stmt : TYPEDEF_KEYWORD string LEFT_BRACE  (identifier_stmt | type_stmt | units_stmt | default_stmt | status_stmt | description_stmt | reference_stmt )+ RIGHT_BRACE;
-// string validated in YangModelBasicValidationListener.enterIf_feature_stmt()
-if_feature_stmt : IF_FEATURE_KEYWORD string stmtend;
-// string validated in YangModelBasicValidationListener.enterFeature_stmt()
-feature_stmt : FEATURE_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt | if_feature_stmt | status_stmt | description_stmt | reference_stmt )* RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterBase_stmt()
-base_stmt : BASE_KEYWORD string stmtend;
-// string validated in YangModelBasicValidationListener.enterIdentity_stmt()
-identity_stmt : IDENTITY_KEYWORD string (SEMICOLON | (LEFT_BRACE  (identifier_stmt | base_stmt | status_stmt | description_stmt | reference_stmt )* RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterYin_element_arg() as TRUE_KEYWORD | FALSE_KEYWORD
-yin_element_arg : string;
-yin_element_stmt : YIN_ELEMENT_KEYWORD yin_element_arg stmtend;
-
-// string validated in YangModelBasicValidationListener.enterArgument_stmt()
-argument_stmt : ARGUMENT_KEYWORD string (SEMICOLON | (LEFT_BRACE identifier_stmt* yin_element_stmt? identifier_stmt* RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterExtension_stmt()
-extension_stmt : EXTENSION_KEYWORD string (SEMICOLON | (LEFT_BRACE  (argument_stmt | status_stmt | description_stmt | reference_stmt | unknown_statement)* RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterRevision_date_stmt()
-revision_date_stmt : REVISION_DATE_KEYWORD string stmtend;
-// string validated in YangModelBasicValidationListener.enterRevision_stmt()
-revision_stmt : REVISION_KEYWORD string (SEMICOLON | (LEFT_BRACE stmtsep* (description_stmt )? (reference_stmt )? (unknown_statement)? RIGHT_BRACE));
-// string not validated
-units_stmt : UNITS_KEYWORD string stmtend;
-// string not validated
-reference_stmt : REFERENCE_KEYWORD string stmtend;
-// string not validated
-description_stmt : DESCRIPTION_KEYWORD string stmtend;
-// string not validated
-contact_stmt : CONTACT_KEYWORD string stmtend;
-// string not validated
-organization_stmt : ORGANIZATION_KEYWORD string stmtend;
-// string validated in YangModelBasicValidationListener.enterBelongs_to_stmt()
-belongs_to_stmt : BELONGS_TO_KEYWORD string LEFT_BRACE  stmtsep* prefix_stmt  RIGHT_BRACE;
-// string validated in YangModelBasicValidationListener.enterPrefix_stmt()
-prefix_stmt : PREFIX_KEYWORD string stmtend;
-// string validated in YangModelBasicValidationListener.enterNamespace_stmt()
-namespace_stmt : NAMESPACE_KEYWORD string stmtend;
-// string validated in YangModelBasicValidationListener.enterInclude_stmt()
-include_stmt : INCLUDE_KEYWORD string (SEMICOLON | (LEFT_BRACE stmtsep* (revision_date_stmt )? RIGHT_BRACE));
-// string validated in YangModelBasicValidationListener.enterImport_stmt()
-import_stmt : IMPORT_KEYWORD string LEFT_BRACE stmtsep* prefix_stmt  (revision_date_stmt )? RIGHT_BRACE;
-// string validated in YangModelBasicValidationListener.enterModule_header_stmts() and/or YangModelBasicValidationListener.enterSubmodule_header_stmts()
-yang_version_stmt : YANG_VERSION_KEYWORD string stmtend;
-data_def_stmt : container_stmt | leaf_stmt | leaf_list_stmt | list_stmt | choice_stmt | anyxml_stmt | uses_stmt;
-body_stmts : (( identifier_stmt| extension_stmt | feature_stmt | identity_stmt | typedef_stmt | grouping_stmt | data_def_stmt | augment_stmt | rpc_stmt | notification_stmt | deviation_stmt) )*;
-revision_stmts :  (revision_stmt | stmtsep)*;
-linkage_stmts : (import_stmt stmtsep* | include_stmt stmtsep*)*;
-meta_stmts : (organization_stmt stmtsep* | contact_stmt stmtsep* | description_stmt stmtsep* | reference_stmt stmtsep*)*;
-submodule_header_stmts : (yang_version_stmt stmtsep* | belongs_to_stmt stmtsep*)+ ;
-module_header_stmts :  (yang_version_stmt stmtsep* | namespace_stmt stmtsep* | prefix_stmt stmtsep*)+ ;
-// string validated in YangModelBasicValidationListener.enterSubmodule_stmt()
-submodule_stmt : SUBMODULE_KEYWORD string LEFT_BRACE stmtsep* submodule_header_stmts linkage_stmts meta_stmts revision_stmts body_stmts RIGHT_BRACE;
-// string validated in YangModelBasicValidationListener.enterModule_stmt()
-module_stmt : MODULE_KEYWORD string LEFT_BRACE stmtsep* module_header_stmts linkage_stmts meta_stmts revision_stmts body_stmts RIGHT_BRACE;
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/AugmentationSchemaBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/AugmentationSchemaBuilder.java
deleted file mode 100644 (file)
index c6dcc41..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-/**
- * Builder for {@link AugmentationSchema}, which represents 'augment' statement.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface AugmentationSchemaBuilder extends DataNodeContainerBuilder,DocumentedNodeBuilder {
-
-    /**
-     * Returns when condition
-     *
-     * If when condition is present node defined by the parent data definition
-     * statement is only valid when the returned XPath expression conceptually
-     * evaluates to "true" for a particular instance, then the node defined by
-     * the parent data definition statement is valid; otherwise, it is not.
-     *
-     * @return when condition as string
-     */
-    String getWhenCondition();
-
-    /**
-     * Adds string representation of when condition.
-     *
-     * If when condition is present node defined by the parent data definition
-     * statement is only valid when the returned XPath
-     * expression conceptually evaluates to "true"
-     * for a particular instance, then the node defined by the parent data
-     * definition statement is valid; otherwise, it is not.
-     *
-     * @param whenCondition string representation of when condition
-     */
-    void addWhenCondition(String whenCondition);
-
-    /**
-     * Returns target path representation as was present in schema source.
-     *
-     * @return path to target node as String
-     */
-    String getTargetPathAsString();
-
-    /**
-     * Get path to target node.
-     * <p>
-     * Note that individual parts of path contain only prefix relative to
-     * current context and name of node.
-     * </p>
-     *
-     * @return path to target node as SchemaPath
-     */
-    SchemaPath getTargetPath();
-
-    @Override
-    AugmentationSchema build();
-
-    /**
-     * Get information about augmentation process.
-     *
-     * @return true, if augmentation process was performed already, false
-     *         otherwise
-     */
-    boolean isResolved();
-
-    /**
-     * Set information about augmentation process.
-     *
-     * @param resolved information about augmentation process
-     */
-    void setResolved(boolean resolved);
-
-    /**
-     *
-     * Returns position of defining <code>augment</code> statement
-     * as was present in schema source.
-     *
-     * @return Position of definiing augment statement in source code.
-     */
-    int getOrder();
-
-    /**
-     *  Set true if target of augment is unsupported (e.g. node in body of extension).
-     *  In such case, augmentation is skipped and AugmentationSchema is not built.
-     *
-     *  @param unsupportedTarget information about target of augment statement
-     */
-    void setUnsupportedTarget(boolean unsupportedTarget);
-
-    /**
-     *  Return true if target of augment is unsupported (e.g. node in body of extension).
-     *  In such case, augmentation is skipped and AugmentationSchema is not built.
-     *
-     *  @return information about target of augment statement
-     */
-    boolean isUnsupportedTarget();
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/AugmentationTargetBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/AugmentationTargetBuilder.java
deleted file mode 100644 (file)
index 79133f7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-/**
- * Interface for builders of those nodes, which can be augmentation targets.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface AugmentationTargetBuilder {
-
-    /**
-     * Add augment, which points to this node.
-     *
-     * @param augment
-     *            augment which points to this node
-     */
-    void addAugmentation(AugmentationSchemaBuilder augment);
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/Builder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/Builder.java
deleted file mode 100644 (file)
index 3e13656..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import java.util.List;
-import org.opendaylight.yangtools.concepts.Mutable;
-
-/**
- * Parent interface for all builder interfaces.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface Builder extends Mutable {
-
-    /**
-     * Returns name of module in which node created by this builder
-     * was declared.
-     *
-     * @return module name
-     */
-    String getModuleName();
-
-    /**
-     * Get current line in yang file, on which statement
-     * associated with this builder was declared.
-     *
-     * @return current line in yang file
-     */
-    int getLine();
-
-    /**
-     * Returns parent node builder of this node.
-     *
-     * @return parent node builder or null if this is top level node
-     */
-    Builder getParent();
-
-    /**
-     * Set parent of this node.
-     *
-     * @param parent
-     *            parent node builder
-     */
-    void setParent(Builder parent);
-
-    /**
-     * Adds an unknown node builder to this builder.
-     *
-     * When product (child) is builded by the {@link #build()}
-     * method, this builder is also built and unknown node is added
-     * as child to the product of this builder.
-     *
-     * @param unknownNode an unknown node builder
-     */
-    void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode);
-
-    /**
-     * Get builders of unknown nodes defined in this node.
-     *
-     * @return collection of UnknownSchemaNodeBuilder objects
-     */
-    List<UnknownSchemaNodeBuilder> getUnknownNodes();
-
-    /**
-     * Build YANG data model node.
-     *
-     * This method should create an instance of YANG data model node. After
-     * creating an instance, this instance should be returned for each call
-     * without repeating build process.
-     *
-     * @return YANG data model node
-     */
-    Object build();
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/ConstraintsBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/ConstraintsBuilder.java
deleted file mode 100644 (file)
index 4d1cd89..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import java.util.Set;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface ConstraintsBuilder extends Builder<ConstraintDefinition> {
-
-    /**
-     * Returns module name in which constraint is defined.
-     *
-     * @return module name
-     */
-    String getModuleName();
-
-    /**
-     *
-     * Return line on which constraints were defined.
-     *
-     * @return line
-     */
-    int getLine();
-
-    /**
-     *
-     * Returns number of minimum required elements.
-     *
-     * This constraint has meaning only if associated node is list or leaf-list.
-     *
-     * @return number of minimum required elements.
-     */
-    Integer getMinElements();
-
-    /**
-     *
-     * Sets number of minimum required elements.
-     *
-     * This constraint has meaning only if associated node is list or leaf-list.
-     *
-     * @param minElements
-     *            number of minimum required elements.
-     */
-    void setMinElements(Integer minElements);
-
-    /**
-     *
-     * Returns number of maximum required elements.
-     *
-     * This constraint has meaning only if associated node is list or leaf-list.
-     *
-     * @return number of maximum required elements.
-     */
-    Integer getMaxElements();
-
-    /**
-     *
-     * Sets number of maximum required elements.
-     *
-     * This constraint has meaning only if associated node is list or leaf-list.
-     *
-     * @param maxElements
-     *            number of maximum required elements.
-     */
-    void setMaxElements(Integer maxElements);
-
-    /**
-     * Returns <code>must</code> definition associated with this builder.
-     *
-     * @return <code>must</code> definition associated with this builder.
-     */
-    Set<MustDefinition> getMustDefinitions();
-
-    /**
-     * Adds must definition to product of this builder.
-     *
-     * @param must
-     *            <code>must</code> definition which should be associated with
-     *            parent node.
-     */
-    void addMustDefinition(MustDefinition must);
-
-    /**
-     * Returns when condition associated with this constraints.
-     *
-     * @return when condition associated with this constraints.
-     */
-    String getWhenCondition();
-
-    /**
-     * Sets when condition associated with this constraints.
-     *
-     * @param whenCondition
-     *            when condition.
-     */
-    void addWhenCondition(String whenCondition);
-
-    /**
-     * Returns true if associated node is mandatory.
-     *
-     *
-     * @return true if associated node is mandatory.
-     */
-    boolean isMandatory();
-
-    /**
-     * Sets mandatory status of parent node
-     *
-     * @param mandatory mandatory status
-     */
-    void setMandatory(boolean mandatory);
-
-    /**
-     * Build constraint definition
-     *
-     * @return instance of ConstraintDefinition created from this builder
-     *
-     * @deprecated Use {@link #build()} instead
-     */
-    @Deprecated
-    ConstraintDefinition toInstance();
-}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/DataNodeContainerBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/DataNodeContainerBuilder.java
deleted file mode 100644 (file)
index fa06939..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-
-/**
- * Common builder for for all YANG {@link DataNodeContainer}
- * <code>augment, case, container,
- * grouping, list, module, notification</code>.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface DataNodeContainerBuilder extends Builder {
-
-    /**
-     * Returns QName of this node.
-     *
-     * @return QName of this node
-     */
-    QName getQName();
-
-    /**
-     * Returns Schema path of this node.
-     *
-     * @return SchemaPath of this node
-     */
-    SchemaPath getPath();
-
-    /**
-     * Returns list of of child node builders in order they are declared in yang
-     * file.
-     *
-     * This child node builder are build, during invoking {@link #build()} and
-     * added as children to resulting {@link DataNodeContainer}.
-     *
-     * @return collection child nodes builders
-     */
-    List<DataSchemaNodeBuilder> getChildNodeBuilders();
-
-    /**
-     * Retrieves child node builder by local name.
-     *
-     * @param name
-     *            name of child to seek
-     * @return child node with given name if present, null otherwise
-     */
-    DataSchemaNodeBuilder getDataChildByName(String name);
-
-    /**
-     * Add builder of child node to this node.
-     *
-     * @param childNode name of child node to add
-     */
-    void addChildNode(DataSchemaNodeBuilder childNode);
-
-    /**
-     * Add builder of child node to this node at specified position.
-     *
-     * @param index position at which the child node will be added
-     * @param childNode name of child node to add at specified position
-     */
-    void addChildNode(int index, DataSchemaNodeBuilder childNode);
-
-    void addChildNode(DataSchemaNode childNode);
-
-    void addChildNodeToContext(DataSchemaNodeBuilder childNode);
-
-    /**
-     * Get already built groupings defined in this node.
-     *
-     * @return collection of GroupingDefinition objects
-     */
-    Set<GroupingDefinition> getGroupings();
-
-    /**
-     * Get builders of groupings defined in this node.
-     *
-     * @return collection of grouping builders
-     */
-    Set<GroupingBuilder> getGroupingBuilders();
-
-    /**
-     * Add builder of grouping statement to this node.
-     *
-     * @param groupingBuilder grouping statement builder
-     */
-    void addGrouping(GroupingBuilder groupingBuilder);
-
-    /**
-     * Get builders of uses defined in this node.
-     *
-     * @return collection of uses builders
-     */
-    List<UsesNodeBuilder> getUsesNodeBuilders();
-
-    /**
-     * Add builder of uses statement to this node.
-     *
-     * @param usesBuilder uses statement builder
-     */
-    void addUsesNode(UsesNodeBuilder usesBuilder);
-
-    /**
-     * Returns set of already built type definitions.
-     *
-     * @return set of already built type definitions.
-     */
-    Set<TypeDefinition<?>> getTypeDefinitions();
-
-    /**
-     * Returns builders of typedef statement defined in this node.
-     *
-     * @return builders of typedef statement defined in this node.
-     */
-    Set<TypeDefinitionBuilder> getTypeDefinitionBuilders();
-
-    /**
-     * Add typedef builder to this node.
-     *
-     * @param typedefBuilder
-     *            Builder to add to this node.
-     */
-    void addTypedef(TypeDefinitionBuilder typedefBuilder);
-
-    /**
-     * Returns an instance of product - DataNodeContainer
-     *
-     * Returns an instance of data node container with children and properties
-     * constructed as per this builder state, all nested builders are also built
-     * and their product is set to DataNodeContainer.
-     *
-     * @return Instance of DataNodeContainer
-     */
-    @Override
-    DataNodeContainer build();
-
-    /**
-     * Returns map of child nodes of this node. Child nodes should be in same
-     * order as they were defined in yang file.
-     *
-     * @return map of child nodes of this node
-     */
-    Map<QName, DataSchemaNode> getChildNodes();
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/DataSchemaNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/DataSchemaNodeBuilder.java
deleted file mode 100644 (file)
index cf0ed93..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-
-/**
- * Interface for all yang data-schema nodes [anyxml, case, container, grouping,
- * list, module, notification].
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface DataSchemaNodeBuilder extends SchemaNodeBuilder, GroupingMember {
-
-    /**
-     * Get original builder definition from grouping, where it is defined.
-     *
-     * @return original builder definition from grouping if this node is added
-     *         by uses, null otherwise
-     */
-    SchemaNodeBuilder getOriginal();
-
-    /**
-     * Set original builder definition from grouping
-     *
-     * @param original
-     *            original builder definition from grouping
-     */
-    void setOriginal(SchemaNodeBuilder original);
-
-    /**
-     *
-     * Returns true if product of this builder is added by augmentation.
-     *
-     * @return true, if this node is added by augmentation, false otherwise
-     */
-    boolean isAugmenting();
-
-    /**
-     * Set if the product of the builder node is introduced by augmentation.
-     *
-     * @param augmenting information about augmentation
-     */
-    void setAugmenting(boolean augmenting);
-
-    /**
-     * Get value of config statement.
-     *
-     * @return value of config statement
-     */
-    boolean isConfiguration();
-
-    /**
-     * Set config statement to the product.
-     *
-     *
-     * @param config true if config true was set, false if config false was set.
-     */
-    void setConfiguration(boolean config);
-
-    /**
-     * Get constraints of this builder.
-     *
-     * @return constraints of this builder
-     */
-    ConstraintsBuilder getConstraints();
-
-    /**
-     * Build DataSchemaNode object from this builder.
-     *
-     * @return instance of {@link DataSchemaNode} based on the state present in this builder.
-     */
-    @Override
-    DataSchemaNode build();
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/DocumentedNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/DocumentedNodeBuilder.java
deleted file mode 100644 (file)
index 804f7f8..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2014 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.builder.api;
-
-import org.opendaylight.yangtools.yang.model.api.Status;
-
-/**
- * Mixin-style builder interfac for nodes, which may have documentation attached.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface DocumentedNodeBuilder {
-
-    /**
-     * Returns description of resulting schema node
-     * as was defined by description statement.
-     *
-     * @return description statement
-     */
-    String getDescription();
-
-    /**
-     * Set description to this node.
-     *
-     * @param description description of this node
-     */
-    void setDescription(String description);
-
-    /**
-     * Get reference of this node.
-     *
-     * @return reference statement
-     */
-    String getReference();
-
-    /**
-     * Set reference to this node.
-     *
-     * @param reference reference to this node
-     */
-    void setReference(String reference);
-
-    /**
-     * Get status of this node.
-     *
-     * @return status statement
-     */
-    Status getStatus();
-
-    /**
-     * Set status to this node.
-     *
-     * @param status status of this node
-     */
-    void setStatus(Status status);
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/ExtensionBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/ExtensionBuilder.java
deleted file mode 100644 (file)
index e9cdbe1..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2014 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.builder.api;
-
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-
-/**
- * Builder for extension statement.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface ExtensionBuilder extends SchemaNodeBuilder {
-
-    /**
-     * Sets argument name as was defined in YANG source
-     *
-     * @param argument argument name
-     */
-    void setArgument(String argument);
-
-    /**
-     * Sets if extension should be represented in YIN format as element.
-     *
-     *
-     * @param yin true if extension should be represented in YIN as element.
-     */
-    void setYinElement(boolean yin);
-
-    /**
-     *
-     * Builds definition of extednsion
-     *
-     */
-    @Override
-    ExtensionDefinition build();
-
-}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/GroupingBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/GroupingBuilder.java
deleted file mode 100644 (file)
index a82e0ee..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import java.util.List;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-
-/**
- * Interface for builders of 'grouping' statement.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface GroupingBuilder extends DataNodeContainerBuilder, SchemaNodeBuilder, GroupingMember {
-
-    /**
-     * Build GroupingDefinition object from this builder.
-     *
-     * @return Instance of {@link GroupingDefinition} described by this builder.
-     */
-    @Override
-    GroupingDefinition build();
-
-    /**
-     *
-     * Returns instantiation of grouping child nodes under supplied builder.
-     *
-     * Supplied newParent is not modified.
-     *
-     * For each {@link #getChildNodeBuilders()} new builder is created,
-     * which has supplied new parent set as their {@link Builder#getParent()}
-     * and QNames have updated namespace and revision per supplied parent
-     * node.
-     *
-     * @param newParent Parent node, under which this grouping should be instantiated.
-     * @return List of new builders representing instantiation of this grouping.
-     */
-    List<DataSchemaNodeBuilder> instantiateChildNodes(Builder newParent);
-
-
-   /**
-    *
-    * Returns instantiation of grouping type definitions under supplied builder.
-    *
-    * Supplied newParent is not modified.
-    *
-    * For each {@link #getTypeDefinitionBuilders()} new builder is created,
-    * which has supplied new parent set as their {@link Builder#getParent()}
-    * and QNames have updated namespace and revision per supplied parent
-    * node.
-    *
-    * @param newParent Parent node, under which this grouping should be instantiated.
-    * @return Set of new builders representing instantiation of this grouping.
-    */
-    Set<TypeDefinitionBuilder> instantiateTypedefs(Builder newParent);
-
-   /**
-    *
-    * Returns instantiation of grouping definitions under supplied builder.
-    *
-    * Supplied newParent is not modified.
-    *
-    * For each {@link #getGroupingBuilders()} new builder is created,
-    * which has supplied new parent set as their {@link Builder#getParent()}
-    * and QNames have updated namespace and revision per supplied parent
-    * node.
-    *
-    * @param newParent Parent node, under which this grouping should be instantiated.
-    * @return Set of new builders representing instantiation of this grouping.
-    */
-    Set<GroupingBuilder> instantiateGroupings(Builder newParent);
-
-    /**
-    *
-    * Returns instantiation of unknown nodes under supplied builder.
-    *
-    * Supplied newParent is not modified.
-    *
-    * For each {@link #getUnknownNodes()} new builder is created,
-    * which has supplied new parent set as their {@link Builder#getParent()}
-    * and QNames have updated namespace and revision per supplied parent
-    * node.
-    *
-    * @param newParent Parent node, under which this grouping should be instantiated.
-    * @return Set of new builders representing instantiation of this grouping.
-    */
-    Set<UnknownSchemaNodeBuilder> instantiateUnknownNodes(Builder newParent);
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/GroupingMember.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/GroupingMember.java
deleted file mode 100644 (file)
index cfdc273..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-/**
- * Marker interface for nodes which can be defined in grouping statement.
- * [anyxml, choice, container, grouping, leaf, leaf-list, list, typedef, uses]
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface GroupingMember extends Builder {
-
-    /**
-     *
-     * @return true, if this node is added by uses statement, false otherwise
-     */
-    boolean isAddedByUses();
-
-    /**
-     * Set if this node is added by uses.
-     *
-     * @param addedByUses information about uses statement
-     */
-    void setAddedByUses(boolean addedByUses);
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/RefineBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/RefineBuilder.java
deleted file mode 100644 (file)
index f36eb7f..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2014 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.builder.api;
-
-import java.util.List;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-
-/**
- * Mutable holder for information contained in <code>refine</code>
- *
- * Represents a local change to node introduced by uses statement
- * e.g. change in documentation, configuration or properties.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface RefineBuilder extends DocumentedNodeBuilder {
-
-    /**
-     * Get value of config statement.
-     *
-     * @return value of config statement
-     */
-    Boolean isConfiguration();
-
-    /**
-     * Set config statement to the product.
-     *
-     *
-     * @param config true if config true was set, false if config false was set.
-     */
-    void setConfiguration(Boolean config);
-
-    /**
-     * Returns mandatory state of node or NULL if state was not refined.
-     *
-     *
-     * @return mandatory state of node or NULL if state was not refined.
-     */
-    Boolean isMandatory();
-
-    void setMandatory(Boolean mandatory);
-
-    /**
-     *
-     * Returns presence state of refined container.
-     *
-     * @return Presence state of refined container.
-     */
-    Boolean isPresence();
-
-    void setPresence(Boolean presence);
-
-    /**
-     * Returns <code>must</code> definition associated with this builder.
-     *
-     * @return <code>must</code> definition associated with this builder.
-     */
-    MustDefinition getMust();
-
-    /**
-     * Adds must definition to product of this builder.
-     *
-     * @param must <code>must</code> definition which should be associated with parent node.
-     */
-    void setMust(MustDefinition must);
-
-
-    /**
-    *
-    * Returns number of minimum required elements or NULL if minimum elements was not overriden.
-    *
-    * This constraint has meaning only if associated node is list or leaf-list.
-    *
-    * @return number of minimum required elements.
-    */
-   Integer getMinElements();
-
-   /**
-    *
-    * Sets number of minimum required elements.
-    *
-    * This constraint has meaning only if associated node is list or leaf-list.
-    *
-    * @param minElements
-    *            number of minimum required elements.
-    */
-   void setMinElements(Integer minElements);
-
-   /**
-   *
-   * Returns number of maximum elements or NULL if maximum elements was not overriden.
-   *
-   * This constraint has meaning only if associated node is list or leaf-list.
-   *
-   * @return number of maximum required elements.
-   */
-   Integer getMaxElements();
-
-   /**
-   *
-   * Sets number of maximum required elements.
-   *
-   * This constraint has meaning only if associated node is list or leaf-list.
-   *
-   * @param maxElements number of maximum required elements.
-   */
-   void setMaxElements(Integer maxElements);
-
-    /**
-     *
-     * Returns string representation of path to refine target, which is relative to grouping root
-     *
-     * This string representation does not need to contain prefixes, since parent uses
-     * element introduces elements with namespace local to parent module.
-     *
-     * @return string representation of path to refine target, which is relative to grouping root
-     */
-    String getTargetPathString();
-
-    /**
-     *
-     * Returns module (source) name in which refine statement was defined.
-     *
-     * @return module (source) name in which refine statement was defined.
-     */
-    String getModuleName();
-
-    /**
-     * Line on which element was defined.
-     *
-     * @return Line on which element was defined.
-     */
-    int getLine();
-
-    /**
-     * Returns list of unknown schema node builders, which are associated
-     * with refine statement.
-     *
-     * @return Set of unknown schema node builders.
-     */
-    List<UnknownSchemaNodeBuilder> getUnknownNodes();
-
-    /**
-     * Returns string representation of default value or null, if default value was not refined.
-     *
-     * @return  string representation of default value or null, if default value was not refined.
-     */
-    String getDefaultStr();
-
-}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/SchemaNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/SchemaNodeBuilder.java
deleted file mode 100644 (file)
index a2d3a51..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-/**
- * Builder for {@link SchemaNode}.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface SchemaNodeBuilder extends DocumentedNodeBuilder, Builder {
-
-    /**
-     * Returns qname of resulting {@link SchemaNode}.
-     *
-     * @return QName of this node
-     */
-    QName getQName();
-
-    /**
-     * Returns schema path of resulting  {@link SchemaNode}.
-     *
-     * @return SchemaPath of this node
-     */
-    SchemaPath getPath();
-
-    /**
-     * Updates schema path to resulting {@link SchemaNode}.
-     *
-     * @param path schema path
-     */
-    void setPath(SchemaPath path);
-
-    /**
-     * Build SchemaNode object from this builder.
-     */
-    @Override
-    SchemaNode build();
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/TypeAwareBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/TypeAwareBuilder.java
deleted file mode 100644 (file)
index 90c7adc..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-
-/**
- * Builder for nodes, which can have 'type' statement must implement this
- * interface. [typedef, type, leaf, leaf-list, deviate]
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface TypeAwareBuilder extends Builder {
-
-    QName getTypeQName();
-
-    void setTypeQName(QName qname);
-
-    /**
-     * Get qname of this node.
-     *
-     * @return QName of this node
-     */
-    QName getQName();
-
-    /**
-     * Get schema path of this node.
-     *
-     * @return SchemaPath of this node
-     */
-    SchemaPath getPath();
-
-    /**
-     * Get resolved type of this node.
-     *
-     * @return type of this node if it is already resolved, null otherwise
-     */
-    TypeDefinition<?> getType();
-
-    /**
-     * Get builder of type of this node.
-     *
-     * @return builder of type of this node or null of this builder has already
-     *         resolved type
-     */
-    TypeDefinitionBuilder getTypedef();
-
-    /**
-     * Set resolved type to this node.
-     *
-     * @param type
-     *            type to set
-     */
-    void setType(TypeDefinition<?> type);
-
-    /**
-     * Set builder of type to this node.
-     *
-     * @param typedef
-     *            builder of type to set
-     */
-    void setTypedef(TypeDefinitionBuilder typedef);
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/TypeDefinitionBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/TypeDefinitionBuilder.java
deleted file mode 100644 (file)
index e6b6499..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import java.util.List;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
-
-/**
- * Interface for builders of 'typedef' statement.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface TypeDefinitionBuilder extends TypeAwareBuilder, SchemaNodeBuilder, GroupingMember {
-
-    /**
-     * Sets QName for resulting type definition.
-     *
-     * @param qname QName of resulting type
-     */
-    void setQName(QName qname);
-
-    @Override
-    TypeDefinition<?> build();
-
-    /**
-     *
-     * Returns range restrictions of resulting type definition.
-     *
-     * @return range restrictions of resulting type definition.
-     */
-    List<RangeConstraint> getRanges();
-
-    /**
-     * Set Range restrictions for resulting type definition.
-     *
-     * @param ranges
-     *            Range restrictions of resulting type definition.
-     */
-    void setRanges(List<RangeConstraint> ranges);
-
-    /**
-     *
-     * Returns length restrictions of resulting type definition.
-     *
-     * @return length restrictions of resulting type definition.
-     */
-    List<LengthConstraint> getLengths();
-
-    /**
-     * Set length restrictions for resulting type definition.
-     *
-     * @param lengths
-     *            Length restrictions of resulting type definition.
-     */
-    void setLengths(List<LengthConstraint> lengths);
-
-    /**
-     *
-     * Returns pattern restrictions of resulting type definition.
-     *
-     * @return range restrictions of resulting type definition.
-     */
-    List<PatternConstraint> getPatterns();
-
-    /**
-     * Set pattern restrictions for resulting type definition.
-     *
-     * @param patterns
-     *            patterns restrictions of resulting type definition.
-     */
-    void setPatterns(List<PatternConstraint> patterns);
-
-    /**
-     *
-     * Returns fractions digits of resulting type if it is derived
-     * from <code>decimal</code> built-in type.
-     *
-     * @return fractions digits of resulting type
-     */
-    Integer getFractionDigits();
-
-    /**
-     * Sets fractions digits of resulting type if it is derived from
-     * <code>decimal</code> built-in type.
-     *
-     * @param fractionDigits fraction digits
-     */
-    void setFractionDigits(Integer fractionDigits);
-
-    /**
-     *
-     * Returns default value of resulting type
-     *
-     * @return default value of resulting type
-     */
-    Object getDefaultValue();
-
-    /**
-     *
-     * Sets default value of resulting type
-     *
-     * @param defaultValue Default value of resulting type
-     */
-    void setDefaultValue(Object defaultValue);
-
-    /**
-     * Gets unit definition for resulting type
-     *
-     * @return unit definition for resulting type
-     */
-    String getUnits();
-
-    /**
-     * Sets units definition for resulting type
-     *
-     * @param units units definition for resulting type
-     */
-    void setUnits(String units);
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/UnknownSchemaNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/UnknownSchemaNodeBuilder.java
deleted file mode 100644 (file)
index f019bd6..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2014 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.builder.api;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface UnknownSchemaNodeBuilder extends SchemaNodeBuilder, DocumentedNodeBuilder {
-
-    @Override
-    SchemaPath getPath();
-
-    /**
-     * Returns true if node was added via uses statement
-     *
-     * @return true if node was added via uses statement
-     */
-    boolean isAddedByUses();
-
-    /**
-     * Sets flag if node was introduced by uses statement
-     *
-     * @param addedByUses true if node was introduced by uses, false otherwise
-     */
-    void setAddedByUses(boolean addedByUses);
-
-    /**
-     *
-     * Returns QName associated with this unknown node.
-     *
-     * @return QName associated with this unknown node.
-     */
-    QName getNodeType();
-
-    /**
-     * Returns string representation of argument associated with this unknown node.
-     *
-     * @return string representation of argument associated with this unknown node.
-     */
-    String getNodeParameter();
-
-    /**
-     * Sets string representation of argument associated with this unknown node.
-     * @param nodeParameter string representation of argument associated with this unknown node.
-     */
-    void setNodeParameter(String nodeParameter);
-
-    /**
-     * Returns extension definition, which declares this unknown node
-     * @return extension definition, which declares this unknown node
-     */
-    ExtensionDefinition getExtensionDefinition();
-
-    /**
-     * Sets extension definition, which declares this unknown node
-     * @param extensionDefinition extension definition, which declares this unknown node
-     */
-    void setExtensionDefinition(ExtensionDefinition extensionDefinition);
-
-    /**
-     * Returns builder for extension, which declares this unknown node.
-     *
-     * @return builder for extension, which declares this unknown node.
-     */
-    ExtensionBuilder getExtensionBuilder();
-
-    /**
-     * Sets extension builder, which declares this unknown node
-     *
-     * @param extension
-     *            extension builder, which declares this unknown node
-     */
-    void setExtensionBuilder(ExtensionBuilder extension);
-
-    @Override
-    UnknownSchemaNode build();
-
-    /**
-     * Sets node type associated with this unknown schema node
-     *
-     * @param qName node type associated with this unknown schema node
-     */
-    void setNodeType(QName qName);
-
-}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/UsesNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/api/UsesNodeBuilder.java
deleted file mode 100644 (file)
index aedeef3..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.api;
-
-import java.util.List;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-
-/**
- * Builder for  'uses' statement.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public interface UsesNodeBuilder extends GroupingMember {
-
-    /**
-     * Get parent of this uses node. Since uses can be defined only under on of
-     * module, container, list, case, grouping, input, output, notification or
-     * augment, return type is DataNodeContainerBuilder.
-     */
-    @Override
-    DataNodeContainerBuilder getParent();
-
-    /**
-     * Get target grouping path.
-     *
-     * @return target grouping path
-     */
-    SchemaPath getTargetGroupingPath();
-
-    /**
-     * Get grouping path.
-     *
-     * @return grouping path as SchemaPath
-     */
-    SchemaPath getGroupingPath();
-
-    /**
-     * Get grouping definition.
-     *
-     * @return GroupingDefinition if present, null otherwise
-     */
-    GroupingDefinition getGroupingDefinition();
-
-    /**
-     * Set grouping definition.
-     *
-     * @param groupingDefinition
-     *            GroupingDefinition object
-     */
-    void setGroupingDefinition(GroupingDefinition groupingDefinition);
-
-    /**
-     * Get grouping builder.
-     *
-     * @return GroupingBuilder if present, null otherwise
-     */
-    GroupingBuilder getGroupingBuilder();
-
-    /**
-     * Set grouping builder.
-     *
-     * @param grouping
-     *            GroupingBuilder object
-     */
-    void setGrouping(GroupingBuilder grouping);
-
-    /**
-     * Get information if this uses node is defined in augment.
-     *
-     * @return true, if this node is defined under augment statement, false
-     *         otherwise
-     */
-    boolean isAugmenting();
-
-    /**
-     * Set information if this uses node is defined in augment.
-     *
-     * @param augmenting information about augmentation
-     */
-    void setAugmenting(boolean augmenting);
-
-    /**
-     * Get augmentations defined in this uses node.
-     *
-     * @return set of augmentations defined in this node
-     */
-    Set<AugmentationSchemaBuilder> getAugmentations();
-
-    /**
-     * Add augment builder.
-     *
-     * @param builder
-     *            new builder of augment statement
-     */
-    void addAugment(AugmentationSchemaBuilder builder);
-
-    /**
-     * Get refine statements.
-     *
-     * @return list of RefineHolder objects
-     */
-    List<RefineBuilder> getRefines();
-
-    /**
-     * Get refined nodes.
-     *
-     * @return List of refined SchemaNodeBuilder objects
-     */
-    List<SchemaNodeBuilder> getRefineNodes();
-
-    /**
-     * Add refine statement.
-     *
-     * @param refine
-     *            new RefineHolder object
-     */
-    void addRefine(RefineBuilder refine);
-
-    /**
-     * Add refine node.
-     *
-     * @param refineNode
-     *            refined DataSchemaNodeBuilder object
-     */
-    void addRefineNode(DataSchemaNodeBuilder refineNode);
-
-    /**
-     * Build new UsesNode object.
-     *
-     *
-     * @return UsesNode Instance of {@link UsesNode} described by this builder.
-     */
-    @Override
-    UsesNode build();
-
-    /**
-     *
-     * Returns true if uses node was resolved and {@link #getGroupingBuilder()}
-     * was instantiated for parent done of this node.
-     *
-     * @return true if uses node was resolved and associated nodes were instantiated in parent node.
-     */
-    boolean isResolved();
-
-    /**
-     *
-     * Sets state of instantiation of {@link #getGroupingBuilder()}
-     * into parent node of this node.
-     *
-     * @deprecated Do not use this, this should be internal to the implementation
-     *  and public API contract.
-     *
-     *  @param resolved resolved
-     */
-    @Deprecated
-    void setResolved(boolean resolved);
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AnyXmlBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AnyXmlBuilder.java
deleted file mode 100644 (file)
index feb4629..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractSchemaNodeBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class AnyXmlBuilder extends AbstractSchemaNodeBuilder implements DataSchemaNodeBuilder {
-    private AnyXmlSchemaNodeImpl instance;
-
-    private boolean augmenting;
-    private boolean addedByUses;
-    private boolean configuration;
-    private AnyXmlSchemaNode originalNode;
-    private AnyXmlBuilder originalBuilder;
-    private final ConstraintsBuilder constraints;
-
-    public AnyXmlBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = path;
-        constraints = new ConstraintsBuilderImpl(moduleName, line);
-    }
-
-    public AnyXmlBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path,
-            final AnyXmlSchemaNode base) {
-        super(moduleName, line, qname);
-        this.schemaPath = path;
-        constraints = new ConstraintsBuilderImpl(moduleName, line, base.getConstraints());
-
-        description = base.getDescription();
-        reference = base.getReference();
-        status = base.getStatus();
-        augmenting = base.isAugmenting();
-        addedByUses = base.isAddedByUses();
-        originalNode = base;
-        configuration = base.isConfiguration();
-        unknownNodes.addAll(base.getUnknownSchemaNodes());
-    }
-
-    @Override
-    public AnyXmlSchemaNode build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new AnyXmlSchemaNodeImpl(qname, schemaPath);
-
-        instance.description = description;
-        instance.reference = reference;
-        instance.status = status;
-        instance.augmenting = augmenting;
-        instance.addedByUses = addedByUses;
-        instance.configuration = configuration;
-        instance.constraintsDef = constraints.build();
-
-        // ORIGINAL NODE
-        if (originalNode == null && originalBuilder != null) {
-            originalNode = originalBuilder.build();
-        }
-        instance.original = originalNode;
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public ConstraintsBuilder getConstraints() {
-        return constraints;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public void setAugmenting(final boolean augmenting) {
-        this.augmenting = augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public AnyXmlBuilder getOriginal() {
-        return originalBuilder;
-    }
-
-    @Override
-    public void setOriginal(final SchemaNodeBuilder builder) {
-        Preconditions.checkArgument(builder instanceof AnyXmlBuilder, "Original of anyxml cannot be " + builder);
-        this.originalBuilder = (AnyXmlBuilder) builder;
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public void setConfiguration(final boolean configuration) {
-        this.configuration = configuration;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        AnyXmlBuilder other = (AnyXmlBuilder) obj;
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "anyxml " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AnyXmlSchemaNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AnyXmlSchemaNodeImpl.java
deleted file mode 100644 (file)
index 97edd77..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class AnyXmlSchemaNodeImpl implements AnyXmlSchemaNode, DerivableSchemaNode {
-    private final QName qname;
-    private final SchemaPath path;
-    String description;
-    String reference;
-    Status status;
-    boolean configuration;
-    AnyXmlSchemaNode original;
-    ConstraintDefinition constraintsDef;
-    boolean augmenting;
-    boolean addedByUses;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-
-    AnyXmlSchemaNodeImpl(final QName qname, final SchemaPath path) {
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public Optional<AnyXmlSchemaNode> getOriginal() {
-        return Optional.fromNullable(original);
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public ConstraintDefinition getConstraints() {
-        return constraintsDef;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        AnyXmlSchemaNodeImpl other = (AnyXmlSchemaNodeImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return AnyXmlSchemaNodeImpl.class.getSimpleName() + "[" +
-                "qname=" + qname +
-                ", path=" + path +
-                "]";
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java
deleted file mode 100644 (file)
index c2e17c9..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainerBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class AugmentationSchemaBuilderImpl extends AbstractDocumentedDataNodeContainerBuilder implements AugmentationSchemaBuilder {
-    private final int order;
-    private AugmentationSchemaImpl instance;
-    private String whenCondition;
-
-    private final String augmentTargetStr;
-    private final SchemaPath targetPath;
-
-    private boolean resolved;
-    private boolean unsupportedTarget = false;
-
-    private AugmentationSchemaBuilder copyOf;
-
-    public AugmentationSchemaBuilderImpl(final String moduleName, final int line, final String augmentTargetStr,
-            final SchemaPath targetPath, final int order) {
-        super(moduleName, line, null);
-        this.order = order;
-        this.augmentTargetStr = augmentTargetStr;
-        this.targetPath = targetPath;
-    }
-
-    @Override
-    protected String getStatementName() {
-        return "augment";
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return targetPath;
-    }
-
-    @Override
-    public SchemaPath getTargetPath() {
-        return targetPath;
-    }
-
-    @Override
-    public AugmentationSchema build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        buildChildren();
-
-        instance = new AugmentationSchemaImpl(targetPath, order,this);
-
-        Builder parent = getParent();
-        if (parent instanceof ModuleBuilder) {
-            ModuleBuilder moduleBuilder = (ModuleBuilder) parent;
-            instance.namespace = moduleBuilder.getNamespace();
-            instance.revision = moduleBuilder.getRevision();
-        }
-
-        if (copyOf != null) {
-            instance.setCopyOf(copyOf.build());
-        }
-
-        RevisionAwareXPath whenStmt;
-        if (whenCondition == null) {
-            whenStmt = null;
-        } else {
-            whenStmt = new RevisionAwareXPathImpl(whenCondition, false);
-        }
-        instance.whenCondition = whenStmt;
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public boolean isResolved() {
-        return resolved;
-    }
-
-    @Override
-    public void setResolved(final boolean resolved) {
-        this.resolved = resolved;
-    }
-
-    /**
-     *  Set true if target of augment is unsupported (e.g. node in body of extension).
-     *  In such case, augmentation is skipped and AugmentationSchema is not built.
-     */
-    @Override
-    public void setUnsupportedTarget(final boolean unsupportedTarget) {
-        this.unsupportedTarget = unsupportedTarget;
-    }
-
-    /**
-     *  Return true if target of augment is unsupported (e.g. node in body of extension).
-     *  In such case, augmentation is skipped and AugmentationSchema is not built.
-     */
-    @Override
-    public boolean isUnsupportedTarget() {
-        return unsupportedTarget;
-    }
-
-    @Override
-    public String getWhenCondition() {
-        return whenCondition;
-    }
-
-    @Override
-    public void addWhenCondition(final String whenCondition) {
-        this.whenCondition = whenCondition;
-    }
-
-    @Override
-    public String getTargetPathAsString() {
-        return augmentTargetStr;
-    }
-
-    @Override
-    public int getOrder() {
-        return order;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 17;
-        int result = 1;
-        result = prime * result + Objects.hashCode(augmentTargetStr);
-        result = prime * result + Objects.hashCode(whenCondition);
-        result = prime * result + getChildNodeBuilders().hashCode();
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        AugmentationSchemaBuilderImpl other = (AugmentationSchemaBuilderImpl) obj;
-        if (augmentTargetStr == null) {
-            if (other.augmentTargetStr != null) {
-                return false;
-            }
-        } else if (!augmentTargetStr.equals(other.augmentTargetStr)) {
-            return false;
-        }
-        if (whenCondition == null) {
-            if (other.whenCondition != null) {
-                return false;
-            }
-        } else if (!whenCondition.equals(other.whenCondition)) {
-            return false;
-        }
-        if (!getChildNodeBuilders().equals(other.getChildNodeBuilders())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "augment " + augmentTargetStr;
-    }
-
-    public void setCopyOf(final AugmentationSchemaBuilder old) {
-        copyOf = old;
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AugmentationSchemaImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/AugmentationSchemaImpl.java
deleted file mode 100644 (file)
index 3da2ca6..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import java.net.URI;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.NamespaceRevisionAware;
-import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class AugmentationSchemaImpl extends AbstractDocumentedDataNodeContainer implements AugmentationSchema, NamespaceRevisionAware, Comparable<AugmentationSchemaImpl> {
-    private final int order;
-    private final SchemaPath targetPath;
-    RevisionAwareXPath whenCondition;
-
-    URI namespace;
-    Date revision;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-    private AugmentationSchema copyOf;
-
-    public AugmentationSchemaImpl(final SchemaPath targetPath, final int order, final AugmentationSchemaBuilderImpl builder) {
-        super(builder);
-        this.targetPath = targetPath;
-        this.order = order;
-    }
-
-    public void setCopyOf(final AugmentationSchema build) {
-        this.copyOf = build;
-    }
-
-    @Override
-    public Optional<AugmentationSchema> getOriginalDefinition() {
-        return Optional.fromNullable(this.copyOf);
-    }
-
-    @Override
-    public SchemaPath getTargetPath() {
-        return targetPath;
-    }
-
-    @Override
-    public RevisionAwareXPath getWhenCondition() {
-        return whenCondition;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public URI getNamespace() {
-        return namespace;
-    }
-
-    @Override
-    public Date getRevision() {
-        return revision;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 17;
-        int result = 1;
-        result = prime * result + Objects.hashCode(targetPath);
-        result = prime * result + Objects.hashCode(whenCondition);
-        result = prime * result + getChildNodes().hashCode();
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        AugmentationSchemaImpl other = (AugmentationSchemaImpl) obj;
-        if (targetPath == null) {
-            if (other.targetPath != null) {
-                return false;
-            }
-        } else if (!targetPath.equals(other.targetPath)) {
-            return false;
-        }
-        if (whenCondition == null) {
-            if (other.whenCondition != null) {
-                return false;
-            }
-        } else if (!whenCondition.equals(other.whenCondition)) {
-            return false;
-        }
-        if (!getChildNodes().equals(other.getChildNodes())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return AugmentationSchemaImpl.class.getSimpleName() + "[" +
-                "targetPath=" + targetPath +
-                ", when=" + whenCondition +
-                "]";
-    }
-
-    @Override
-    public int compareTo(final AugmentationSchemaImpl o) {
-        checkNotNull(o);
-        Iterator<QName> thisIt = this.targetPath.getPathFromRoot().iterator();
-        Iterator<QName> otherIt = o.getTargetPath().getPathFromRoot().iterator();
-        while (thisIt.hasNext()) {
-            if (otherIt.hasNext()) {
-                int comp = thisIt.next().compareTo(otherIt.next());
-                if (comp != 0) {
-                    return comp;
-                }
-            } else {
-                return 1;
-            }
-        }
-        if (otherIt.hasNext()) {
-            return -1;
-        }
-        return this.order - o.order;
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/BuilderUtils.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/BuilderUtils.java
deleted file mode 100644 (file)
index b8f9e7e..0000000
+++ /dev/null
@@ -1,955 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Iterables;
-import com.google.common.io.ByteSource;
-import com.google.common.io.ByteStreams;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-import java.util.Set;
-import java.util.TreeMap;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Belongs_to_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_header_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Namespace_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_header_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_stmtContext;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingMember;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils;
-import org.opendaylight.yangtools.yang.parser.impl.util.YangModelDependencyInfo;
-import org.opendaylight.yangtools.yang.parser.util.NamedByteArrayInputStream;
-import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class BuilderUtils {
-
-    private static final Logger LOG = LoggerFactory.getLogger(BuilderUtils.class);
-    private static final Splitter COLON_SPLITTER = Splitter.on(':');
-    private static final Date NULL_DATE = new Date(0L);
-    private static final String INPUT = "input";
-    private static final String OUTPUT = "output";
-    private static final String CHILD_NOT_FOUND_IN_NODE_STR = "Child {} not found in node {}";
-
-    private BuilderUtils() {
-    }
-
-    public static Collection<ByteSource> streamsToByteSources(final Collection<InputStream> streams) throws IOException {
-        Collection<ByteSource> result = new HashSet<>();
-        for (InputStream stream : streams) {
-            result.add(new ByteSourceImpl(stream));
-        }
-        return result;
-    }
-
-    public static ByteSource fileToByteSource(final File file) {
-        return new ByteSource() {
-            @Override
-            public InputStream openStream() throws IOException {
-                return new NamedFileInputStream(file, file.getAbsolutePath());
-            }
-        };
-    }
-
-    public static Collection<ByteSource> filesToByteSources(final Collection<File> streams)
-            throws FileNotFoundException {
-        return Collections2.transform(streams, new Function<File, ByteSource>() {
-            @Override
-            public ByteSource apply(final File input) {
-                return new ByteSource() {
-                    @Override
-                    public InputStream openStream() throws IOException {
-                        return new NamedFileInputStream(input, input.getAbsolutePath());
-                    }
-                };
-            }
-        });
-    }
-
-    /**
-     * Find dependent module based on given prefix
-     *
-     * @param modules
-     *            all available modules
-     * @param module
-     *            current module
-     * @param prefix
-     *            target module prefix
-     * @param line
-     *            current line in yang model
-     * @return module builder if found, null otherwise
-     */
-    public static ModuleBuilder findModuleFromBuilders(final Map<String, NavigableMap<Date, ModuleBuilder>> modules,
-            final ModuleBuilder module, final String prefix, final int line) {
-        ModuleBuilder dependentModule;
-        Date dependentModuleRevision;
-
-        if (prefix == null) {
-            dependentModule = module;
-        } else if (prefix.equals(module.getPrefix())) {
-            dependentModule = module;
-        } else {
-            ModuleImport dependentModuleImport = module.getImport(prefix);
-            if (dependentModuleImport == null) {
-                throw new YangParseException(module.getName(), line, "No import found with prefix '" + prefix + "'.");
-            }
-            String dependentModuleName = dependentModuleImport.getModuleName();
-            dependentModuleRevision = dependentModuleImport.getRevision();
-
-            NavigableMap<Date, ModuleBuilder> moduleBuildersByRevision = modules.get(dependentModuleName);
-            if (moduleBuildersByRevision == null) {
-                return null;
-            }
-            if (dependentModuleRevision == null) {
-                dependentModule = moduleBuildersByRevision.lastEntry().getValue();
-            } else {
-                dependentModule = moduleBuildersByRevision.get(dependentModuleRevision);
-            }
-        }
-        return dependentModule;
-    }
-
-    public static ModuleBuilder findModuleFromBuilders(final ModuleImport imp, final Iterable<ModuleBuilder> modules) {
-        String name = imp.getModuleName();
-        Date revision = imp.getRevision();
-        NavigableMap<Date, ModuleBuilder> map = new TreeMap<>();
-        for (ModuleBuilder module : modules) {
-            if (module != null && module.getName().equals(name)) {
-                map.put(module.getRevision(), module);
-            }
-        }
-        if (map.isEmpty()) {
-            return null;
-        }
-        if (revision == null) {
-            return map.lastEntry().getValue();
-        }
-        return map.get(revision);
-    }
-
-    /**
-     * Find module from context based on prefix.
-     *
-     * @param context
-     *            schema context
-     * @param currentModule
-     *            current module
-     * @param prefix
-     *            prefix used to reference dependent module
-     * @param line
-     *            current line in yang model
-     * @return module based on import with given prefix if found in context,
-     *         null otherwise
-     * @throws YangParseException
-     *             if no import found with given prefix
-     */
-    public static Module findModuleFromContext(final SchemaContext context, final ModuleBuilder currentModule,
-            final String prefix, final int line) {
-        NavigableMap<Date, Module> modulesByRevision = new TreeMap<>();
-
-        ModuleImport dependentModuleImport = currentModule.getImport(prefix);
-        if (dependentModuleImport == null) {
-            throw new YangParseException(currentModule.getName(), line, "No import found with prefix '" + prefix + "'.");
-        }
-        String dependentModuleName = dependentModuleImport.getModuleName();
-        Date dependentModuleRevision = dependentModuleImport.getRevision();
-
-        for (Module contextModule : context.getModules()) {
-            if (contextModule.getName().equals(dependentModuleName)) {
-                Date revision = contextModule.getRevision();
-                if (revision == null) {
-                    revision = NULL_DATE;
-                }
-                modulesByRevision.put(revision, contextModule);
-            }
-        }
-
-        Module result;
-        if (dependentModuleRevision == null) {
-            result = modulesByRevision.get(modulesByRevision.firstKey());
-        } else {
-            result = modulesByRevision.get(dependentModuleRevision);
-        }
-        if (result == null) {
-            throw new YangParseException(currentModule.getName(), line, "Module not found for prefix " + prefix);
-        }
-
-        return result;
-    }
-
-    /**
-     * Add all augment's child nodes to given target.
-     *
-     * @param augment
-     *            builder of augment statement
-     * @param target
-     *            augmentation target node
-     */
-    public static void fillAugmentTarget(final AugmentationSchemaBuilder augment, final Builder target) {
-        if (target instanceof DataNodeContainerBuilder) {
-            fillAugmentTarget(augment, (DataNodeContainerBuilder) target);
-        } else if (target instanceof ChoiceBuilder) {
-            fillAugmentTarget(augment, (ChoiceBuilder) target);
-        } else {
-            throw new YangParseException(
-                    augment.getModuleName(),
-                    augment.getLine(),
-                    "Error in augment parsing: The target node MUST be either a container, list, choice, case, input, output, or notification node.");
-        }
-    }
-
-    /**
-     * Add all augment's child nodes to given target.
-     *
-     * @param augment
-     *            builder of augment statement
-     * @param target
-     *            augmentation target node
-     */
-    private static void fillAugmentTarget(final AugmentationSchemaBuilder augment, final DataNodeContainerBuilder target) {
-        for (DataSchemaNodeBuilder child : augment.getChildNodeBuilders()) {
-            DataSchemaNodeBuilder childCopy = CopyUtils.copy(child, target, false);
-            if (augment.getParent() instanceof UsesNodeBuilder) {
-                setNodeAddedByUses(childCopy);
-            }
-            setNodeAugmenting(childCopy);
-            try {
-                target.addChildNode(childCopy);
-            } catch (YangParseException e) {
-
-                // more descriptive message
-                throw new YangParseException(augment.getModuleName(), augment.getLine(),
-                        "Failed to perform augmentation: " + e.getMessage());
-            }
-        }
-    }
-
-    /**
-     * Add all augment's child nodes to given target.
-     *
-     * @param augment
-     *            builder of augment statement
-     * @param target
-     *            augmentation target choice node
-     */
-    private static void fillAugmentTarget(final AugmentationSchemaBuilder augment, final ChoiceBuilder target) {
-        for (DataSchemaNodeBuilder builder : augment.getChildNodeBuilders()) {
-            DataSchemaNodeBuilder childCopy = CopyUtils.copy(builder, target, false);
-            if (augment.getParent() instanceof UsesNodeBuilder) {
-                setNodeAddedByUses(childCopy);
-            }
-            setNodeAugmenting(childCopy);
-            target.addCase(childCopy);
-        }
-        for (UsesNodeBuilder usesNode : augment.getUsesNodeBuilders()) {
-            if (usesNode != null) {
-                throw new YangParseException(augment.getModuleName(), augment.getLine(),
-                        "Error in augment parsing: cannot augment choice with nodes from grouping");
-            }
-        }
-    }
-
-    /**
-     * Set augmenting flag to true for node and all its child nodes.
-     *
-     * @param node
-     */
-    private static void setNodeAugmenting(final DataSchemaNodeBuilder node) {
-        node.setAugmenting(true);
-        if (node instanceof DataNodeContainerBuilder) {
-            DataNodeContainerBuilder dataNodeChild = (DataNodeContainerBuilder) node;
-            for (DataSchemaNodeBuilder inner : dataNodeChild.getChildNodeBuilders()) {
-                setNodeAugmenting(inner);
-            }
-        } else if (node instanceof ChoiceBuilder) {
-            ChoiceBuilder choiceChild = (ChoiceBuilder) node;
-            for (ChoiceCaseBuilder inner : choiceChild.getCases()) {
-                setNodeAugmenting(inner);
-            }
-        }
-    }
-
-    /**
-     * Set addedByUses flag to true for node and all its child nodes.
-     *
-     * @param node grouping member node
-     */
-    public static void setNodeAddedByUses(final GroupingMember node) {
-        node.setAddedByUses(true);
-        if (node instanceof DataNodeContainerBuilder) {
-            DataNodeContainerBuilder dataNodeChild = (DataNodeContainerBuilder) node;
-            for (DataSchemaNodeBuilder inner : dataNodeChild.getChildNodeBuilders()) {
-                setNodeAddedByUses(inner);
-            }
-        } else if (node instanceof ChoiceBuilder) {
-            ChoiceBuilder choiceChild = (ChoiceBuilder) node;
-            for (ChoiceCaseBuilder inner : choiceChild.getCases()) {
-                setNodeAddedByUses(inner);
-            }
-        }
-    }
-
-    /**
-     * Find builder of schema node under parent builder (including under
-     * AugmentationSchemaBuilder).
-     *
-     * @param path
-     *            - path of target schema node builder
-     * @param parent
-     *            - base data node container builder under which the target
-     *            schema node builder should be found
-     * @return builder of schema node
-     */
-    public static SchemaNodeBuilder findTargetNode(final Iterable<QName> path,
-            final DataNodeContainerBuilder parent) {
-
-        Preconditions.checkNotNull(parent);
-        Preconditions.checkNotNull(path);
-
-        SchemaNodeBuilder foundNode = null;
-
-        final Iterator<QName> pathIterator = path.iterator();
-        if (pathIterator.hasNext()) {
-            String name = pathIterator.next().getLocalName();
-            foundNode = parent.getDataChildByName(name);
-            if (foundNode == null) {
-                foundNode = findUnknownNode(name, parent);
-            }
-        }
-
-        if (pathIterator.hasNext() && foundNode != null) {
-            return findSchemaNode(Iterables.skip(path, 1), foundNode);
-        } else {
-            return foundNode;
-        }
-    }
-
-    public static SchemaNodeBuilder findSchemaNode(final Iterable<QName> path, final SchemaNodeBuilder parentNode) {
-        SchemaNodeBuilder node = null;
-        SchemaNodeBuilder parent = parentNode;
-        int size = Iterables.size(path);
-        int i = 0;
-        for (QName qname : path) {
-            String name = qname.getLocalName();
-            if (parent instanceof DataNodeContainerBuilder) {
-                node = ((DataNodeContainerBuilder) parent).getDataChildByName(name);
-                if (node == null) {
-                    node = findUnknownNode(name, parent);
-                }
-            } else if (parent instanceof ChoiceBuilder) {
-                node = ((ChoiceBuilder) parent).getCaseNodeByName(name);
-                if (node == null) {
-                    node = findUnknownNode(name, parent);
-                }
-            } else if (parent instanceof RpcDefinitionBuilder) {
-                if (INPUT.equals(name)) {
-                    node = ((RpcDefinitionBuilder) parent).getInput();
-                } else if (OUTPUT.equals(name)) {
-                    node = ((RpcDefinitionBuilder) parent).getOutput();
-                } else {
-                    if (node == null) {
-                        node = findUnknownNode(name, parent);
-                    }
-                }
-            } else {
-                node = findUnknownNode(name, parent);
-            }
-
-            if (i < size - 1) {
-                parent = node;
-            }
-            i = i + 1;
-        }
-
-        return node;
-    }
-
-    private static UnknownSchemaNodeBuilder findUnknownNode(final String name, final Builder parent) {
-        for (UnknownSchemaNodeBuilder un : parent.getUnknownNodes()) {
-            if (un.getQName().getLocalName().equals(name)) {
-                return un;
-            }
-        }
-        return null;
-    }
-
-    /**
-     *
-     * Find a builder for node in data namespace of YANG module.
-     *
-     * Search is performed on full QName equals, this means builders and schema
-     * path MUST be resolved against imports and their namespaces.
-     *
-     * Search is done in data namespace, this means notification, rpc
-     * definitions and top level data definitions are considered as top-level
-     * items, from which it is possible to traverse.
-     *
-     *
-     * @param schemaPath
-     *            Schema Path to node
-     * @param module
-     *            ModuleBuilder to start lookup in
-     * @return Node Builder if found, {@link Optional#absent()} otherwise.
-     */
-    public static Optional<SchemaNodeBuilder> findSchemaNodeInModule(final SchemaPath schemaPath,
-            final ModuleBuilder module) {
-        Iterator<QName> path = schemaPath.getPathFromRoot().iterator();
-        Preconditions.checkArgument(path.hasNext(), "Schema Path must contain at least one element.");
-        QName first = path.next();
-        Optional<SchemaNodeBuilder> currentNode = getDataNamespaceChild(module, first);
-
-        while (currentNode.isPresent() && path.hasNext()) {
-            SchemaNodeBuilder currentParent = currentNode.get();
-            QName currentPath = path.next();
-            currentNode = findDataChild(currentParent, currentPath);
-            if (!currentNode.isPresent()) {
-                for (SchemaNodeBuilder un : currentParent.getUnknownNodes()) {
-                    if (un.getQName().equals(currentPath)) {
-                        currentNode = Optional.of(un);
-                    }
-                }
-            }
-        }
-        return currentNode;
-    }
-
-    private static Optional<SchemaNodeBuilder> findDataChild(final SchemaNodeBuilder parent, final QName child) {
-        if (parent instanceof DataNodeContainerBuilder) {
-            return castOptional(SchemaNodeBuilder.class,
-                    findDataChildInDataNodeContainer((DataNodeContainerBuilder) parent, child));
-        } else if (parent instanceof ChoiceBuilder) {
-            return castOptional(SchemaNodeBuilder.class, findCaseInChoice((ChoiceBuilder) parent, child));
-        } else if (parent instanceof RpcDefinitionBuilder) {
-            return castOptional(SchemaNodeBuilder.class, findContainerInRpc((RpcDefinitionBuilder) parent, child));
-        } else {
-            LOG.trace(CHILD_NOT_FOUND_IN_NODE_STR, child, parent);
-            return Optional.absent();
-        }
-    }
-
-    /**
-     * Casts optional from one argument to other.
-     *
-     * @param cls
-     *            Class to be checked
-     * @param optional
-     *            Original value
-     * @return Optional object with type argument casted as cls
-     */
-    private static <T> Optional<T> castOptional(final Class<T> cls, final Optional<?> optional) {
-        if (optional.isPresent()) {
-            Object value = optional.get();
-            if (cls.isInstance(value)) {
-                @SuppressWarnings("unchecked")
-                // Actually checked by outer if
-                T casted = (T) value;
-                return Optional.of(casted);
-            }
-        }
-        return Optional.absent();
-    }
-
-    // FIXME: if rpc does not define input or output, this method creates it
-    /**
-     *
-     * Gets input / output container from {@link RpcDefinitionBuilder} if QName
-     * is input/output.
-     *
-     *
-     * @param parent
-     *            RPC Definition builder
-     * @param child
-     *            Child QName
-     * @return Optional of input/output if defined and QName is input/output.
-     *         Otherwise {@link Optional#absent()}.
-     */
-    private static Optional<ContainerSchemaNodeBuilder> findContainerInRpc(final RpcDefinitionBuilder parent,
-            final QName child) {
-        if (INPUT.equals(child.getLocalName())) {
-            if (parent.getInput() == null) {
-                QName qname = QName.create(parent.getQName().getModule(), INPUT);
-                final ContainerSchemaNodeBuilder inputBuilder = new ContainerSchemaNodeBuilder(parent.getModuleName(),
-                        parent.getLine(), qname, parent.getPath().createChild(qname));
-                inputBuilder.setParent(parent);
-                parent.setInput(inputBuilder);
-                return Optional.of(inputBuilder);
-            }
-            return Optional.of(parent.getInput());
-        } else if (OUTPUT.equals(child.getLocalName())) {
-            if (parent.getOutput() == null) {
-                QName qname = QName.create(parent.getQName().getModule(), OUTPUT);
-                final ContainerSchemaNodeBuilder outputBuilder = new ContainerSchemaNodeBuilder(parent.getModuleName(),
-                        parent.getLine(), qname, parent.getPath().createChild(qname));
-                outputBuilder.setParent(parent);
-                parent.setOutput(outputBuilder);
-                return Optional.of(outputBuilder);
-            }
-            return Optional.of(parent.getOutput());
-        }
-        LOG.trace(CHILD_NOT_FOUND_IN_NODE_STR, child, parent);
-        return Optional.absent();
-    }
-
-    /**
-     * Finds case by QName in {@link ChoiceBuilder}
-     *
-     *
-     * @param parent
-     *            DataNodeContainer in which lookup should be performed
-     * @param child
-     *            QName of child
-     * @return Optional of child if found.
-     */
-
-    private static Optional<ChoiceCaseBuilder> findCaseInChoice(final ChoiceBuilder parent, final QName child) {
-        for (ChoiceCaseBuilder caze : parent.getCases()) {
-            if (caze.getQName().equals(child)) {
-                return Optional.of(caze);
-            }
-        }
-        LOG.trace(CHILD_NOT_FOUND_IN_NODE_STR, child, parent);
-        return Optional.absent();
-    }
-
-    /**
-     * Finds direct child by QName in {@link DataNodeContainerBuilder}
-     *
-     *
-     * @param parent
-     *            DataNodeContainer in which lookup should be performed
-     * @param child
-     *            QName of child
-     * @return Optional of child if found.
-     */
-    private static Optional<DataSchemaNodeBuilder> findDataChildInDataNodeContainer(final DataNodeContainerBuilder parent,
-            final QName child) {
-        for (DataSchemaNodeBuilder childNode : parent.getChildNodeBuilders()) {
-            if (childNode.getQName().equals(child)) {
-                return Optional.of(childNode);
-            }
-        }
-        LOG.trace(CHILD_NOT_FOUND_IN_NODE_STR, child, parent);
-        return Optional.absent();
-    }
-
-    /**
-     *
-     * Find a child builder for node in data namespace of YANG module.
-     *
-     * Search is performed on full QName equals, this means builders and schema
-     * path MUST be resolved against imports and their namespaces.
-     *
-     * Search is done in data namespace, this means notification, rpc
-     * definitions and top level data definitions are considered as top-level
-     * items, from which it is possible to traverse.
-     *
-     *
-     * @param child
-     *            Child QName.
-     * @param module
-     *            ModuleBuilder to start lookup in
-     * @return Node Builder if found, {@link Optional#absent()} otherwise.
-     */
-    private static Optional<SchemaNodeBuilder> getDataNamespaceChild(final ModuleBuilder module, final QName child) {
-        /*
-         * First we do lookup in data tree, if node is found we return it.
-         */
-        final Optional<SchemaNodeBuilder> dataTreeNode = getDataChildByQName(module, child);
-        if (dataTreeNode.isPresent()) {
-            return dataTreeNode;
-        }
-
-        /*
-         * We lookup in notifications
-         */
-        Set<NotificationBuilder> notifications = module.getAddedNotifications();
-        for (NotificationBuilder notification : notifications) {
-            if (notification.getQName().equals(child)) {
-                return Optional.of(notification);
-            }
-        }
-
-        /*
-         * We lookup in RPCs
-         */
-        Set<RpcDefinitionBuilder> rpcs = module.getAddedRpcs();
-        for (RpcDefinitionBuilder rpc : rpcs) {
-            if (rpc.getQName().equals(child)) {
-                return Optional.of(rpc);
-            }
-        }
-        LOG.trace("Child {} not found in data namespace of module {}", child, module);
-        return Optional.absent();
-    }
-
-    private static Optional<SchemaNodeBuilder> getDataChildByQName(final DataNodeContainerBuilder builder, final QName child) {
-        for (DataSchemaNodeBuilder childNode : builder.getChildNodeBuilders()) {
-            if (childNode.getQName().equals(child)) {
-                return Optional.of(childNode);
-            }
-        }
-        LOG.trace(CHILD_NOT_FOUND_IN_NODE_STR, child, builder);
-        return Optional.absent();
-    }
-
-    /**
-     * Find augment target node and perform augmentation.
-     *
-     * @param augment
-     *            augment builder to process
-     * @param firstNodeParent
-     *            parent of first node in path
-     * @return true if augmentation process succeed, false otherwise
-     */
-    public static boolean processAugmentation(final AugmentationSchemaBuilder augment,
-            final ModuleBuilder firstNodeParent) {
-        Optional<SchemaNodeBuilder> potentialTargetNode = findSchemaNodeInModule(augment.getTargetPath(),
-                firstNodeParent);
-        if (!potentialTargetNode.isPresent()) {
-            return false;
-        } else if (potentialTargetNode.get() instanceof UnknownSchemaNodeBuilder) {
-            LOG.warn("Error in augment parsing: unsupported augment target: {}", potentialTargetNode.get());
-            return true;
-        }
-        SchemaNodeBuilder targetNode = potentialTargetNode.get();
-        fillAugmentTarget(augment, targetNode);
-        Preconditions.checkState(targetNode instanceof AugmentationTargetBuilder,
-                "Node refered by augmentation must be valid augmentation target");
-        ((AugmentationTargetBuilder) targetNode).addAugmentation(augment);
-        augment.setResolved(true);
-        return true;
-    }
-
-    public static IdentitySchemaNodeBuilder findBaseIdentity(final ModuleBuilder module, final String baseString,
-            final int line) {
-
-        // FIXME: optimize indexOf() away?
-        if (baseString.indexOf(':') != -1) {
-            final Iterator<String> it = COLON_SPLITTER.split(baseString).iterator();
-            final String prefix = it.next();
-            final String name = it.next();
-
-            if (it.hasNext()) {
-                throw new YangParseException(module.getName(), line, "Failed to parse identityref base: " + baseString);
-            }
-
-            ModuleBuilder dependentModule = getModuleByPrefix(module, prefix);
-            if (dependentModule == null) {
-                return null;
-            }
-
-            return findIdentity(dependentModule.getAddedIdentities(), name);
-        } else {
-            return findIdentity(module.getAddedIdentities(), baseString);
-        }
-    }
-
-    public static IdentitySchemaNodeBuilder findIdentity(final Set<IdentitySchemaNodeBuilder> identities,
-            final String name) {
-        for (IdentitySchemaNodeBuilder identity : identities) {
-            if (identity.getQName().getLocalName().equals(name)) {
-                return identity;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Get module in which this node is defined.
-     *
-     * @param node node
-     * @return builder of module where this node is defined
-     */
-    public static ModuleBuilder getParentModule(final Builder node) {
-        if (node instanceof ModuleBuilder) {
-            return (ModuleBuilder) node;
-        }
-        Builder parent = node.getParent();
-        while (!(parent instanceof ModuleBuilder)) {
-            parent = parent.getParent();
-        }
-        ModuleBuilder parentModule = (ModuleBuilder) parent;
-        if (parentModule.isSubmodule()) {
-            parentModule = parentModule.getParent();
-        }
-        return parentModule;
-    }
-
-    public static Set<DataSchemaNodeBuilder> wrapChildNodes(final String moduleName, final int line,
-            final Collection<DataSchemaNode> nodes, final SchemaPath parentPath, final QName parentQName) {
-        Set<DataSchemaNodeBuilder> result = new LinkedHashSet<>(nodes.size());
-
-        for (DataSchemaNode node : nodes) {
-            QName qname = QName.create(parentQName, node.getQName().getLocalName());
-            DataSchemaNodeBuilder wrapped = wrapChildNode(moduleName, line, node, parentPath, qname);
-            result.add(wrapped);
-        }
-        return result;
-    }
-
-    public static DataSchemaNodeBuilder wrapChildNode(final String moduleName, final int line,
-            final DataSchemaNode node, final SchemaPath parentPath, final QName qname) {
-
-        final SchemaPath schemaPath = parentPath.createChild(qname);
-
-        if (node instanceof AnyXmlSchemaNode) {
-            return new AnyXmlBuilder(moduleName, line, qname, schemaPath, (AnyXmlSchemaNode) node);
-        } else if (node instanceof ChoiceSchemaNode) {
-            return new ChoiceBuilder(moduleName, line, qname, schemaPath, (ChoiceSchemaNode) node);
-        } else if (node instanceof ContainerSchemaNode) {
-            return new ContainerSchemaNodeBuilder(moduleName, line, qname, schemaPath, (ContainerSchemaNode) node);
-        } else if (node instanceof LeafSchemaNode) {
-            return new LeafSchemaNodeBuilder(moduleName, line, qname, schemaPath, (LeafSchemaNode) node);
-        } else if (node instanceof LeafListSchemaNode) {
-            return new LeafListSchemaNodeBuilder(moduleName, line, qname, schemaPath, (LeafListSchemaNode) node);
-        } else if (node instanceof ListSchemaNode) {
-            return new ListSchemaNodeBuilder(moduleName, line, qname, schemaPath, (ListSchemaNode) node);
-        } else if (node instanceof ChoiceCaseNode) {
-            return new ChoiceCaseBuilder(moduleName, line, qname, schemaPath, (ChoiceCaseNode) node);
-        } else {
-            throw new YangParseException(moduleName, line, "Failed to copy node: Unknown type of DataSchemaNode: "
-                    + node);
-        }
-    }
-
-    public static Set<GroupingBuilder> wrapGroupings(final String moduleName, final int line,
-            final Set<GroupingDefinition> nodes, final SchemaPath parentPath, final QName parentQName) {
-        Set<GroupingBuilder> result = new HashSet<>();
-        for (GroupingDefinition node : nodes) {
-            QName qname = QName.create(parentQName, node.getQName().getLocalName());
-            SchemaPath schemaPath = parentPath.createChild(qname);
-            result.add(new GroupingBuilderImpl(moduleName, line, qname, schemaPath, node));
-        }
-        return result;
-    }
-
-    public static Set<TypeDefinitionBuilder> wrapTypedefs(final String moduleName, final int line,
-            final DataNodeContainer dataNode, final SchemaPath parentPath, final QName parentQName) {
-        Set<TypeDefinition<?>> nodes = dataNode.getTypeDefinitions();
-        Set<TypeDefinitionBuilder> result = new HashSet<>();
-        for (TypeDefinition<?> node : nodes) {
-            QName qname = QName.create(parentQName, node.getQName().getLocalName());
-            SchemaPath schemaPath = parentPath.createChild(qname);
-            result.add(new TypeDefinitionBuilderImpl(moduleName, line, qname, schemaPath, (ExtendedType) node));
-        }
-        return result;
-    }
-
-    public static List<UnknownSchemaNodeBuilderImpl> wrapUnknownNodes(final String moduleName, final int line,
-            final List<UnknownSchemaNode> nodes, final SchemaPath parentPath, final QName parentQName) {
-        List<UnknownSchemaNodeBuilderImpl> result = new ArrayList<>();
-        for (UnknownSchemaNode node : nodes) {
-            QName qname = QName.create(parentQName, node.getQName().getLocalName());
-            SchemaPath schemaPath = parentPath.createChild(qname);
-            result.add(new UnknownSchemaNodeBuilderImpl(moduleName, line, qname, schemaPath, node));
-        }
-        return result;
-    }
-
-    private static final class ByteSourceImpl extends ByteSource {
-        private final String toString;
-        private final byte[] data;
-
-        private ByteSourceImpl(final InputStream input) throws IOException {
-            toString = input.toString();
-            data = ByteStreams.toByteArray(input);
-        }
-
-        @Override
-        public InputStream openStream() throws IOException {
-            return new NamedByteArrayInputStream(data, toString);
-        }
-    }
-
-    public static ModuleBuilder getModuleByPrefix(final ModuleBuilder module, final String prefix) {
-        if (prefix == null || prefix.isEmpty() || prefix.equals(module.getPrefix())) {
-            return module;
-        } else {
-            return module.getImportedModule(prefix);
-        }
-    }
-
-    public static ModuleBuilder findModule(final QName qname, final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        NavigableMap<Date, ModuleBuilder> map = modules.get(qname.getNamespace());
-        if (map == null) {
-            return null;
-        }
-        if (qname.getRevision() == null) {
-            return map.lastEntry().getValue();
-        }
-
-        final Entry<Date, ModuleBuilder> lastEntry = map.lastEntry();
-        if (qname.getRevision().compareTo(lastEntry.getKey()) > 0) {
-            /*
-             * We are trying to find more recent revision of module than is in
-             * the map. Most probably the yang models are not referenced
-             * correctly and the revision of a base module or submodule has not
-             * been updated along with revision of a referenced module or
-             * submodule. However, we should return the most recent entry in the
-             * map, otherwise the null pointer exception occurs (see Bug3799).
-             */
-            LOG.warn(String
-                    .format("Attempt to find more recent revision of module than is available. "
-                            + "The requested revision is [%s], but the most recent available revision of module is [%s]."
-                            + " Most probably some of Yang models do not have updated revision or they are not "
-                            + "referenced correctly.",
-                            qname.getRevision(), lastEntry.getKey()));
-            return lastEntry.getValue();
-        }
-
-        return map.get(qname.getRevision());
-    }
-
-    public static Map<String, NavigableMap<Date, URI>> createYangNamespaceContext(
-            final Collection<? extends ParseTree> modules, final Optional<SchemaContext> context) {
-        Map<String, NavigableMap<Date, URI>> namespaceContext = new HashMap<>();
-        Set<Submodule_stmtContext> submodules = new HashSet<>();
-        // first read ParseTree collection and separate modules and submodules
-        for (ParseTree module : modules) {
-            for (int i = 0; i < module.getChildCount(); i++) {
-                ParseTree moduleTree = module.getChild(i);
-                if (moduleTree instanceof Submodule_stmtContext) {
-                    // put submodule context to separate collection
-                    submodules.add((Submodule_stmtContext) moduleTree);
-                } else if (moduleTree instanceof Module_stmtContext) {
-                    // get name, revision and namespace from module
-                    Module_stmtContext moduleCtx = (Module_stmtContext) moduleTree;
-                    final String moduleName = ParserListenerUtils.stringFromNode(moduleCtx);
-                    Date rev = null;
-                    URI namespace = null;
-                    for (int j = 0; j < moduleCtx.getChildCount(); j++) {
-                        ParseTree moduleCtxChildTree = moduleCtx.getChild(j);
-                        if (moduleCtxChildTree instanceof Revision_stmtsContext) {
-                            String revisionDateStr = YangModelDependencyInfo
-                                    .getLatestRevision((Revision_stmtsContext) moduleCtxChildTree);
-                            if (revisionDateStr == null) {
-                                rev = new Date(0);
-                            } else {
-                                rev = QName.parseRevision(revisionDateStr);
-                            }
-                        }
-                        if (moduleCtxChildTree instanceof Module_header_stmtsContext) {
-                            Module_header_stmtsContext headerCtx = (Module_header_stmtsContext) moduleCtxChildTree;
-                            for (int k = 0; k < headerCtx.getChildCount(); k++) {
-                                ParseTree ctx = headerCtx.getChild(k);
-                                if (ctx instanceof Namespace_stmtContext) {
-                                    final String namespaceStr = ParserListenerUtils.stringFromNode(ctx);
-                                    namespace = URI.create(namespaceStr);
-                                    break;
-                                }
-                            }
-                        }
-                    }
-                    // update namespaceContext
-                    NavigableMap<Date, URI> revToNs = namespaceContext.get(moduleName);
-                    if (revToNs == null) {
-                        revToNs = new TreeMap<>();
-                        revToNs.put(rev, namespace);
-                        namespaceContext.put(moduleName, revToNs);
-                    }
-                    revToNs.put(rev, namespace);
-                }
-            }
-        }
-        // after all ParseTree-s are parsed update namespaceContext with modules
-        // from SchemaContext
-        if (context.isPresent()) {
-            for (Module module : context.get().getModules()) {
-                NavigableMap<Date, URI> revToNs = namespaceContext.get(module.getName());
-                if (revToNs == null) {
-                    revToNs = new TreeMap<>();
-                    revToNs.put(module.getRevision(), module.getNamespace());
-                    namespaceContext.put(module.getName(), revToNs);
-                }
-                revToNs.put(module.getRevision(), module.getNamespace());
-            }
-        }
-        // when all modules are processed, traverse submodules and update
-        // namespaceContext with mapping for submodules
-        for (Submodule_stmtContext submodule : submodules) {
-            final String moduleName = ParserListenerUtils.stringFromNode(submodule);
-            for (int i = 0; i < submodule.getChildCount(); i++) {
-                ParseTree subHeaderCtx = submodule.getChild(i);
-                if (subHeaderCtx instanceof Submodule_header_stmtsContext) {
-                    for (int j = 0; j < subHeaderCtx.getChildCount(); j++) {
-                        ParseTree belongsCtx = subHeaderCtx.getChild(j);
-                        if (belongsCtx instanceof Belongs_to_stmtContext) {
-                            final String belongsTo = ParserListenerUtils.stringFromNode(belongsCtx);
-                            NavigableMap<Date, URI> ns = namespaceContext.get(belongsTo);
-                            if (ns == null) {
-                                throw new YangParseException(moduleName, submodule.getStart().getLine(), String.format(
-                                        "Unresolved belongs-to statement: %s", belongsTo));
-                            }
-                            // submodule get namespace and revision from module
-                            NavigableMap<Date, URI> subNs = new TreeMap<>();
-                            subNs.put(ns.firstKey(), ns.firstEntry().getValue());
-                            namespaceContext.put(moduleName, subNs);
-                        }
-                    }
-                }
-            }
-        }
-        return namespaceContext;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceBuilder.java
deleted file mode 100644 (file)
index c013ba4..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.TreeSet;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.Comparators;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class ChoiceBuilder extends AbstractSchemaNodeBuilder implements DataSchemaNodeBuilder, AugmentationTargetBuilder {
-    private ChoiceSchemaNodeImpl instance;
-
-    // DataSchemaNode args
-    private boolean augmenting;
-    private boolean addedByUses;
-    private boolean configuration;
-    private ChoiceSchemaNode originalNode;
-    private ChoiceBuilder originalBuilder;
-    private final ConstraintsBuilder constraints;
-    // AugmentationTarget args
-    private final Set<AugmentationSchema> augmentations = new HashSet<>();
-    private final List<AugmentationSchemaBuilder> augmentationBuilders = new ArrayList<>();
-    // ChoiceNode args
-    private final Set<ChoiceCaseBuilder> caseBuilders = new HashSet<>();
-    private String defaultCase;
-
-    public ChoiceBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = path;
-        constraints = new ConstraintsBuilderImpl(moduleName, line);
-    }
-
-    public ChoiceBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path,
-            final ChoiceSchemaNode base) {
-        super(moduleName, line, qname);
-        this.schemaPath = path;
-        constraints = new ConstraintsBuilderImpl(moduleName, line, base.getConstraints());
-
-        description = base.getDescription();
-        reference = base.getReference();
-        status = base.getStatus();
-        augmenting = base.isAugmenting();
-        addedByUses = base.isAddedByUses();
-        originalNode =  base;
-        configuration = base.isConfiguration();
-        augmentations.addAll(base.getAvailableAugmentations());
-
-        Set<DataSchemaNodeBuilder> wrapped = BuilderUtils.wrapChildNodes(moduleName, line, new HashSet<>(
-                base.getCases()), path, qname);
-        for (DataSchemaNodeBuilder wrap : wrapped) {
-            if (wrap instanceof ChoiceCaseBuilder) {
-                caseBuilders.add((ChoiceCaseBuilder) wrap);
-            }
-        }
-
-        addedUnknownNodes.addAll(BuilderUtils.wrapUnknownNodes(moduleName, line, base.getUnknownSchemaNodes(), path,
-                qname));
-    }
-
-    @Override
-    public ChoiceSchemaNode build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new ChoiceSchemaNodeImpl(qname, schemaPath);
-
-        instance.description = description;
-        instance.reference = reference;
-        instance.status = status;
-        instance.augmenting = augmenting;
-        instance.addedByUses = addedByUses;
-        instance.configuration = configuration;
-
-        instance.constraints = constraints.build();
-        instance.defaultCase = defaultCase;
-
-        // ORIGINAL NODE
-        if (originalNode == null && originalBuilder != null) {
-            originalNode = originalBuilder.build();
-        }
-        instance.original = originalNode;
-
-        // CASES
-        final Set<ChoiceCaseNode> cases = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-        for (ChoiceCaseBuilder caseBuilder : caseBuilders) {
-            cases.add(caseBuilder.build());
-        }
-        instance.cases = ImmutableSet.copyOf(cases);
-
-        // AUGMENTATIONS
-        for (AugmentationSchemaBuilder builder : augmentationBuilders) {
-            augmentations.add(builder.build());
-        }
-        instance.augmentations = ImmutableSet.copyOf(augmentations);
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    public Set<ChoiceCaseBuilder> getCases() {
-        return caseBuilders;
-    }
-
-    /**
-     * Get case by name.
-     *
-     * @param caseName
-     *            name of case to search
-     * @return case with given name if present, null otherwise
-     */
-    public ChoiceCaseBuilder getCaseNodeByName(final String caseName) {
-        for (ChoiceCaseBuilder addedCase : caseBuilders) {
-            if (addedCase.getQName().getLocalName().equals(caseName)) {
-                return addedCase;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Add case node to this choice.
-     *
-     * If node is not declared with 'case' keyword, create new case builder and
-     * make this node child of newly created case.
-     *
-     * @param caseNode
-     *            case node
-     */
-    public void addCase(final DataSchemaNodeBuilder caseNode) {
-        QName caseQName = caseNode.getQName();
-        String caseName = caseQName.getLocalName();
-
-        for (ChoiceCaseBuilder existingCase : caseBuilders) {
-            if (existingCase.getQName().getLocalName().equals(caseName)) {
-                throw new YangParseException(caseNode.getModuleName(), caseNode.getLine(), "Can not add '" + caseNode
-                        + "' to node '" + qname.getLocalName() + "' in module '" + getModuleName()
-                        + "': case with same name already declared at line " + existingCase.getLine());
-            }
-        }
-
-        if (caseNode instanceof ChoiceCaseBuilder) {
-            caseBuilders.add((ChoiceCaseBuilder) caseNode);
-        } else {
-            ChoiceCaseBuilder caseBuilder = new ChoiceCaseBuilder(caseNode.getModuleName(), caseNode.getLine(),
-                    caseQName, caseNode.getPath());
-            if (caseNode.isAugmenting()) {
-                // if node is added by augmentation, set case builder augmenting
-                // as true and node augmenting as false
-                caseBuilder.setAugmenting(true);
-                caseNode.setAugmenting(false);
-            }
-            SchemaPath newPath = caseNode.getPath().createChild(caseQName);
-            caseNode.setPath(newPath);
-            caseBuilder.addChildNode(caseNode);
-            caseBuilders.add(caseBuilder);
-        }
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public void setAugmenting(final boolean augmenting) {
-        this.augmenting = augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public ChoiceBuilder getOriginal() {
-        return originalBuilder;
-    }
-
-    @Override
-    public void setOriginal(final SchemaNodeBuilder builder) {
-        Preconditions.checkArgument(builder instanceof ChoiceBuilder, "Original of choice cannot be " + builder);
-        this.originalBuilder = (ChoiceBuilder) builder;
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public void setConfiguration(final boolean configuration) {
-        this.configuration = configuration;
-    }
-
-    @Override
-    public ConstraintsBuilder getConstraints() {
-        return constraints;
-    }
-
-    @Override
-    public void addAugmentation(final AugmentationSchemaBuilder augment) {
-        augmentationBuilders.add(augment);
-    }
-
-    public List<AugmentationSchemaBuilder> getAugmentationBuilders() {
-        return augmentationBuilders;
-    }
-
-    public String getDefaultCase() {
-        return defaultCase;
-    }
-
-    public void setDefaultCase(final String defaultCase) {
-        this.defaultCase = defaultCase;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ChoiceBuilder other = (ChoiceBuilder) obj;
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "choice " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceCaseBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceCaseBuilder.java
deleted file mode 100644 (file)
index e470d15..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 2014 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class ChoiceCaseBuilder extends AbstractDocumentedDataNodeContainerBuilder implements DataSchemaNodeBuilder,
-AugmentationTargetBuilder {
-    private ChoiceCaseNodeImpl instance;
-    // SchemaNode args
-    private SchemaPath schemaPath;
-    // DataSchemaNode args
-    private boolean augmenting;
-    private ChoiceCaseNode originalNode;
-    private ChoiceCaseBuilder originalBuilder;
-    private boolean addedByUses;
-    private final ConstraintsBuilder constraints;
-    // AugmentationTarget args
-    private final List<AugmentationSchema> augmentations = new ArrayList<>();
-    private final List<AugmentationSchemaBuilder> augmentationBuilders = new ArrayList<>();
-
-    public ChoiceCaseBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-        constraints = new ConstraintsBuilderImpl(moduleName, line);
-    }
-
-    public ChoiceCaseBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path,
-            final ChoiceCaseNode base) {
-        super(moduleName, line, qname, Preconditions.checkNotNull(path, "Schema Path must not be null"), base);
-        this.schemaPath = path;
-        constraints = new ConstraintsBuilderImpl(moduleName, line, base.getConstraints());
-
-        augmenting = base.isAugmenting();
-        addedByUses = base.isAddedByUses();
-        originalNode = base;
-        addedUnknownNodes.addAll(BuilderUtils.wrapUnknownNodes(moduleName, line, base.getUnknownSchemaNodes(), path,
-                qname));
-        augmentations.addAll(base.getAvailableAugmentations());
-    }
-
-    @Override
-    public ChoiceCaseNode build() {
-        if (instance != null) {
-            return instance;
-        }
-        buildChildren();
-        instance = new ChoiceCaseNodeImpl(qname, schemaPath,this);
-
-        instance.augmenting = augmenting;
-        instance.addedByUses = addedByUses;
-
-        instance.constraints = constraints.build();
-
-        // ORIGINAL NODE
-        if (originalNode == null && originalBuilder != null) {
-            originalNode = originalBuilder.build();
-        }
-        instance.original = originalNode;
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        // AUGMENTATIONS
-        for (AugmentationSchemaBuilder builder : augmentationBuilders) {
-            augmentations.add(builder.build());
-        }
-        instance.augmentations = ImmutableSet.copyOf(augmentations);
-
-        return instance;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.schemaPath = path;
-    }
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public void setAugmenting(final boolean augmenting) {
-        this.augmenting = augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public ChoiceCaseBuilder getOriginal() {
-        return originalBuilder;
-    }
-
-    @Override
-    public void setOriginal(final SchemaNodeBuilder builder) {
-        Preconditions.checkArgument(builder instanceof ChoiceCaseBuilder, "Original of case cannot be " + builder);
-        this.originalBuilder = (ChoiceCaseBuilder) builder;
-    }
-
-    @Override
-    public void addTypedef(final TypeDefinitionBuilder typedefBuilder) {
-        throw new YangParseException(getModuleName(), typedefBuilder.getLine(), "Can not add type definition to choice case.");
-    }
-
-    @Override
-    public void addGrouping(final GroupingBuilder groupingBuilder) {
-        throw new YangParseException(getModuleName(), groupingBuilder.getLine(), "Can not add grouping to choice case.");
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return false;
-    }
-
-    @Override
-    public void setConfiguration(final boolean configuration) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not add config statement to choice case.");
-    }
-
-    @Override
-    public ConstraintsBuilder getConstraints() {
-        return constraints;
-    }
-
-    @Override
-    public void addAugmentation(final AugmentationSchemaBuilder augment) {
-        augmentationBuilders.add(augment);
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ChoiceCaseBuilder other = (ChoiceCaseBuilder) obj;
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "case " + getQName().getLocalName();
-    }
-
-    @Override
-    protected String getStatementName() {
-        return "choice";
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceCaseNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceCaseNodeImpl.java
deleted file mode 100644 (file)
index ef7c4c0..0000000
+++ /dev/null
@@ -1,137 +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.builder.impl;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class ChoiceCaseNodeImpl extends AbstractDocumentedDataNodeContainer implements ChoiceCaseNode, DerivableSchemaNode {
-    private final QName qname;
-    private final SchemaPath path;
-    boolean augmenting;
-    boolean addedByUses;
-    ChoiceCaseNode original;
-    ConstraintDefinition constraints;
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-
-    ChoiceCaseNodeImpl(final QName qname, final SchemaPath path,final ChoiceCaseBuilder builder) {
-        super(builder);
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return false;
-    }
-
-    @Override
-    public ConstraintDefinition getConstraints() {
-        return constraints;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public Optional<ChoiceCaseNode> getOriginal() {
-        return Optional.fromNullable(original);
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public Set<AugmentationSchema> getAvailableAugmentations() {
-        return augmentations;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ChoiceCaseNodeImpl other = (ChoiceCaseNodeImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return ChoiceCaseNodeImpl.class.getSimpleName() + "[" +
-                "qname=" +
-                qname +
-                "]";
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceSchemaNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ChoiceSchemaNodeImpl.java
deleted file mode 100644 (file)
index 7d0844f..0000000
+++ /dev/null
@@ -1,194 +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.builder.impl;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class ChoiceSchemaNodeImpl implements ChoiceSchemaNode, DerivableSchemaNode {
-    private final QName qname;
-    private final SchemaPath path;
-    String description;
-    String reference;
-    Status status;
-    boolean augmenting;
-    boolean addedByUses;
-    ChoiceSchemaNode original;
-    boolean configuration;
-    ConstraintDefinition constraints;
-    ImmutableSet<ChoiceCaseNode> cases;
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-    String defaultCase;
-
-    ChoiceSchemaNodeImpl(final QName qname, final SchemaPath path) {
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public Optional<ChoiceSchemaNode> getOriginal() {
-        return Optional.fromNullable(original);
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public ConstraintDefinition getConstraints() {
-        return constraints;
-    }
-
-    @Override
-    public Set<AugmentationSchema> getAvailableAugmentations() {
-        return augmentations;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public Set<ChoiceCaseNode> getCases() {
-        return cases;
-    }
-
-    @Override
-    public ChoiceCaseNode getCaseNodeByName(final QName name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Choice Case QName cannot be NULL!");
-        }
-        for (final ChoiceCaseNode caseNode : cases) {
-            if (caseNode != null && name.equals(caseNode.getQName())) {
-                return caseNode;
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public ChoiceCaseNode getCaseNodeByName(final String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Choice Case string Name cannot be NULL!");
-        }
-        for (final ChoiceCaseNode caseNode : cases) {
-            if (caseNode != null && (caseNode.getQName() != null)
-                    && name.equals(caseNode.getQName().getLocalName())) {
-                return caseNode;
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public String getDefaultCase() {
-        return defaultCase;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ChoiceSchemaNodeImpl other = (ChoiceSchemaNodeImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return ChoiceSchemaNodeImpl.class.getSimpleName() + "[" +
-                "qname=" + qname +
-                "]";
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ConstraintsBuilderImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ConstraintsBuilderImpl.java
deleted file mode 100644 (file)
index 35b360e..0000000
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.collect.ImmutableSet;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
-import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class ConstraintsBuilderImpl implements ConstraintsBuilder {
-    private static final ConstraintDefinitionImpl EMPTY_CONSTRAINT = new ConstraintDefinitionImpl();
-    private static final ConstraintDefinitionImpl EMPTY_MANDATORY_CONSTRAINT;
-
-    static {
-        ConstraintDefinitionImpl c = new ConstraintDefinitionImpl();
-        c.setMandatory(true);
-
-        EMPTY_MANDATORY_CONSTRAINT = c;
-    }
-
-    private final String moduleName;
-    private final int line;
-    private final Set<MustDefinition> mustDefinitions;
-    private ConstraintDefinitionImpl instance;
-    private RevisionAwareXPath whenStmt;
-    private String whenCondition;
-    private boolean mandatory;
-    private Integer min;
-    private Integer max;
-
-    public ConstraintsBuilderImpl(final String moduleName, final int line) {
-        this.moduleName = moduleName;
-        this.line = line;
-        mustDefinitions = new HashSet<>();
-    }
-
-    ConstraintsBuilderImpl(final ConstraintsBuilder b) {
-        this.moduleName = b.getModuleName();
-        this.line = b.getLine();
-        mustDefinitions = new HashSet<>(b.getMustDefinitions());
-        whenCondition = b.getWhenCondition();
-        mandatory = b.isMandatory();
-        min = b.getMinElements();
-        max = b.getMaxElements();
-    }
-
-    ConstraintsBuilderImpl(final String moduleName, final int line, final ConstraintDefinition base) {
-        this.moduleName = moduleName;
-        this.line = line;
-        whenStmt = base.getWhenCondition();
-        mustDefinitions = new HashSet<>(base.getMustConstraints());
-        mandatory = base.isMandatory();
-        min = base.getMinElements();
-        max = base.getMaxElements();
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#build()
-     */
-    @Override
-    public ConstraintDefinition build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        if (whenStmt == null) {
-            if (whenCondition == null) {
-                whenStmt = null;
-            } else {
-                whenStmt = new RevisionAwareXPathImpl(whenCondition, false);
-            }
-        }
-
-        ConstraintDefinitionImpl newInstance = new ConstraintDefinitionImpl();
-        newInstance.setWhenCondition(whenStmt);
-        newInstance.setMandatory(mandatory);
-        newInstance.setMinElements(min);
-        newInstance.setMaxElements(max);
-
-        if (!mustDefinitions.isEmpty()) {
-            newInstance.setMustConstraints(mustDefinitions);
-        }
-        if (EMPTY_CONSTRAINT.equals(newInstance)) {
-            newInstance = EMPTY_CONSTRAINT;
-        } else if (EMPTY_MANDATORY_CONSTRAINT.equals(newInstance)) {
-            newInstance = EMPTY_MANDATORY_CONSTRAINT;
-        }
-
-        instance = newInstance;
-        return instance;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#getModuleName()
-     */
-    @Override
-    public String getModuleName() {
-        return moduleName;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#getLine()
-     */
-    @Override
-    public int getLine() {
-        return line;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#getMinElements()
-     */
-    @Override
-    public Integer getMinElements() {
-        return min;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#setMinElements(java.lang.Integer)
-     */
-    @Override
-    public void setMinElements(final Integer minElements) {
-        this.min = minElements;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#getMaxElements()
-     */
-    @Override
-    public Integer getMaxElements() {
-        return max;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#setMaxElements(java.lang.Integer)
-     */
-    @Override
-    public void setMaxElements(final Integer maxElements) {
-        this.max = maxElements;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#getMustDefinitions()
-     */
-    @Override
-    public Set<MustDefinition> getMustDefinitions() {
-        return mustDefinitions;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#addMustDefinition(org.opendaylight.yangtools.yang.model.api.MustDefinition)
-     */
-    @Override
-    public void addMustDefinition(final MustDefinition must) {
-        mustDefinitions.add(must);
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#getWhenCondition()
-     */
-    @Override
-    public String getWhenCondition() {
-        return whenCondition;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#addWhenCondition(java.lang.String)
-     */
-    @Override
-    public void addWhenCondition(final String whenCondition) {
-        this.whenCondition = whenCondition;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#isMandatory()
-     */
-    @Override
-    public boolean isMandatory() {
-        return mandatory;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IConstraintsBuilder#setMandatory(boolean)
-     */
-    @Override
-    public void setMandatory(final boolean mandatory) {
-        this.mandatory = mandatory;
-    }
-
-    private static final class ConstraintDefinitionImpl implements ConstraintDefinition {
-        private RevisionAwareXPath whenCondition;
-        private Set<MustDefinition> mustConstraints = Collections.emptySet();
-        private Boolean mandatory = false;
-        private Integer minElements;
-        private Integer maxElements;
-
-        @Override
-        public RevisionAwareXPath getWhenCondition() {
-            return whenCondition;
-        }
-
-        private void setWhenCondition(final RevisionAwareXPath whenCondition) {
-            this.whenCondition = whenCondition;
-        }
-
-        @Override
-        public Set<MustDefinition> getMustConstraints() {
-            return mustConstraints;
-        }
-
-        private void setMustConstraints(final Set<MustDefinition> mustConstraints) {
-            if (mustConstraints != null) {
-                this.mustConstraints = ImmutableSet.copyOf(mustConstraints);
-            }
-        }
-
-        @Override
-        public boolean isMandatory() {
-            return mandatory;
-        }
-
-        private void setMandatory(final boolean mandatory) {
-            this.mandatory = mandatory;
-        }
-
-        @Override
-        public Integer getMinElements() {
-            return minElements;
-        }
-
-        private void setMinElements(final Integer minElements) {
-            this.minElements = minElements;
-            if (minElements != null && minElements > 0) {
-                mandatory = true;
-            }
-        }
-
-        @Override
-        public Integer getMaxElements() {
-            return maxElements;
-        }
-
-        private void setMaxElements(final Integer maxElements) {
-            this.maxElements = maxElements;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + Objects.hashCode(whenCondition);
-            result = prime * result + Objects.hashCode(mustConstraints);
-            result = prime * result + Objects.hashCode(minElements);
-            result = prime * result + Objects.hashCode(maxElements);
-            result = prime * result + mandatory.hashCode();
-            return result;
-        }
-
-        @Override
-        public boolean equals(final Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (getClass() != obj.getClass()) {
-                return false;
-            }
-            ConstraintDefinitionImpl other = (ConstraintDefinitionImpl) obj;
-            if (whenCondition == null) {
-                if (other.whenCondition != null) {
-                    return false;
-                }
-            } else if (!whenCondition.equals(other.whenCondition)) {
-                return false;
-            }
-            if (mustConstraints == null) {
-                if (other.mustConstraints != null) {
-                    return false;
-                }
-            } else if (!mustConstraints.equals(other.mustConstraints)) {
-                return false;
-            }
-            if (!mandatory.equals(other.mandatory)) {
-                return false;
-            }
-            if (minElements == null) {
-                if (other.minElements != null) {
-                    return false;
-                }
-            } else if (!minElements.equals(other.minElements)) {
-                return false;
-            }
-            if (maxElements == null) {
-                if (other.maxElements != null) {
-                    return false;
-                }
-            } else if (!maxElements.equals(other.maxElements)) {
-                return false;
-            }
-            return true;
-        }
-
-        @Override
-        public String toString() {
-            return ConstraintDefinitionImpl.class.getSimpleName() + "[" +
-                    "whenCondition=" + whenCondition +
-                    ", mustConstraints=" + mustConstraints +
-                    ", mandatory=" + mandatory +
-                    ", minElements=" + minElements +
-                    ", maxElements=" + maxElements +
-                    "]";
-        }
-    }
-
-    /*
-     * @deprecated Use #build() instead.
-     */
-    @Override
-    @Deprecated
-    public ConstraintDefinition toInstance() {
-        return build();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ContainerSchemaNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ContainerSchemaNodeBuilder.java
deleted file mode 100644 (file)
index 421d35f..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainerBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class ContainerSchemaNodeBuilder extends AbstractDocumentedDataNodeContainerBuilder implements
-        AugmentationTargetBuilder, DataSchemaNodeBuilder {
-    private ContainerSchemaNodeImpl instance;
-    private boolean presence;
-    // SchemaNode args
-    private SchemaPath path;
-    // DataSchemaNode args
-    private boolean augmenting;
-    private boolean addedByUses;
-    private boolean configuration;
-    private ContainerSchemaNode originalNode;
-    private ContainerSchemaNodeBuilder originalBuilder;
-    private final ConstraintsBuilder constraints;
-    // AugmentationTarget args
-    private final List<AugmentationSchema> augmentations = new ArrayList<>();
-    private final List<AugmentationSchemaBuilder> augmentationBuilders = new ArrayList<>();
-
-    public ContainerSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.path = Preconditions.checkNotNull(path, "Schema Path must not be null");
-        this.constraints = new ConstraintsBuilderImpl(moduleName, line);
-    }
-
-    // constructor for uses
-    public ContainerSchemaNodeBuilder(final String moduleName, final int line, final QName qname,
-            final SchemaPath path, final ContainerSchemaNode base) {
-        super(moduleName, line, qname, path, base);
-        this.path = Preconditions.checkNotNull(path, "Schema Path must not be null");
-
-        constraints = new ConstraintsBuilderImpl(moduleName, line, base.getConstraints());
-
-        augmenting = base.isAugmenting();
-        addedByUses = base.isAddedByUses();
-        originalNode = base;
-        configuration = base.isConfiguration();
-        presence = base.isPresenceContainer();
-
-        augmentations.addAll(base.getAvailableAugmentations());
-
-    }
-
-    @Override
-    protected String getStatementName() {
-        return "container";
-    }
-
-    @Override
-    public ContainerSchemaNode build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        buildChildren();
-        instance = new ContainerSchemaNodeImpl(this);
-
-        instance.augmenting = augmenting;
-        instance.addedByUses = addedByUses;
-        instance.configuration = configuration;
-        instance.constraints = constraints.build();
-        instance.presence = presence;
-
-        // ORIGINAL NODE
-        if (originalNode == null && originalBuilder != null) {
-            originalNode = originalBuilder.build();
-        }
-        instance.original = originalNode;
-
-        // AUGMENTATIONS
-        for (AugmentationSchemaBuilder builder : augmentationBuilders) {
-            augmentations.add(builder.build());
-        }
-        instance.augmentations = ImmutableSet.copyOf(augmentations);
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    public List<AugmentationSchemaBuilder> getAugmentationBuilders() {
-        return augmentationBuilders;
-    }
-
-    @Override
-    public void addAugmentation(final AugmentationSchemaBuilder augment) {
-        augmentationBuilders.add(augment);
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.path = path;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public void setAugmenting(final boolean augmenting) {
-        this.augmenting = augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public ContainerSchemaNodeBuilder getOriginal() {
-        return originalBuilder;
-    }
-
-    @Override
-    public void setOriginal(final SchemaNodeBuilder builder) {
-        Preconditions.checkArgument(builder instanceof ContainerSchemaNodeBuilder, "Original of container cannot be "
-                + builder);
-        this.originalBuilder = (ContainerSchemaNodeBuilder) builder;
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public void setConfiguration(final boolean configuration) {
-        this.configuration = configuration;
-    }
-
-    @Override
-    public ConstraintsBuilder getConstraints() {
-        return constraints;
-    }
-
-    public boolean isPresence() {
-        return presence;
-    }
-
-    public void setPresence(final boolean presence) {
-        this.presence = presence;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ContainerSchemaNodeBuilder other = (ContainerSchemaNodeBuilder) obj;
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "container " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ContainerSchemaNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ContainerSchemaNodeImpl.java
deleted file mode 100644 (file)
index ba3b1f5..0000000
+++ /dev/null
@@ -1,145 +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.builder.impl;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class ContainerSchemaNodeImpl extends AbstractDocumentedDataNodeContainer implements
-        ContainerSchemaNode, DerivableSchemaNode {
-    private final QName qname;
-    private final SchemaPath path;
-
-    boolean augmenting;
-    boolean addedByUses;
-    boolean configuration;
-    ContainerSchemaNode original;
-    ConstraintDefinition constraints;
-
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-
-    boolean presence;
-
-    public ContainerSchemaNodeImpl(final ContainerSchemaNodeBuilder builder) {
-        super(builder);
-        this.qname = builder.getQName();
-        this.path = builder.getPath();
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public Optional<ContainerSchemaNode> getOriginal() {
-        return Optional.fromNullable(original);
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public ConstraintDefinition getConstraints() {
-        return constraints;
-    }
-
-    @Override
-    public Set<AugmentationSchema> getAvailableAugmentations() {
-        return augmentations;
-    }
-
-    @Override
-    public boolean isPresenceContainer() {
-        return presence;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ContainerSchemaNodeImpl other = (ContainerSchemaNodeImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "container " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/CopyUtils.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/CopyUtils.java
deleted file mode 100644 (file)
index 66bb9ff..0000000
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class CopyUtils {
-
-    private CopyUtils() {
-    }
-
-    /**
-     * Create copy of DataSchemaNodeBuilder with new parent. If updateQName is
-     * true, qname of node will be corrected based on new parent.
-     *
-     * @param old
-     *            builder to copy
-     * @param newParent
-     *            new parent
-     * @param updateQName
-     *            flag to indicate if qname should be updated based on new
-     *            parent location
-     * @return copy of given builder
-     */
-    public static DataSchemaNodeBuilder copy(final DataSchemaNodeBuilder old, final Builder newParent,
-            final boolean updateQName) {
-        if (old instanceof AnyXmlBuilder) {
-            return copy((AnyXmlBuilder) old, newParent, updateQName);
-        } else if (old instanceof ChoiceBuilder) {
-            return copy((ChoiceBuilder) old, newParent, updateQName);
-        } else if (old instanceof ContainerSchemaNodeBuilder) {
-            return copy((ContainerSchemaNodeBuilder) old, newParent, updateQName);
-        } else if (old instanceof LeafSchemaNodeBuilder) {
-            return copy((LeafSchemaNodeBuilder) old, newParent, updateQName);
-        } else if (old instanceof LeafListSchemaNodeBuilder) {
-            return copy((LeafListSchemaNodeBuilder) old, newParent, updateQName);
-        } else if (old instanceof ListSchemaNodeBuilder) {
-            return copy((ListSchemaNodeBuilder) old, newParent, updateQName);
-        } else if (old instanceof ChoiceCaseBuilder) {
-            return copy((ChoiceCaseBuilder) old, newParent, updateQName);
-        } else {
-            throw new YangParseException(old.getModuleName(), old.getLine(),
-                    "Failed to copy node: Unknown type of DataSchemaNode: " + old);
-        }
-    }
-
-    private static AnyXmlBuilder copy(final AnyXmlBuilder old, final Builder newParent, final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-
-        AnyXmlBuilder copy = new AnyXmlBuilder(newParent.getModuleName(), newParent.getLine(), newQName, newSchemaPath);
-        copy.setOriginal(old.getOriginal() == null ? old : old.getOriginal());
-        copyConstraints(copy.getConstraints(), old.getConstraints());
-        copy.setParent(newParent);
-        copy.setDescription(old.getDescription());
-        copy.setReference(old.getReference());
-        copy.setStatus(old.getStatus());
-        copy.setAugmenting(old.isAugmenting());
-        copy.setAddedByUses(old.isAddedByUses());
-        copy.setConfiguration(old.isConfiguration());
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            copy.addUnknownNodeBuilder(copy(un, copy, updateQName));
-        }
-
-        return copy;
-    }
-
-    private static ChoiceBuilder copy(final ChoiceBuilder old, final Builder newParent, final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-
-        ChoiceBuilder copy = new ChoiceBuilder(newParent.getModuleName(), newParent.getLine(), newQName, newSchemaPath);
-        copy.setOriginal(old.getOriginal() == null ? old : old.getOriginal());
-        copyConstraints(copy.getConstraints(), old.getConstraints());
-        copy.setParent(newParent);
-        copy.setDescription(old.getDescription());
-        copy.setReference(old.getReference());
-        copy.setStatus(old.getStatus());
-        copy.setAugmenting(old.isAugmenting());
-        copy.setAddedByUses(old.isAddedByUses());
-        copy.setConfiguration(old.isConfiguration());
-        for (ChoiceCaseBuilder childNode : old.getCases()) {
-            copy.addCase(copy(childNode, copy, updateQName));
-        }
-        for (AugmentationSchemaBuilder augment : old.getAugmentationBuilders()) {
-            copy.addAugmentation(copyAugment(augment, copy));
-        }
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            copy.addUnknownNodeBuilder(copy(un, copy, updateQName));
-        }
-
-        return copy;
-    }
-
-    private static ChoiceCaseBuilder copy(final ChoiceCaseBuilder old, final Builder newParent,
-            final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-
-        ChoiceCaseBuilder copy = new ChoiceCaseBuilder(newParent.getModuleName(), newParent.getLine(), newQName,
-                newSchemaPath);
-        copy.setOriginal(old.getOriginal() == null ? old : old.getOriginal());
-        copyConstraints(copy.getConstraints(), old.getConstraints());
-        copy.setParent(newParent);
-        copy.setDescription(old.getDescription());
-        copy.setReference(old.getReference());
-        copy.setStatus(old.getStatus());
-        copy.setAugmenting(old.isAugmenting());
-        for (DataSchemaNodeBuilder childNode : old.getChildNodeBuilders()) {
-            copy.addChildNode(copy(childNode, copy, updateQName));
-        }
-        for (UsesNodeBuilder oldUses : old.getUsesNodeBuilders()) {
-            copy.addUsesNode(copyUses(oldUses, copy));
-        }
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            copy.addUnknownNodeBuilder(copy(un, copy, updateQName));
-        }
-
-        return copy;
-    }
-
-    private static ContainerSchemaNodeBuilder copy(final ContainerSchemaNodeBuilder old, final Builder newParent,
-            final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-
-        ContainerSchemaNodeBuilder copy = new ContainerSchemaNodeBuilder(newParent.getModuleName(),
-                newParent.getLine(), newQName, newSchemaPath);
-        copy.setOriginal(old.getOriginal() == null ? old : old.getOriginal());
-        copyConstraints(copy.getConstraints(), old.getConstraints());
-        copy.setParent(newParent);
-        copy.setDescription(old.getDescription());
-        copy.setReference(old.getReference());
-        copy.setStatus(old.getStatus());
-        copy.setPresence(old.isPresence());
-        copy.setAugmenting(old.isAugmenting());
-        copy.setAddedByUses(old.isAddedByUses());
-        copy.setConfiguration(old.isConfiguration());
-        for (DataSchemaNodeBuilder childNode : old.getChildNodeBuilders()) {
-            copy.addChildNode(copy(childNode, copy, updateQName));
-        }
-        copy.getGroupings().addAll(old.getGroupings());
-        for (GroupingBuilder grouping : old.getGroupingBuilders()) {
-            copy.addGrouping(copy(grouping, copy, updateQName));
-        }
-        for (TypeDefinitionBuilder tdb : old.getTypeDefinitionBuilders()) {
-            copy.addTypedef(copy(tdb, copy, updateQName));
-        }
-        for (UsesNodeBuilder oldUses : old.getUsesNodeBuilders()) {
-            copy.addUsesNode(copyUses(oldUses, copy));
-        }
-        for (AugmentationSchemaBuilder augment : old.getAugmentationBuilders()) {
-            copy.addAugmentation(copyAugment(augment, copy));
-        }
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            copy.addUnknownNodeBuilder(copy(un, copy, updateQName));
-        }
-
-        return copy;
-    }
-
-    private static LeafSchemaNodeBuilder copy(final LeafSchemaNodeBuilder old, final Builder newParent,
-            final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-
-        LeafSchemaNodeBuilder copy = new LeafSchemaNodeBuilder(newParent.getModuleName(), newParent.getLine(),
-                newQName, newSchemaPath);
-        copy.setOriginal(old.getOriginal() == null ? old : old.getOriginal());
-        copyConstraints(copy.getConstraints(), old.getConstraints());
-        copy.setParent(newParent);
-        copy.setDescription(old.getDescription());
-        copy.setReference(old.getReference());
-        copy.setStatus(old.getStatus());
-        copy.setAugmenting(old.isAugmenting());
-        copy.setAddedByUses(old.isAddedByUses());
-        copy.setConfiguration(old.isConfiguration());
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            copy.addUnknownNodeBuilder(copy(un, copy, updateQName));
-        }
-
-        if (old.getType() == null) {
-            copy.setTypedef(old.getTypedef());
-        } else {
-            copy.setType(old.getType());
-        }
-
-        copy.setDefaultStr(old.getDefaultStr());
-        copy.setUnits(old.getUnits());
-
-        return copy;
-    }
-
-    private static LeafListSchemaNodeBuilder copy(final LeafListSchemaNodeBuilder old, final Builder newParent,
-            final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-
-        LeafListSchemaNodeBuilder copy = new LeafListSchemaNodeBuilder(newParent.getModuleName(), newParent.getLine(),
-                newQName, newSchemaPath);
-        copy.setOriginal(old.getOriginal() == null ? old : old.getOriginal());
-        copyConstraints(copy.getConstraints(), old.getConstraints());
-        copy.setParent(newParent);
-        copy.setDescription(old.getDescription());
-        copy.setReference(old.getReference());
-        copy.setStatus(old.getStatus());
-        copy.setAugmenting(old.isAugmenting());
-        copy.setAddedByUses(old.isAddedByUses());
-        copy.setConfiguration(old.isConfiguration());
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            copy.addUnknownNodeBuilder(copy(un, copy, updateQName));
-        }
-
-        if (old.getType() == null) {
-            copy.setTypedef(old.getTypedef());
-        } else {
-            copy.setType(old.getType());
-        }
-
-        copy.setUserOrdered(old.isUserOrdered());
-
-        return copy;
-    }
-
-    private static ListSchemaNodeBuilder copy(final ListSchemaNodeBuilder old, final Builder newParent,
-            final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-
-        ListSchemaNodeBuilder copy = new ListSchemaNodeBuilder(newParent.getModuleName(), newParent.getLine(),
-                newQName, newSchemaPath);
-        copy.setOriginal(old.getOriginal() == null ? old : old.getOriginal());
-        copyConstraints(copy.getConstraints(), old.getConstraints());
-        copy.setParent(newParent);
-        copy.setDescription(old.getDescription());
-        copy.setReference(old.getReference());
-        copy.setStatus(old.getStatus());
-        copy.setAugmenting(old.isAugmenting());
-        copy.setAddedByUses(old.isAddedByUses());
-        copy.setConfiguration(old.isConfiguration());
-        for (DataSchemaNodeBuilder childNode : old.getChildNodeBuilders()) {
-            copy.addChildNode(copy(childNode, copy, updateQName));
-        }
-        copy.getGroupings().addAll(old.getGroupings());
-        for (GroupingBuilder grouping : old.getGroupingBuilders()) {
-            copy.addGrouping(copy(grouping, copy, updateQName));
-        }
-        for (TypeDefinitionBuilder tdb : old.getTypeDefinitionBuilders()) {
-            copy.addTypedef(copy(tdb, copy, updateQName));
-        }
-        for (UsesNodeBuilder oldUses : old.getUsesNodeBuilders()) {
-            copy.addUsesNode(copyUses(oldUses, copy));
-        }
-        for (AugmentationSchemaBuilder augment : old.getAugmentationBuilders()) {
-            copy.addAugmentation(copyAugment(augment, copy));
-        }
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            copy.addUnknownNodeBuilder(copy(un, copy, updateQName));
-        }
-
-        copy.setUserOrdered(old.isUserOrdered());
-        copy.setKeys(old.getKeys());
-
-        return copy;
-    }
-
-    public static GroupingBuilder copy(final GroupingBuilder old, final Builder newParent, final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-
-        GroupingBuilderImpl copy = new GroupingBuilderImpl(newParent.getModuleName(), newParent.getLine(), newQName,
-                newSchemaPath);
-        copy.setParent(newParent);
-        copy.setDescription(old.getDescription());
-        copy.setReference(old.getReference());
-        copy.setStatus(old.getStatus());
-        copy.setAddedByUses(old.isAddedByUses());
-        for (DataSchemaNodeBuilder childNode : old.getChildNodeBuilders()) {
-            copy.addChildNode(copy(childNode, copy, updateQName));
-        }
-        copy.getGroupings().addAll(old.getGroupings());
-        for (GroupingBuilder grouping : old.getGroupingBuilders()) {
-            copy.addGrouping(copy(grouping, copy, updateQName));
-        }
-        for (TypeDefinitionBuilder tdb : old.getTypeDefinitionBuilders()) {
-            copy.addTypedef(copy(tdb, copy, updateQName));
-        }
-        for (UsesNodeBuilder oldUses : old.getUsesNodeBuilders()) {
-            copy.addUsesNode(copyUses(oldUses, copy));
-        }
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            copy.addUnknownNodeBuilder(copy(un, copy, updateQName));
-        }
-
-        return copy;
-    }
-
-    public static TypeDefinitionBuilder copy(final TypeDefinitionBuilder old, final Builder newParent,
-            final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-        TypeDefinitionBuilder type;
-
-        if (old instanceof UnionTypeBuilder) {
-            UnionTypeBuilder oldUnion = (UnionTypeBuilder) old;
-            type = new UnionTypeBuilder(newParent.getModuleName(), newParent.getLine());
-            type.setParent(newParent);
-            for (TypeDefinition<?> td : oldUnion.getTypes()) {
-                type.setType(td);
-            }
-            for (TypeDefinitionBuilder tdb : oldUnion.getTypedefs()) {
-                type.setTypedef(copy(tdb, type, updateQName));
-            }
-        } else if (old instanceof IdentityrefTypeBuilder) {
-            type = new IdentityrefTypeBuilder(newParent.getModuleName(), newParent.getLine(),
-                    ((IdentityrefTypeBuilder) old).getBaseString(), newSchemaPath);
-            type.setParent(newParent);
-        } else {
-            type = new TypeDefinitionBuilderImpl(old.getModuleName(), newParent.getLine(), newQName, old.getPath());
-            type.setParent(newParent);
-
-            if (old.getType() == null) {
-                type.setTypedef(copy(old.getTypedef(), type, updateQName));
-            } else {
-                type.setType(old.getType());
-            }
-
-            for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-                type.addUnknownNodeBuilder(copy(un, type, updateQName));
-            }
-
-            type.setRanges(old.getRanges());
-            type.setLengths(old.getLengths());
-            type.setPatterns(old.getPatterns());
-            type.setFractionDigits(old.getFractionDigits());
-            type.setDescription(old.getDescription());
-            type.setReference(old.getReference());
-            type.setStatus(old.getStatus());
-            type.setUnits(old.getUnits());
-            type.setDefaultValue(old.getDefaultValue());
-            type.setAddedByUses(old.isAddedByUses());
-        }
-
-        return type;
-    }
-
-    private static ConstraintsBuilder copyConstraints(final ConstraintsBuilder newConstraints,
-            final ConstraintsBuilder old) {
-        newConstraints.getMustDefinitions().addAll(old.getMustDefinitions());
-        newConstraints.addWhenCondition(old.getWhenCondition());
-        newConstraints.setMandatory(old.isMandatory());
-        newConstraints.setMinElements(old.getMinElements());
-        newConstraints.setMaxElements(old.getMaxElements());
-        return newConstraints;
-    }
-
-    private static UsesNodeBuilder copyUses(final UsesNodeBuilder old, final Builder newParent) {
-        UsesNodeBuilder copy = new UsesNodeBuilderImpl(newParent.getModuleName(), newParent.getLine(),
-                old.getGroupingPath());
-        copy.setParent(newParent);
-        copy.setGroupingDefinition(old.getGroupingDefinition());
-        copy.setGrouping(old.getGroupingBuilder());
-        copy.setAddedByUses(old.isAddedByUses());
-        copy.getAugmentations().addAll(old.getAugmentations());
-        copy.getRefineNodes().addAll(old.getRefineNodes());
-        copy.getRefines().addAll(old.getRefines());
-        copy.setAugmenting(old.isAugmenting());
-        return copy;
-    }
-
-    private static AugmentationSchemaBuilder copyAugment(final AugmentationSchemaBuilder old, final Builder newParent) {
-        AugmentationSchemaBuilderImpl copy = new AugmentationSchemaBuilderImpl(newParent.getModuleName(),
-                newParent.getLine(), old.getTargetPathAsString(), old.getTargetPath(), old.getOrder());
-        copy.setParent(newParent);
-        copy.setCopyOf(old);
-        copy.setDescription(old.getDescription());
-        copy.setReference(old.getReference());
-        copy.setStatus(old.getStatus());
-        copy.addWhenCondition(old.getWhenCondition());
-        for (DataSchemaNodeBuilder childNode : old.getChildNodeBuilders()) {
-            copy.addChildNode(copy(childNode, copy, false));
-        }
-        for (UsesNodeBuilder oldUses : old.getUsesNodeBuilders()) {
-            copy.addUsesNode(copyUses(oldUses, copy));
-        }
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            copy.addUnknownNodeBuilder(copy(un, copy, false));
-        }
-
-        return copy;
-    }
-
-    public static UnknownSchemaNodeBuilderImpl copy(final UnknownSchemaNodeBuilder old, final Builder newParent,
-            final boolean updateQName) {
-        DataBean data = getdata(old, newParent, updateQName);
-        QName newQName = data.qname;
-        SchemaPath newSchemaPath = data.schemaPath;
-
-        UnknownSchemaNodeBuilderImpl c = new UnknownSchemaNodeBuilderImpl(newParent.getModuleName(),
-                newParent.getLine(), newQName, newSchemaPath);
-
-        c.setNodeType(old.getNodeType());
-        c.setNodeParameter(old.getNodeParameter());
-        c.setParent(newParent);
-        c.setDescription(old.getDescription());
-        c.setReference(old.getReference());
-        c.setStatus(old.getStatus());
-        c.setAddedByUses(old.isAddedByUses());
-        for (UnknownSchemaNodeBuilder un : old.getUnknownNodes()) {
-            c.addUnknownNodeBuilder(copy(un, c, updateQName));
-        }
-        c.setExtensionBuilder(old.getExtensionBuilder());
-        c.setExtensionDefinition(old.getExtensionDefinition());
-
-        return c;
-    }
-
-    private static DataBean getdata(final SchemaNodeBuilder old, final Builder newParent, final boolean updateQName) {
-        final SchemaPath newSchemaPath;
-        // this check avoid NPE because if old is IdentityrefTypeBuilder, old.getQNname() return null
-        final boolean identityrefTypeCheck = !(old instanceof IdentityrefTypeBuilder) && updateQName;
-
-        QName newQName = null;
-        if (newParent instanceof ModuleBuilder) {
-            ModuleBuilder parent = (ModuleBuilder) newParent;
-            if (identityrefTypeCheck) {
-                newQName = QName.create(parent.getQNameModule(), old.getQName().getLocalName());
-            } else {
-                newQName = old.getQName();
-            }
-            newSchemaPath = SchemaPath.create(true, newQName);
-        } else if (newParent instanceof AugmentationSchemaBuilder) {
-            AugmentationSchemaBuilder augment = (AugmentationSchemaBuilder) newParent;
-            ModuleBuilder parent = BuilderUtils.getParentModule(newParent);
-            if (identityrefTypeCheck) {
-                newQName = QName.create(parent.getQNameModule(), old.getQName().getLocalName());
-            } else {
-                newQName = old.getQName();
-            }
-            newSchemaPath = augment.getTargetPath().createChild(newQName);
-        } else if (newParent instanceof SchemaNodeBuilder) {
-            SchemaNodeBuilder parent = (SchemaNodeBuilder) newParent;
-            QName parentQName = parent.getQName();
-            if (identityrefTypeCheck) {
-                newQName = QName.create(parentQName, old.getQName().getLocalName());
-            } else {
-                newQName = old.getQName();
-            }
-            newSchemaPath = parent.getPath().createChild(newQName);
-        } else {
-            newSchemaPath = SchemaPath.ROOT;
-        }
-
-        return new DataBean(newQName, newSchemaPath);
-    }
-
-    private static final class DataBean {
-        private final QName qname;
-        private final SchemaPath schemaPath;
-
-        private DataBean(final QName qname, final SchemaPath schemaPath) {
-            this.qname = qname;
-            this.schemaPath = schemaPath;
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/DeviationBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/DeviationBuilder.java
deleted file mode 100644 (file)
index 2aa509e..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.model.api.Deviation;
-import org.opendaylight.yangtools.yang.model.api.Deviation.Deviate;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class DeviationBuilder extends AbstractBuilder {
-    private DeviationImpl instance;
-    private final SchemaPath targetPath;
-    private Deviate deviate;
-    private String reference;
-
-    DeviationBuilder(final String moduleName, final int line, final SchemaPath targetPath) {
-        super(moduleName, line);
-        this.targetPath = targetPath;
-    }
-
-    @Override
-    public Deviation build() {
-        if (instance != null) {
-            return instance;
-        }
-        if (targetPath == null) {
-            throw new YangParseException(getModuleName(), getLine(), "Unresolved deviation target");
-        }
-
-        instance = new DeviationImpl(targetPath);
-        instance.deviate = deviate;
-        instance.reference = reference;
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    public SchemaPath getTargetPath() {
-        return targetPath;
-    }
-
-    public void setDeviate(final String deviate) {
-        if ("not-supported".equals(deviate)) {
-            this.deviate = Deviate.NOT_SUPPORTED;
-        } else if ("add".equals(deviate)) {
-            this.deviate = Deviate.ADD;
-        } else if ("replace".equals(deviate)) {
-            this.deviate = Deviate.REPLACE;
-        } else if ("delete".equals(deviate)) {
-            this.deviate = Deviate.DELETE;
-        } else {
-            throw new YangParseException(getModuleName(), getLine(), "Unsupported type of 'deviate' statement: " + deviate);
-        }
-    }
-
-    public void setReference(final String reference) {
-        this.reference = reference;
-    }
-
-    @Override
-    public String toString() {
-        return "deviation " + targetPath;
-    }
-
-    private static final class DeviationImpl implements Deviation {
-        private final SchemaPath targetPath;
-        private Deviate deviate;
-        private String reference;
-        private ImmutableList<UnknownSchemaNode> unknownNodes;
-
-        private DeviationImpl(final SchemaPath targetPath) {
-            this.targetPath = targetPath;
-        }
-
-        @Override
-        public SchemaPath getTargetPath() {
-            return targetPath;
-        }
-
-        @Override
-        public Deviate getDeviate() {
-            return deviate;
-        }
-
-        @Override
-        public String getReference() {
-            return reference;
-        }
-
-        @Override
-        public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-            return unknownNodes;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + Objects.hashCode(targetPath);
-            result = prime * result + Objects.hashCode(deviate);
-            result = prime * result + Objects.hashCode(reference);
-            return result;
-        }
-
-        @Override
-        public boolean equals(final Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (getClass() != obj.getClass()) {
-                return false;
-            }
-            DeviationImpl other = (DeviationImpl) obj;
-            if (targetPath == null) {
-                if (other.targetPath != null) {
-                    return false;
-                }
-            } else if (!targetPath.equals(other.targetPath)) {
-                return false;
-            }
-            if (deviate == null) {
-                if (other.deviate != null) {
-                    return false;
-                }
-            } else if (!deviate.equals(other.deviate)) {
-                return false;
-            }
-            if (reference == null) {
-                if (other.reference != null) {
-                    return false;
-                }
-            } else if (!reference.equals(other.reference)) {
-                return false;
-            }
-            return true;
-        }
-
-        @Override
-        public String toString() {
-            return DeviationImpl.class.getSimpleName() + "[" +
-                    "targetPath=" + targetPath +
-                    ", deviate=" + deviate +
-                    ", reference=" + reference +
-                    "]";
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ExtensionBuilderImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ExtensionBuilderImpl.java
deleted file mode 100644 (file)
index c7e745b..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.ExtensionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractSchemaNodeBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class ExtensionBuilderImpl extends AbstractSchemaNodeBuilder implements ExtensionBuilder {
-    private ExtensionDefinitionImpl instance;
-    private String argument;
-    private boolean yin;
-
-    ExtensionBuilderImpl(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-    }
-
-    @Override
-    public ExtensionDefinition build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new ExtensionDefinitionImpl(qname, schemaPath);
-        instance.argument = argument;
-        instance.yin = yin;
-
-        instance.description = description;
-        instance.reference = reference;
-        instance.status = status;
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public void setYinElement(final boolean yin) {
-        this.yin = yin;
-    }
-
-    @Override
-    public void setArgument(final String argument) {
-        this.argument = argument;
-    }
-
-    @Override
-    public String toString() {
-        return "extension " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ExtensionDefinitionImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ExtensionDefinitionImpl.java
deleted file mode 100644 (file)
index c82c15f..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class ExtensionDefinitionImpl implements ExtensionDefinition {
-    private final QName qname;
-    String argument;
-    private final SchemaPath schemaPath;
-    String description;
-    String reference;
-    Status status;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-    boolean yin;
-
-    ExtensionDefinitionImpl(final QName qname, final SchemaPath path) {
-        this.qname = qname;
-        this.schemaPath = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public String getArgument() {
-        return argument;
-    }
-
-    @Override
-    public boolean isYinElement() {
-        return yin;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ExtensionDefinitionImpl other = (ExtensionDefinitionImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return ExtensionDefinitionImpl.class.getSimpleName() + "[" +
-                "argument=" + argument +
-                ", qname=" + qname +
-                ", schemaPath=" + schemaPath +
-                ", extensionSchemaNodes=" + unknownNodes +
-                ", yin=" + yin +
-                "]";
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/FeatureBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/FeatureBuilder.java
deleted file mode 100644 (file)
index b2ee2a0..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractSchemaNodeBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class FeatureBuilder extends AbstractSchemaNodeBuilder {
-    private FeatureDefinitionImpl instance;
-
-    FeatureBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-    }
-
-    @Override
-    public FeatureDefinitionImpl build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new FeatureDefinitionImpl(qname, schemaPath);
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public String toString() {
-        return "feature " + qname.getLocalName();
-    }
-
-    private static final class FeatureDefinitionImpl implements FeatureDefinition {
-        private final QName qname;
-        private final SchemaPath path;
-        private String description;
-        private String reference;
-        private Status status;
-        private ImmutableList<UnknownSchemaNode> unknownNodes;
-
-        private FeatureDefinitionImpl(final QName qname, final SchemaPath path) {
-            this.qname = qname;
-            this.path = path;
-        }
-
-        @Override
-        public QName getQName() {
-            return qname;
-        }
-
-        @Override
-        public SchemaPath getPath() {
-            return path;
-        }
-
-        @Override
-        public String getDescription() {
-            return description;
-        }
-
-        @Override
-        public String getReference() {
-            return reference;
-        }
-
-        @Override
-        public Status getStatus() {
-            return status;
-        }
-
-        @Override
-        public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-            return unknownNodes;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + Objects.hashCode(qname);
-            result = prime * result + Objects.hashCode(path);
-            return result;
-        }
-
-        @Override
-        public boolean equals(final Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (getClass() != obj.getClass()) {
-                return false;
-            }
-            FeatureDefinitionImpl other = (FeatureDefinitionImpl) obj;
-            if (qname == null) {
-                if (other.qname != null) {
-                    return false;
-                }
-            } else if (!qname.equals(other.qname)) {
-                return false;
-            }
-            if (path == null) {
-                if (other.path != null) {
-                    return false;
-                }
-            } else if (!path.equals(other.path)) {
-                return false;
-            }
-            return true;
-        }
-
-        @Override
-        public String toString() {
-            return FeatureDefinitionImpl.class.getSimpleName() + "[name=" + qname + "]";
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/GroupingBuilderImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/GroupingBuilderImpl.java
deleted file mode 100644 (file)
index 191e234..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainerBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class GroupingBuilderImpl extends AbstractDocumentedDataNodeContainerBuilder implements GroupingBuilder {
-    private GroupingDefinitionImpl instance;
-    // SchemaNode args
-    private SchemaPath schemaPath;
-    // DataSchemaNode args
-    private boolean addedByUses;
-
-    public GroupingBuilderImpl(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-    }
-
-    public GroupingBuilderImpl(final String moduleName, final int line, final QName qname, final SchemaPath path,
-            final GroupingDefinition base) {
-        super(moduleName, line, base.getQName(), Preconditions.checkNotNull(path, "Schema Path must not be null"), base);
-        schemaPath = path;
-        addedByUses = base.isAddedByUses();
-        addedUnknownNodes.addAll(BuilderUtils.wrapUnknownNodes(moduleName, line, base.getUnknownSchemaNodes(), path,
-                qname));
-    }
-
-    @Override
-    public GroupingDefinition build() {
-        if (instance != null) {
-            return instance;
-        }
-        buildChildren();
-        instance = new GroupingDefinitionImpl(qname, schemaPath, this);
-        instance.addedByUses = addedByUses;
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public List<DataSchemaNodeBuilder> instantiateChildNodes(final Builder newParent) {
-        final List<DataSchemaNodeBuilder> nodes = new ArrayList<>();
-        for (DataSchemaNodeBuilder node : getChildNodeBuilders()) {
-            DataSchemaNodeBuilder copy = CopyUtils.copy(node, newParent, true);
-            BuilderUtils.setNodeAddedByUses(copy);
-            nodes.add(copy);
-        }
-        return nodes;
-    }
-
-    @Override
-    public Set<TypeDefinitionBuilder> instantiateTypedefs(final Builder newParent) {
-        final Set<TypeDefinitionBuilder> nodes = new HashSet<>();
-        for (TypeDefinitionBuilder node : getTypeDefinitionBuilders()) {
-            TypeDefinitionBuilder copy = CopyUtils.copy(node, newParent, true);
-            nodes.add(copy);
-        }
-        return nodes;
-    }
-
-    @Override
-    public Set<GroupingBuilder> instantiateGroupings(final Builder newParent) {
-        final Set<GroupingBuilder> nodes = new HashSet<>();
-        for (GroupingBuilder node : getGroupingBuilders()) {
-            GroupingBuilder copy = CopyUtils.copy(node, newParent, true);
-            copy.setAddedByUses(true);
-            for (DataSchemaNodeBuilder childNode : copy.getChildNodeBuilders()) {
-                BuilderUtils.setNodeAddedByUses(childNode);
-            }
-            nodes.add(copy);
-        }
-        return nodes;
-    }
-
-    @Override
-    public Set<UnknownSchemaNodeBuilder> instantiateUnknownNodes(final Builder newParent) {
-        final Set<UnknownSchemaNodeBuilder> nodes = new HashSet<>();
-        for (UnknownSchemaNodeBuilder node : addedUnknownNodes) {
-            UnknownSchemaNodeBuilderImpl copy = CopyUtils.copy(node, newParent, true);
-            copy.setAddedByUses(true);
-            nodes.add(copy);
-        }
-        return nodes;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.schemaPath = path;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public String toString() {
-        return "grouping " + qname.getLocalName();
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(getParent());
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        final GroupingBuilderImpl other = (GroupingBuilderImpl) obj;
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    protected String getStatementName() {
-        return "grouping";
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/GroupingDefinitionImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/GroupingDefinitionImpl.java
deleted file mode 100644 (file)
index 62c9893..0000000
+++ /dev/null
@@ -1,101 +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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class GroupingDefinitionImpl extends AbstractDocumentedDataNodeContainer implements GroupingDefinition {
-    private final QName qname;
-    private final SchemaPath path;
-
-    boolean addedByUses;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-
-    GroupingDefinitionImpl(final QName qname, final SchemaPath path, final GroupingBuilderImpl builder) {
-        super(builder);
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final GroupingDefinitionImpl other = (GroupingDefinitionImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return GroupingDefinitionImpl.class.getSimpleName() + "[" +
-                "qname=" + qname +
-                "]";
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/GroupingUtils.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/GroupingUtils.java
deleted file mode 100644 (file)
index 63058a6..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Splitter;
-import java.net.URI;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.RefineBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class GroupingUtils {
-    private static final Logger LOG = LoggerFactory.getLogger(GroupingUtils.class);
-
-    private static final Splitter SLASH_SPLITTER = Splitter.on('/');
-
-    private GroupingUtils() {
-    }
-
-    /**
-     * Search given modules for grouping by name defined in uses node.
-     *
-     * @param usesBuilder
-     *            builder of uses statement
-     * @param modules
-     *            all loaded modules
-     * @param module
-     *            current module
-     * @return grouping with given name, never null
-     * @throws YangParseException
-     *             if no grouping found
-     */
-    public static GroupingBuilder getTargetGroupingFromModules(final UsesNodeBuilder usesBuilder,
-            final Map<URI, NavigableMap<Date, ModuleBuilder>> modules, final ModuleBuilder module) {
-        final int line = usesBuilder.getLine();
-
-        SchemaPath groupingPath = usesBuilder.getTargetGroupingPath();
-        QName groupingName = groupingPath.getPathFromRoot().iterator().next();
-        ModuleBuilder dependentModule = BuilderUtils.findModule(groupingName, modules);
-
-        Set<GroupingBuilder> groupings = dependentModule.getGroupingBuilders();
-        GroupingBuilder result = findGroupingBuilder(groupings, groupingName.getLocalName());
-        if (result != null) {
-            return result;
-        }
-
-        Builder parent = usesBuilder.getParent();
-        while (parent != null) {
-            if (parent instanceof DataNodeContainerBuilder) {
-                groupings = ((DataNodeContainerBuilder) parent).getGroupingBuilders();
-            } else if (parent instanceof RpcDefinitionBuilder) {
-                groupings = ((RpcDefinitionBuilder) parent).getGroupings();
-            }
-            result = findGroupingBuilder(groupings, groupingName.getLocalName());
-            if (result == null) {
-                parent = parent.getParent();
-            } else {
-                break;
-            }
-        }
-
-        if (result == null) {
-            throw new YangParseException(module.getName(), line, "Grouping '" + groupingName + "' not found.");
-        }
-        return result;
-    }
-
-    /**
-     * Find grouping by name.
-     *
-     * @param groupings
-     *            collection of grouping builders to search
-     * @param name
-     *            name of grouping
-     * @return grouping with given name if present in collection, null otherwise
-     */
-    private static GroupingBuilder findGroupingBuilder(final Set<GroupingBuilder> groupings, final String name) {
-        for (GroupingBuilder grouping : groupings) {
-            if (grouping.getQName().getLocalName().equals(name)) {
-                return grouping;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Perform refinement of uses target grouping nodes. Uses process has to be
-     * already performed.
-     *
-     * @param usesNode
-     *            uses node containing refine statements
-     */
-    public static void performRefine(final UsesNodeBuilder usesNode) {
-        for (RefineBuilder refine : usesNode.getRefines()) {
-            String refineTargetPath = refine.getTargetPathString();
-
-            Builder currentNode = usesNode.getParent();
-            for (String pathElement : SLASH_SPLITTER.split(refineTargetPath)) {
-                if (currentNode instanceof DataNodeContainerBuilder) {
-                    currentNode = ((DataNodeContainerBuilder) currentNode).getDataChildByName(pathElement);
-                } else if (currentNode instanceof ChoiceBuilder) {
-                    currentNode = ((ChoiceBuilder) currentNode).getCaseNodeByName(pathElement);
-                }
-            }
-
-            DataSchemaNodeBuilder nodeToRefine = (DataSchemaNodeBuilder) currentNode;
-            if (nodeToRefine == null) {
-                // FIXME: exception replaced with log to avoid breakage when
-                // user tries to refine instance of extension (unknown node)
-
-                // throw new YangParseException(refine.getModuleName(),
-                // refine.getLine(), "Refine target node '" +
-                // refine.getTargetPathString() + "' not found");
-                LOG.warn("Error in module {} at line {}: Refine target node {} not found.", refine.getModuleName(),
-                        refine.getLine(), refine.getTargetPathString());
-                continue;
-            }
-            RefineUtils.performRefine(nodeToRefine, refine);
-            usesNode.addRefineNode(nodeToRefine);
-        }
-    }
-
-    public static class UsesComparator implements Comparator<UsesNodeBuilder> {
-        @Override
-        public int compare(final UsesNodeBuilder o1, final UsesNodeBuilder o2) {
-            return getElementPosition(o2) - getElementPosition(o1);
-        }
-    }
-
-    private static int getElementPosition(final UsesNodeBuilder usesNode) {
-        int i = 0;
-        Builder parent = usesNode.getParent();
-        while (!(parent instanceof ModuleBuilder)) {
-            parent = parent.getParent();
-            i++;
-        }
-        return i;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/IdentitySchemaNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/IdentitySchemaNodeBuilder.java
deleted file mode 100644 (file)
index 8c571dd..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import java.util.HashSet;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractSchemaNodeBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class IdentitySchemaNodeBuilder extends AbstractSchemaNodeBuilder {
-    private IdentitySchemaNodeImpl instance;
-    private IdentitySchemaNode baseIdentity;
-    private IdentitySchemaNodeBuilder baseIdentityBuilder;
-    private final Set<IdentitySchemaNode> derivedIdentities = new HashSet<>();
-    private String baseIdentityName;
-
-    IdentitySchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-    }
-
-    IdentitySchemaNodeBuilder(final String moduleName, final IdentitySchemaNode base) {
-        super(moduleName, 0, base.getQName());
-        schemaPath = base.getPath();
-        derivedIdentities.addAll(base.getDerivedIdentities());
-        unknownNodes.addAll(base.getUnknownSchemaNodes());
-    }
-
-    @Override
-    public IdentitySchemaNode build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new IdentitySchemaNodeImpl(qname, schemaPath, derivedIdentities);
-
-        instance.description = description;
-        instance.reference = reference;
-        instance.status = status;
-
-        if (baseIdentityBuilder != null) {
-            baseIdentityBuilder.addDerivedIdentity(instance);
-            baseIdentity = baseIdentityBuilder.build();
-        }
-        instance.baseIdentity = baseIdentity;
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    public String getBaseIdentityName() {
-        return baseIdentityName;
-    }
-
-    public void setBaseIdentityName(final String baseIdentityName) {
-        this.baseIdentityName = baseIdentityName;
-    }
-
-    public void setBaseIdentity(final IdentitySchemaNodeBuilder baseType) {
-        this.baseIdentityBuilder = baseType;
-    }
-
-    void addDerivedIdentity(final IdentitySchemaNode derivedIdentity) {
-        if (derivedIdentity != null) {
-            derivedIdentities.add(derivedIdentity);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return "identity " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/IdentitySchemaNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/IdentitySchemaNodeImpl.java
deleted file mode 100644 (file)
index c26b924..0000000
+++ /dev/null
@@ -1,128 +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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class IdentitySchemaNodeImpl implements IdentitySchemaNode {
-    private final QName qname;
-    private final SchemaPath path;
-    IdentitySchemaNode baseIdentity;
-    private final Set<IdentitySchemaNode> derivedIdentities;
-    String description;
-    String reference;
-    Status status;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-
-    IdentitySchemaNodeImpl(final QName qname, final SchemaPath path,
-            final Set<IdentitySchemaNode> derivedIdentities) {
-        this.qname = qname;
-        this.path = path;
-        this.derivedIdentities = derivedIdentities;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public IdentitySchemaNode getBaseIdentity() {
-        return baseIdentity;
-    }
-
-    @Override
-    public Set<IdentitySchemaNode> getDerivedIdentities() {
-        return Collections.unmodifiableSet(derivedIdentities);
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        IdentitySchemaNodeImpl other = (IdentitySchemaNodeImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return IdentitySchemaNodeImpl.class.getSimpleName() + "[" +
-                "base=" + baseIdentity +
-                ", qname=" + qname +
-                "]";
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/IdentityrefTypeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/IdentityrefTypeBuilder.java
deleted file mode 100644 (file)
index 957d163..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import java.util.Collections;
-import java.util.List;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
-import org.opendaylight.yangtools.yang.model.util.BaseTypes;
-import org.opendaylight.yangtools.yang.model.util.IdentityrefType;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractTypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Builder for YANG identityref type.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class IdentityrefTypeBuilder extends AbstractTypeAwareBuilder implements TypeDefinitionBuilder {
-    private static final String NAME = "identityref";
-
-    private final String baseString;
-    private SchemaPath schemaPath;
-    private IdentitySchemaNodeBuilder baseIdentity;
-
-    public IdentityrefTypeBuilder(final String moduleName, final int line, final String baseString,
-            final SchemaPath schemaPath) {
-        super(moduleName, line, BaseTypes.constructQName(NAME));
-        this.baseString = baseString;
-        this.schemaPath = Preconditions.checkNotNull(schemaPath, "Schema Path must not be null");
-
-    }
-
-    @Override
-    public void setQName(final QName qname) {
-        this.qname = qname;
-    }
-
-    @Override
-    public IdentityrefType build() {
-        return IdentityrefType.create(schemaPath, baseIdentity.build());
-    }
-
-    public String getBaseString() {
-        return baseString;
-    }
-
-    public void setBaseIdentity(final IdentitySchemaNodeBuilder baseIdentity) {
-        this.baseIdentity = baseIdentity;
-    }
-
-    @Override
-    public TypeDefinition<?> getType() {
-        return null;
-    }
-
-    @Override
-    public TypeDefinitionBuilder getTypedef() {
-        return null;
-    }
-
-    @Override
-    public void setType(final TypeDefinition<?> type) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set type to " + NAME);
-    }
-
-    @Override
-    public void setTypedef(final TypeDefinitionBuilder tdb) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set type to " + NAME);
-    }
-
-    @Override
-    public void setDescription(final String description) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set description to " + NAME);
-    }
-
-    @Override
-    public void setReference(final String reference) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set reference to " + NAME);
-    }
-
-    @Override
-    public void setStatus(final Status status) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set status to " + NAME);
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return false;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        throw new YangParseException(getModuleName(), getLine(), "Identityref type can not be added by uses.");
-    }
-
-    @Override
-    public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder unknownNode) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not add unknown node to " + NAME);
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.schemaPath = path;
-    }
-
-    @Override
-    public String getDescription() {
-        return null;
-    }
-
-    @Override
-    public String getReference() {
-        return null;
-    }
-
-    @Override
-    public Status getStatus() {
-        return null;
-    }
-
-    @Override
-    public List<RangeConstraint> getRanges() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void setRanges(final List<RangeConstraint> ranges) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set ranges to " + NAME);
-    }
-
-    @Override
-    public List<LengthConstraint> getLengths() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void setLengths(final List<LengthConstraint> lengths) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set lengths to " + NAME);
-    }
-
-    @Override
-    public List<PatternConstraint> getPatterns() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void setPatterns(final List<PatternConstraint> patterns) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set patterns to " + NAME);
-    }
-
-    @Override
-    public Integer getFractionDigits() {
-        return null;
-    }
-
-    @Override
-    public void setFractionDigits(final Integer fractionDigits) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set fraction digits to " + NAME);
-    }
-
-    @Override
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public void setDefaultValue(final Object defaultValue) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set default value to " + NAME);
-    }
-
-    @Override
-    public String getUnits() {
-        return null;
-    }
-    @Override
-    public void setUnits(final String units) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set units to " + NAME);
-    }
-
-    @Override
-    public String toString() {
-        return IdentityrefTypeBuilder.class.getSimpleName() + "[qName=" +
-                qname +
-                "[" +
-                ", base=" +
-                baseIdentity +
-                "]";
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafListSchemaNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafListSchemaNodeBuilder.java
deleted file mode 100644 (file)
index 3250ae8..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractTypeAwareBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder implements DataSchemaNodeBuilder {
-    private LeafListSchemaNodeImpl instance;
-    private boolean userOrdered;
-    // SchemaNode args
-    private SchemaPath schemaPath;
-    private String description;
-    private String reference;
-    private Status status = Status.CURRENT;
-    // DataSchemaNode args
-    private boolean augmenting;
-    private boolean addedByUses;
-    private LeafListSchemaNode originalNode;
-    private LeafListSchemaNodeBuilder originalBuilder;
-    private boolean configuration;
-    private final ConstraintsBuilder constraints;
-
-    public LeafListSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-        constraints = new ConstraintsBuilderImpl(moduleName, line);
-    }
-
-    public LeafListSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path,
-            final LeafListSchemaNode base) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-        constraints = new ConstraintsBuilderImpl(moduleName, line, base.getConstraints());
-
-        description = base.getDescription();
-        reference = base.getReference();
-        status = base.getStatus();
-        augmenting = base.isAugmenting();
-        addedByUses = base.isAddedByUses();
-        originalNode = base;
-        configuration = base.isConfiguration();
-        this.type = base.getType();
-        userOrdered = base.isUserOrdered();
-        unknownNodes.addAll(base.getUnknownSchemaNodes());
-    }
-
-    @Override
-    public LeafListSchemaNode build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new LeafListSchemaNodeImpl(qname, schemaPath);
-
-        instance.description = description;
-        instance.reference = reference;
-        instance.status = status;
-        instance.augmenting = augmenting;
-        instance.addedByUses = addedByUses;
-        instance.configuration = configuration;
-        instance.constraintsDef = constraints.build();
-        instance.userOrdered = userOrdered;
-
-        if (type == null) {
-            instance.type = typedef.build();
-        } else {
-            instance.type = type;
-        }
-
-        // ORIGINAL NODE
-        if (originalNode == null && originalBuilder != null) {
-            originalNode = originalBuilder.build();
-        }
-        instance.original = originalNode;
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.schemaPath = path;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public void setReference(final String reference) {
-        this.reference = reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public void setStatus(final Status status) {
-        this.status = Preconditions.checkNotNull(status, "status cannot be null");
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public void setAugmenting(final boolean augmenting) {
-        this.augmenting = augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public LeafListSchemaNodeBuilder getOriginal() {
-        return originalBuilder;
-    }
-
-    @Override
-    public void setOriginal(final SchemaNodeBuilder builder) {
-        Preconditions.checkArgument(builder instanceof LeafListSchemaNodeBuilder, "Original of leaf-list cannot be "
-                + builder);
-        this.originalBuilder = (LeafListSchemaNodeBuilder) builder;
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public void setConfiguration(final boolean configuration) {
-        this.configuration = configuration;
-    }
-
-    @Override
-    public ConstraintsBuilder getConstraints() {
-        return constraints;
-    }
-
-    public boolean isUserOrdered() {
-        return userOrdered;
-    }
-
-    public void setUserOrdered(final boolean userOrdered) {
-        this.userOrdered = userOrdered;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        LeafListSchemaNodeBuilder other = (LeafListSchemaNodeBuilder) obj;
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "leaf-list " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafListSchemaNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafListSchemaNodeImpl.java
deleted file mode 100644 (file)
index f8234f7..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class LeafListSchemaNodeImpl implements LeafListSchemaNode, DerivableSchemaNode {
-    private final QName qname;
-    private final SchemaPath path;
-    String description;
-    String reference;
-    Status status;
-    boolean augmenting;
-    boolean addedByUses;
-    LeafListSchemaNode original;
-    boolean configuration;
-    ConstraintDefinition constraintsDef;
-    TypeDefinition<?> type;
-    boolean userOrdered;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-
-    LeafListSchemaNodeImpl(final QName qname, final SchemaPath path) {
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public Optional<LeafListSchemaNode> getOriginal() {
-        return Optional.fromNullable(original);
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public ConstraintDefinition getConstraints() {
-        return constraintsDef;
-    }
-
-    @Override
-    public TypeDefinition<?> getType() {
-        return type;
-    }
-
-    @Override
-    public boolean isUserOrdered() {
-        return userOrdered;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        LeafListSchemaNodeImpl other = (LeafListSchemaNodeImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return LeafListSchemaNodeImpl.class.getSimpleName() + "[" +
-                qname +
-                "]";
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafSchemaNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafSchemaNodeBuilder.java
deleted file mode 100644 (file)
index 1d6fe18..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractTypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder implements DataSchemaNodeBuilder {
-    private LeafSchemaNodeImpl instance;
-    private String defaultStr;
-    private String unitsStr;
-    // SchemaNode args
-    private SchemaPath schemaPath;
-    private String description;
-    private String reference;
-    private Status status = Status.CURRENT;
-    // DataSchemaNode args
-    private boolean augmenting;
-    private boolean addedByUses;
-    private LeafSchemaNode originalNode;
-    private LeafSchemaNodeBuilder originalBuilder;
-    private boolean configuration;
-    private final ConstraintsBuilder constraints;
-
-    public LeafSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath schemaPath) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(schemaPath, "Schema Path must not be null");
-        constraints = new ConstraintsBuilderImpl(moduleName, line);
-    }
-
-    public LeafSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path, final LeafSchemaNode base) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-        constraints = new ConstraintsBuilderImpl(moduleName, line, base.getConstraints());
-
-        description = base.getDescription();
-        reference = base.getReference();
-        status = base.getStatus();
-        augmenting = base.isAugmenting();
-        addedByUses = base.isAddedByUses();
-        originalNode =base;
-        configuration = base.isConfiguration();
-        this.type = base.getType();
-        unknownNodes.addAll(base.getUnknownSchemaNodes());
-
-        defaultStr = base.getDefault();
-        unitsStr = base.getUnits();
-    }
-
-    @Override
-    public LeafSchemaNode build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new LeafSchemaNodeImpl(qname, schemaPath);
-
-        instance.description = description;
-        instance.reference = reference;
-        instance.status = status;
-        instance.augmenting = augmenting;
-        instance.addedByUses = addedByUses;
-        instance.configuration = configuration;
-        instance.constraintsDef = constraints.build();
-        instance.defaultStr = defaultStr;
-        instance.unitsStr = unitsStr;
-
-        if (type == null && typedef == null) {
-            throw new YangParseException(getModuleName(), getLine(), "Failed to resolve leaf type.");
-        }
-
-        // TYPE
-        if (type == null) {
-            instance.type = typedef.build();
-        } else {
-            instance.type = type;
-        }
-
-        // ORIGINAL NODE
-        if (originalNode == null && originalBuilder != null) {
-            originalNode = originalBuilder.build();
-        }
-        instance.original = originalNode;
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.schemaPath = path;
-    }
-
-    @Override
-    public ConstraintsBuilder getConstraints() {
-        return constraints;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public void setReference(final String reference) {
-        this.reference = reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public void setStatus(final Status status) {
-        this.status = Preconditions.checkNotNull(status, "status cannot be null");
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public void setAugmenting(final boolean augmenting) {
-        this.augmenting = augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public LeafSchemaNodeBuilder getOriginal() {
-        return originalBuilder;
-    }
-
-    @Override
-    public void setOriginal(final SchemaNodeBuilder builder) {
-        Preconditions.checkArgument(builder instanceof LeafSchemaNodeBuilder, "Original of leaf cannot be " + builder);
-        this.originalBuilder = (LeafSchemaNodeBuilder) builder;
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public void setConfiguration(final boolean configuration) {
-        this.configuration = configuration;
-    }
-
-    public String getDefaultStr() {
-        return defaultStr;
-    }
-
-    public void setDefaultStr(final String defaultStr) {
-        this.defaultStr = defaultStr;
-    }
-
-    public String getUnits() {
-        return unitsStr;
-    }
-
-    public void setUnits(final String unitsStr) {
-        this.unitsStr = unitsStr;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        LeafSchemaNodeBuilder other = (LeafSchemaNodeBuilder) obj;
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "leaf " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafSchemaNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafSchemaNodeImpl.java
deleted file mode 100644 (file)
index ac6ea09..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class LeafSchemaNodeImpl implements LeafSchemaNode, DerivableSchemaNode {
-    private final QName qname;
-    private final SchemaPath path;
-    String description;
-    String reference;
-    Status status;
-    boolean augmenting;
-    boolean addedByUses;
-    LeafSchemaNode original;
-    boolean configuration;
-    ConstraintDefinition constraintsDef;
-    TypeDefinition<?> type;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-    String defaultStr;
-    String unitsStr;
-
-    LeafSchemaNodeImpl(final QName qname, final SchemaPath path) {
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public Optional<LeafSchemaNode> getOriginal() {
-        return Optional.fromNullable(original);
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public ConstraintDefinition getConstraints() {
-        return constraintsDef;
-    }
-
-    @Override
-    public TypeDefinition<?> getType() {
-        return type;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public String getDefault() {
-        return defaultStr;
-    }
-
-    @Override
-    public String getUnits() {
-        return unitsStr;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        LeafSchemaNodeImpl other = (LeafSchemaNodeImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return LeafSchemaNodeImpl.class.getSimpleName() + "[" +
-                "qname=" + qname +
-                ", path=" + path +
-                "]";
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ListSchemaNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ListSchemaNodeBuilder.java
deleted file mode 100644 (file)
index dbd0951..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class ListSchemaNodeBuilder extends AbstractDocumentedDataNodeContainerBuilder implements
-        DataSchemaNodeBuilder, AugmentationTargetBuilder {
-    private ListSchemaNodeImpl instance;
-    private boolean userOrdered;
-    private Set<String> keys;
-    private List<QName> keyDefinition;
-    // SchemaNode args
-    private SchemaPath schemaPath;
-    // DataSchemaNode args
-    private boolean augmenting;
-    private boolean addedByUses;
-    private ListSchemaNodeBuilder originalBuilder;
-    private ListSchemaNode originalNode;
-    private boolean configuration;
-    private final ConstraintsBuilder constraints;
-    // AugmentationTarget args
-    private final List<AugmentationSchema> augmentations = new ArrayList<>();
-    private final List<AugmentationSchemaBuilder> augmentationBuilders = new ArrayList<>();
-
-    public ListSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-        constraints = new ConstraintsBuilderImpl(moduleName, line);
-    }
-
-    public ListSchemaNodeBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path,
-            final ListSchemaNode base) {
-        super(moduleName, line, qname, path, base);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-        constraints = new ConstraintsBuilderImpl(moduleName, line, base.getConstraints());
-
-        keyDefinition = ImmutableList.copyOf(base.getKeyDefinition());
-        userOrdered = base.isUserOrdered();
-
-        augmenting = base.isAugmenting();
-        addedByUses = base.isAddedByUses();
-        originalNode = base;
-        configuration = base.isConfiguration();
-
-        addedUnknownNodes.addAll(BuilderUtils.wrapUnknownNodes(moduleName, line, base.getUnknownSchemaNodes(), path,
-                qname));
-        augmentations.addAll(base.getAvailableAugmentations());
-    }
-
-    @Override
-    public ListSchemaNode build() {
-        if (instance != null) {
-            return instance;
-        }
-        buildChildren();
-        instance = new ListSchemaNodeImpl(qname, schemaPath, this);
-
-        instance.augmenting = augmenting;
-        instance.addedByUses = addedByUses;
-        instance.configuration = configuration;
-        instance.constraints = constraints.build();
-        instance.userOrdered = userOrdered;
-
-        // KEY
-        if (keys != null) {
-            keyDefinition = new ArrayList<>();
-            for (String key : keys) {
-                DataSchemaNode keyPart = instance.getDataChildByName(key);
-                if (keyPart == null) {
-                    throw new YangParseException(getModuleName(), getLine(), "Failed to resolve list key for name "
-                            + key);
-                }
-
-                if (!(keyPart instanceof LeafSchemaNode)) {
-                    throw new YangParseException(getModuleName(), getLine(), "List key : \"" + key
-                            + "\" does not reference any Leaf of the List");
-                }
-
-                final QName qname = keyPart.getQName();
-                if (!keyDefinition.contains(qname)) {
-                    keyDefinition.add(qname);
-                }
-            }
-            instance.keyDefinition = ImmutableList.copyOf(keyDefinition);
-        } else {
-            instance.keyDefinition = ImmutableList.of();
-        }
-
-        // ORIGINAL NODE
-        if (originalNode == null && originalBuilder != null) {
-            originalNode = originalBuilder.build();
-        }
-        instance.original = originalNode;
-
-        // AUGMENTATIONS
-        for (AugmentationSchemaBuilder builder : augmentationBuilders) {
-            augmentations.add(builder.build());
-        }
-        instance.augmentations = ImmutableSet.copyOf(augmentations);
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    protected String getStatementName() {
-        return "list";
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.schemaPath = path;
-    }
-
-    @Override
-    public void addAugmentation(final AugmentationSchemaBuilder augment) {
-        augmentationBuilders.add(augment);
-    }
-
-    public List<AugmentationSchemaBuilder> getAugmentationBuilders() {
-        return augmentationBuilders;
-    }
-
-    public Set<String> getKeys() {
-        return keys;
-    }
-
-    public void setKeys(final Set<String> keys) {
-        this.keys = keys;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public void setAugmenting(final boolean augmenting) {
-        this.augmenting = augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public ListSchemaNodeBuilder getOriginal() {
-        return originalBuilder;
-    }
-
-    @Override
-    public void setOriginal(final SchemaNodeBuilder builder) {
-        Preconditions.checkArgument(builder instanceof ListSchemaNodeBuilder, "Original of list cannot be " + builder);
-        this.originalBuilder = (ListSchemaNodeBuilder) builder;
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public void setConfiguration(final boolean configuration) {
-        this.configuration = configuration;
-    }
-
-    @Override
-    public ConstraintsBuilder getConstraints() {
-        return constraints;
-    }
-
-    public boolean isUserOrdered() {
-        return userOrdered;
-    }
-
-    public void setUserOrdered(final boolean userOrdered) {
-        this.userOrdered = userOrdered;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ListSchemaNodeBuilder other = (ListSchemaNodeBuilder) obj;
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "list " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ListSchemaNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ListSchemaNodeImpl.java
deleted file mode 100644 (file)
index b25980c..0000000
+++ /dev/null
@@ -1,147 +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.builder.impl;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class ListSchemaNodeImpl extends AbstractDocumentedDataNodeContainer implements
-        ListSchemaNode, DerivableSchemaNode {
-    private final QName qname;
-    private final SchemaPath path;
-    ImmutableList<QName> keyDefinition;
-    boolean augmenting;
-    boolean addedByUses;
-    ListSchemaNode original;
-    boolean configuration;
-    ConstraintDefinition constraints;
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-    boolean userOrdered;
-
-    ListSchemaNodeImpl(final QName qname, final SchemaPath path, final ListSchemaNodeBuilder builder) {
-        super(builder);
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public List<QName> getKeyDefinition() {
-        return keyDefinition;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public Optional<ListSchemaNode> getOriginal() {
-        return Optional.fromNullable(original);
-    }
-
-    @Override
-    public boolean isConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public ConstraintDefinition getConstraints() {
-        return constraints;
-    }
-
-    @Override
-    public Set<AugmentationSchema> getAvailableAugmentations() {
-        return augmentations;
-    }
-
-    @Override
-    public boolean isUserOrdered() {
-        return userOrdered;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final ListSchemaNodeImpl other = (ListSchemaNodeImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "list " + qname.getLocalName();
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ModuleBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ModuleBuilder.java
deleted file mode 100644 (file)
index fef3cf8..0000000
+++ /dev/null
@@ -1,1119 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Preconditions;
-import com.google.common.io.ByteSource;
-import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.TreeSet;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.Deviation;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
-import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.util.ModuleImportImpl;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DocumentedNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ExtensionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.Comparators;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Builder of Module object. If this module is dependent on external
- * module/modules, these dependencies must be resolved before module is built,
- * otherwise result may not be valid.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class ModuleBuilder extends AbstractDocumentedDataNodeContainerBuilder implements DocumentedNodeBuilder {
-    private static final QNameModule EMPTY_QNAME_MODULE = QNameModule.create(null, null).intern();
-    private static final String GROUPING_STR = "Grouping";
-    private static final String TYPEDEF_STR = "typedef";
-    private ModuleImpl instance;
-    private final String name;
-    private final String sourcePath;
-    private static final SchemaPath SCHEMA_PATH = SchemaPath.create(Collections.emptyList(), true);
-    private String prefix;
-    private QNameModule qnameModule = EMPTY_QNAME_MODULE;
-
-    private final boolean submodule;
-    private String belongsTo;
-    private ModuleBuilder parent;
-
-    private final Deque<Builder> actualPath = new LinkedList<>();
-    private final Set<TypeAwareBuilder> dirtyNodes = new HashSet<>();
-
-    final Map<String, ModuleImport> imports = new HashMap<>();
-    final Map<String, ModuleBuilder> importedModules = new HashMap<>();
-
-    final Set<ModuleBuilder> addedSubmodules = new HashSet<>();
-    final Set<Module> submodules = new HashSet<>();
-    final Map<String, Date> includedModules = new HashMap<>();
-
-    private final Set<AugmentationSchema> augments = new LinkedHashSet<>();
-    private final List<AugmentationSchemaBuilder> augmentBuilders = new ArrayList<>();
-    private final List<AugmentationSchemaBuilder> allAugments = new ArrayList<>();
-
-    private final List<GroupingBuilder> allGroupings = new ArrayList<>();
-
-    private final List<UsesNodeBuilder> allUsesNodes = new ArrayList<>();
-
-    private final Set<RpcDefinition> rpcs = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-    private final Set<RpcDefinitionBuilder> addedRpcs = new HashSet<>();
-
-    private final Set<NotificationDefinition> notifications = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-    private final Set<NotificationBuilder> addedNotifications = new HashSet<>();
-
-    private final Set<IdentitySchemaNode> identities = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-    private final Set<IdentitySchemaNodeBuilder> addedIdentities = new HashSet<>();
-
-    private final Set<FeatureDefinition> features = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-    private final Set<FeatureBuilder> addedFeatures = new HashSet<>();
-
-    private final Set<Deviation> deviations = new HashSet<>();
-    private final Set<DeviationBuilder> deviationBuilders = new HashSet<>();
-
-    private final List<ExtensionDefinition> extensions = new ArrayList<>();
-    private final List<ExtensionBuilder> addedExtensions = new ArrayList<>();
-
-    private final List<UnknownSchemaNodeBuilder> allUnknownNodes = new ArrayList<>();
-
-    private final List<ListSchemaNodeBuilder> allLists = new ArrayList<>();
-
-    private String source;
-    private String yangVersion;
-    private String organization;
-    private String contact;
-
-    public ModuleBuilder(final String name, final String sourcePath) {
-        this(name, false, sourcePath);
-    }
-
-    public ModuleBuilder(final String name, final boolean submodule, final String sourcePath) {
-        super(name, 0, null);
-        this.name = name;
-        this.sourcePath = sourcePath;
-        this.submodule = submodule;
-        actualPath.push(this);//FIXME: this escapes constructor
-    }
-
-    public ModuleBuilder(final Module base) {
-        super(base.getName(), 0, QName.create(base.getQNameModule(), base.getName()),
-                SCHEMA_PATH, base);
-        this.name = base.getName();
-        this.sourcePath = base.getModuleSourcePath();
-
-        submodule = false;
-        yangVersion = base.getYangVersion();
-        actualPath.push(this);//FIXME: this escapes constructor
-        prefix = base.getPrefix();
-        qnameModule = base.getQNameModule();
-
-        augments.addAll(base.getAugmentations());
-        rpcs.addAll(base.getRpcs());
-        notifications.addAll(base.getNotifications());
-
-        for (IdentitySchemaNode identityNode : base.getIdentities()) {
-            addedIdentities.add(new IdentitySchemaNodeBuilder(name, identityNode));
-        }
-
-        features.addAll(base.getFeatures());
-        deviations.addAll(base.getDeviations());
-        extensions.addAll(base.getExtensionSchemaNodes());
-        unknownNodes.addAll(base.getUnknownSchemaNodes());
-        source = base.getSource();
-    }
-
-    @Override
-    protected String getStatementName() {
-        return "module";
-    }
-
-    /**
-     * Build new Module object based on this builder.
-     */
-    @Override
-    public Module build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        buildChildren();
-
-        // SUBMODULES
-        for (ModuleBuilder submodule : addedSubmodules) {
-            submodules.add(submodule.build());
-        }
-
-        // FEATURES
-        for (FeatureBuilder fb : addedFeatures) {
-            features.add(fb.build());
-        }
-
-        // NOTIFICATIONS
-        for (NotificationBuilder entry : addedNotifications) {
-            notifications.add(entry.build());
-        }
-
-        // AUGMENTATIONS
-        for (AugmentationSchemaBuilder builder : augmentBuilders) {
-            augments.add(builder.build());
-        }
-
-        // RPCs
-        for (RpcDefinitionBuilder rpc : addedRpcs) {
-            rpcs.add(rpc.build());
-        }
-
-        // DEVIATIONS
-        for (DeviationBuilder entry : deviationBuilders) {
-            deviations.add(entry.build());
-        }
-
-        // EXTENSIONS
-        for (ExtensionBuilder eb : addedExtensions) {
-            extensions.add(eb.build());
-        }
-        Collections.sort(extensions, Comparators.SCHEMA_NODE_COMP);
-
-
-        // IDENTITIES
-        for (IdentitySchemaNodeBuilder id : addedIdentities) {
-            identities.add(id.build());
-        }
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder unb : addedUnknownNodes) {
-            unknownNodes.add(unb.build());
-        }
-        Collections.sort(unknownNodes, Comparators.SCHEMA_NODE_COMP);
-
-        instance = new ModuleImpl(name, sourcePath, this);
-        return instance;
-    }
-
-    public String getModuleSourcePath() {
-        return sourcePath;
-    }
-
-    @Override
-    public ModuleBuilder getParent() {
-        return parent;
-    }
-
-    public void setParent(final ModuleBuilder parent) {
-        this.parent = parent;
-    }
-
-    @Override
-    public void setParent(final Builder parent) {
-        throw new YangParseException(name, 0, "Can not set parent to module");
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return SCHEMA_PATH;
-    }
-
-    public void enterNode(final Builder node) {
-        actualPath.push(node);
-    }
-
-    public void exitNode() {
-        actualPath.pop();
-    }
-
-    public Builder getActualNode() {
-        if (actualPath.isEmpty()) {
-            return null;
-        } else {
-            return actualPath.peekFirst();
-        }
-    }
-
-    public Set<TypeAwareBuilder> getDirtyNodes() {
-        return dirtyNodes;
-    }
-
-    public Set<AugmentationSchema> getAugments() {
-        return augments;
-    }
-
-    public List<AugmentationSchemaBuilder> getAugmentBuilders() {
-        return augmentBuilders;
-    }
-
-    public List<AugmentationSchemaBuilder> getAllAugments() {
-        return allAugments;
-    }
-
-    public Set<IdentitySchemaNode> getIdentities() {
-        return identities;
-    }
-
-    public Set<IdentitySchemaNodeBuilder> getAddedIdentities() {
-        return addedIdentities;
-    }
-
-    public Set<FeatureDefinition> getFeatures() {
-        return features;
-    }
-
-    public Set<FeatureBuilder> getAddedFeatures() {
-        return addedFeatures;
-    }
-
-    public List<GroupingBuilder> getAllGroupings() {
-        return allGroupings;
-    }
-
-    public List<UsesNodeBuilder> getAllUsesNodes() {
-        return allUsesNodes;
-    }
-
-    public Set<Deviation> getDeviations() {
-        return deviations;
-    }
-
-    public Set<DeviationBuilder> getDeviationBuilders() {
-        return deviationBuilders;
-    }
-
-    public List<ExtensionDefinition> getExtensions() {
-        return extensions;
-    }
-
-    public List<ExtensionBuilder> getAddedExtensions() {
-        return addedExtensions;
-    }
-
-    public List<UnknownSchemaNodeBuilder> getAllUnknownNodes() {
-        return allUnknownNodes;
-    }
-
-    public List<ListSchemaNodeBuilder> getAllLists() {
-        return allLists;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public URI getNamespace() {
-        return qnameModule.getNamespace();
-    }
-
-    public QNameModule getQNameModule() {
-        return qnameModule;
-    }
-
-    public void setQNameModule(final QNameModule qnameModule) {
-        this.qnameModule = Preconditions.checkNotNull(qnameModule);
-    }
-
-    public void setNamespace(final URI namespace) {
-        this.qnameModule = QNameModule.create(namespace, qnameModule.getRevision()).intern();
-    }
-
-    public String getPrefix() {
-        return prefix;
-    }
-
-    public Date getRevision() {
-        return qnameModule.getRevision();
-    }
-
-    public ModuleImport getImport(final String prefix) {
-        return imports.get(prefix);
-    }
-
-    public Map<String, ModuleImport> getImports() {
-        return imports;
-    }
-
-    public ModuleBuilder getImportedModule(final String prefix) {
-        return importedModules.get(prefix);
-    }
-
-    public void addImportedModule(final String prefix, final ModuleBuilder module) {
-        checkPrefix(prefix);
-        importedModules.put(prefix, module);
-    }
-
-    public Map<String, Date> getIncludedModules() {
-        return includedModules;
-    }
-
-    public void addInclude(final String name, final Date revision) {
-        includedModules.put(name, revision);
-    }
-
-    public void addSubmodule(final ModuleBuilder submodule) {
-        addedSubmodules.add(submodule);
-    }
-
-    protected String getSource() {
-        return source;
-    }
-
-    public boolean isSubmodule() {
-        return submodule;
-    }
-
-    public String getBelongsTo() {
-        return belongsTo;
-    }
-
-    public void setBelongsTo(final String belongsTo) {
-        this.belongsTo = belongsTo;
-    }
-
-    public void markActualNodeDirty() {
-        final TypeAwareBuilder nodeBuilder = (TypeAwareBuilder) getActualNode();
-        dirtyNodes.add(nodeBuilder);
-    }
-
-    public void setRevision(final Date revision) {
-        this.qnameModule = QNameModule.create(qnameModule.getNamespace(), revision).intern();
-    }
-
-    public void setPrefix(final String prefix) {
-        this.prefix = prefix;
-    }
-
-    public void setYangVersion(final String yangVersion) {
-        this.yangVersion = yangVersion;
-    }
-
-    public void setOrganization(final String organization) {
-        this.organization = organization;
-    }
-
-    public void setContact(final String contact) {
-        this.contact = contact;
-    }
-
-    public void addModuleImport(final String moduleName, final Date revision, final String prefix) {
-        checkPrefix(prefix);
-        checkNotSealed();
-        final ModuleImport moduleImport = new ModuleImportImpl(moduleName, revision, prefix);
-        imports.put(prefix, moduleImport);
-    }
-
-    private void checkPrefix(final String prefix) {
-        if (prefix == null || prefix.isEmpty()) {
-            throw new IllegalArgumentException("Cannot add imported module with undefined prefix");
-        }
-        if (prefix.equals(this.prefix)) {
-            throw new IllegalArgumentException("Cannot add imported module with prefix equals to module prefix");
-        }
-    }
-
-    public ExtensionBuilder addExtension(final QName qname, final int line, final SchemaPath path) {
-        checkNotSealed();
-        Builder parentBuilder = getActualNode();
-        if (!(parentBuilder.equals(this))) {
-            throw new YangParseException(name, line, "extension can be defined only in module or submodule");
-        }
-
-        final String extName = qname.getLocalName();
-        for (ExtensionBuilder addedExtension : addedExtensions) {
-            if (addedExtension.getQName().getLocalName().equals(extName)) {
-                raiseYangParserException("extension", "node", extName, line, addedExtension.getLine());
-            }
-        }
-        final ExtensionBuilder builder = new ExtensionBuilderImpl(name, line, qname, path);
-        builder.setParent(parentBuilder);
-        addedExtensions.add(builder);
-        return builder;
-    }
-
-    public ContainerSchemaNodeBuilder addContainerNode(final int line, final QName qname, final SchemaPath schemaPath) {
-        checkNotSealed();
-        final ContainerSchemaNodeBuilder builder = new ContainerSchemaNodeBuilder(name, line, qname, schemaPath);
-
-        Builder parentBuilder = getActualNode();
-        builder.setParent(parentBuilder);
-        addChildToParent(parentBuilder, builder, qname.getLocalName());
-
-        return builder;
-    }
-
-    public ListSchemaNodeBuilder addListNode(final int line, final QName qname, final SchemaPath schemaPath) {
-        checkNotSealed();
-        final ListSchemaNodeBuilder builder = new ListSchemaNodeBuilder(name, line, qname, schemaPath);
-
-        Builder parentBuilder = getActualNode();
-        builder.setParent(parentBuilder);
-        addChildToParent(parentBuilder, builder, qname.getLocalName());
-        allLists.add(builder);
-
-        return builder;
-    }
-
-    public LeafSchemaNodeBuilder addLeafNode(final int line, final QName qname, final SchemaPath schemaPath) {
-        checkNotSealed();
-        final LeafSchemaNodeBuilder builder = new LeafSchemaNodeBuilder(name, line, qname, schemaPath);
-
-        Builder parentBuilder = getActualNode();
-        builder.setParent(parentBuilder);
-        addChildToParent(parentBuilder, builder, qname.getLocalName());
-
-        return builder;
-    }
-
-    public LeafListSchemaNodeBuilder addLeafListNode(final int line, final QName qname, final SchemaPath schemaPath) {
-        checkNotSealed();
-        final LeafListSchemaNodeBuilder builder = new LeafListSchemaNodeBuilder(name, line, qname, schemaPath);
-
-        Builder parentBuilder = getActualNode();
-        builder.setParent(parentBuilder);
-        addChildToParent(parentBuilder, builder, qname.getLocalName());
-
-        return builder;
-    }
-
-    public GroupingBuilder addGrouping(final int line, final QName qname, final SchemaPath path) {
-        checkNotSealed();
-        final GroupingBuilder builder = new GroupingBuilderImpl(name, line, qname, path);
-
-        Builder parentBuilder = getActualNode();
-        builder.setParent(parentBuilder);
-
-        String groupingName = qname.getLocalName();
-        if (parentBuilder.equals(this)) {
-            for (GroupingBuilder addedGrouping : getGroupingBuilders()) {
-                if (addedGrouping.getQName().getLocalName().equals(groupingName)) {
-                    raiseYangParserException("", GROUPING_STR, groupingName, line, addedGrouping.getLine());
-                }
-            }
-            addGrouping(builder);
-        } else {
-            if (parentBuilder instanceof DataNodeContainerBuilder) {
-                DataNodeContainerBuilder parentNode = (DataNodeContainerBuilder) parentBuilder;
-                for (GroupingBuilder addedGrouping : parentNode.getGroupingBuilders()) {
-                    if (addedGrouping.getQName().getLocalName().equals(groupingName)) {
-                        raiseYangParserException("", GROUPING_STR, groupingName, line, addedGrouping.getLine());
-                    }
-                }
-                parentNode.addGrouping(builder);
-            } else if (parentBuilder instanceof RpcDefinitionBuilder) {
-                RpcDefinitionBuilder parentNode = (RpcDefinitionBuilder) parentBuilder;
-                for (GroupingBuilder child : parentNode.getGroupings()) {
-                    if (child.getQName().getLocalName().equals(groupingName)) {
-                        raiseYangParserException("", GROUPING_STR, groupingName, line, child.getLine());
-                    }
-                }
-                parentNode.addGrouping(builder);
-            } else {
-                throw new YangParseException(name, line, "Unresolved parent of grouping " + groupingName);
-            }
-        }
-
-        allGroupings.add(builder);
-        return builder;
-    }
-
-    public AugmentationSchemaBuilder addAugment(final int line, final String augmentTargetStr,
-            final SchemaPath targetPath, final int order) {
-        checkNotSealed();
-        final AugmentationSchemaBuilder builder = new AugmentationSchemaBuilderImpl(name, line, augmentTargetStr,
-                targetPath, order);
-
-        Builder parentBuilder = getActualNode();
-        builder.setParent(parentBuilder);
-
-        if (parentBuilder.equals(this)) {
-            // augment can be declared only under 'module' ...
-            if (!(augmentTargetStr.startsWith("/"))) {
-                throw new YangParseException(
-                        name,
-                        line,
-                        "If the 'augment' statement is on the top level in a module, the absolute form of a schema node identifier MUST be used.");
-            }
-            augmentBuilders.add(builder);
-        } else {
-            // ... or 'uses' statement
-            if (parentBuilder instanceof UsesNodeBuilder) {
-                if (augmentTargetStr.startsWith("/")) {
-                    throw new YangParseException(name, line,
-                            "If 'augment' statement is a substatement to the 'uses' statement, it cannot contain absolute path ("
-                                    + augmentTargetStr + ")");
-                }
-                ((UsesNodeBuilder) parentBuilder).addAugment(builder);
-            } else {
-                throw new YangParseException(name, line, "Augment can be declared only under module or uses statement.");
-            }
-        }
-        allAugments.add(builder);
-
-        return builder;
-    }
-
-    public UsesNodeBuilder addUsesNode(final int line, final SchemaPath grouping) {
-        checkNotSealed();
-        final UsesNodeBuilder usesBuilder = new UsesNodeBuilderImpl(name, line, grouping);
-
-        Builder parentBuilder = getActualNode();
-        usesBuilder.setParent(parentBuilder);
-
-        if (parentBuilder.equals(this)) {
-            addUsesNode(usesBuilder);
-        } else {
-            if (!(parentBuilder instanceof DataNodeContainerBuilder)) {
-                throw new YangParseException(name, line, "Unresolved parent of uses '" + grouping + "'.");
-            }
-            ((DataNodeContainerBuilder) parentBuilder).addUsesNode(usesBuilder);
-        }
-        if (parentBuilder instanceof AugmentationSchemaBuilder) {
-            usesBuilder.setAugmenting(true);
-        }
-
-        allUsesNodes.add(usesBuilder);
-        return usesBuilder;
-    }
-
-    public void addRefine(final RefineHolderImpl refine) {
-        checkNotSealed();
-        final Builder parentBuilder = getActualNode();
-        if (!(parentBuilder instanceof UsesNodeBuilder)) {
-            throw new YangParseException(name, refine.getLine(), "refine can be defined only in uses statement");
-        }
-        ((UsesNodeBuilder) parentBuilder).addRefine(refine);
-        refine.setParent(parentBuilder);
-    }
-
-    public RpcDefinitionBuilder addRpc(final int line, final QName qname, final SchemaPath path) {
-        checkNotSealed();
-        Builder parentBuilder = getActualNode();
-        if (!(parentBuilder.equals(this))) {
-            throw new YangParseException(name, line, "rpc can be defined only in module or submodule");
-        }
-
-        final RpcDefinitionBuilder rpcBuilder = new RpcDefinitionBuilder(name, line, qname, path);
-        rpcBuilder.setParent(parentBuilder);
-
-        String rpcName = qname.getLocalName();
-        checkNotConflictingInDataNamespace(rpcName, line);
-        addedRpcs.add(rpcBuilder);
-        return rpcBuilder;
-    }
-
-    private void checkNotConflictingInDataNamespace(final String rpcName, final int line) {
-        for (DataSchemaNodeBuilder addedChild : getChildNodeBuilders()) {
-            if (addedChild.getQName().getLocalName().equals(rpcName)) {
-                raiseYangParserException("rpc", "node", rpcName, line, addedChild.getLine());
-            }
-        }
-        for (RpcDefinitionBuilder rpc : addedRpcs) {
-            if (rpc.getQName().getLocalName().equals(rpcName)) {
-                raiseYangParserException("", "rpc", rpcName, line, rpc.getLine());
-            }
-        }
-        for (NotificationBuilder addedNotification : addedNotifications) {
-            if (addedNotification.getQName().getLocalName().equals(rpcName)) {
-                raiseYangParserException("rpc", "notification", rpcName, line, addedNotification.getLine());
-            }
-        }
-    }
-
-    public ContainerSchemaNodeBuilder addRpcInput(final int line, final QName qname, final SchemaPath schemaPath) {
-        checkNotSealed();
-        final Builder parentBuilder = getActualNode();
-        if (!(parentBuilder instanceof RpcDefinitionBuilder)) {
-            throw new YangParseException(name, line, "input can be defined only in rpc statement");
-        }
-        final RpcDefinitionBuilder rpc = (RpcDefinitionBuilder) parentBuilder;
-
-        final ContainerSchemaNodeBuilder inputBuilder = new ContainerSchemaNodeBuilder(name, line, qname, schemaPath);
-        inputBuilder.setParent(rpc);
-
-        rpc.setInput(inputBuilder);
-        return inputBuilder;
-    }
-
-    public ContainerSchemaNodeBuilder addRpcOutput(final SchemaPath schemaPath, final QName qname, final int line) {
-        checkNotSealed();
-        final Builder parentBuilder = getActualNode();
-        if (!(parentBuilder instanceof RpcDefinitionBuilder)) {
-            throw new YangParseException(name, line, "output can be defined only in rpc statement");
-        }
-        final RpcDefinitionBuilder rpc = (RpcDefinitionBuilder) parentBuilder;
-
-        final ContainerSchemaNodeBuilder outputBuilder = new ContainerSchemaNodeBuilder(name, line, qname, schemaPath);
-        outputBuilder.setParent(rpc);
-
-        rpc.setOutput(outputBuilder);
-        return outputBuilder;
-    }
-
-    public void addNotification(final NotificationDefinition notification) {
-        checkNotSealed();
-        notifications.add(notification);
-    }
-
-    public NotificationBuilder addNotification(final int line, final QName qname, final SchemaPath path) {
-        checkNotSealed();
-        final Builder parentBuilder = getActualNode();
-        if (!(parentBuilder.equals(this))) {
-            throw new YangParseException(name, line, "notification can be defined only in module or submodule");
-        }
-
-        String notificationName = qname.getLocalName();
-        checkNotConflictingInDataNamespace(notificationName, line);
-
-        final NotificationBuilder builder = new NotificationBuilder(name, line, qname, path);
-        builder.setParent(parentBuilder);
-        addedNotifications.add(builder);
-
-        return builder;
-    }
-
-    public FeatureBuilder addFeature(final int line, final QName qname, final SchemaPath path) {
-        Builder parentBuilder = getActualNode();
-        if (!(parentBuilder.equals(this))) {
-            throw new YangParseException(name, line, "feature can be defined only in module or submodule");
-        }
-
-        final FeatureBuilder builder = new FeatureBuilder(name, line, qname, path);
-        builder.setParent(parentBuilder);
-
-        String featureName = qname.getLocalName();
-        for (FeatureBuilder addedFeature : addedFeatures) {
-            if (addedFeature.getQName().getLocalName().equals(featureName)) {
-                raiseYangParserException("", "feature", featureName, line, addedFeature.getLine());
-            }
-        }
-        addedFeatures.add(builder);
-        return builder;
-    }
-
-    public ChoiceBuilder addChoice(final int line, final QName qname, final SchemaPath path) {
-        final ChoiceBuilder builder = new ChoiceBuilder(name, line, qname, path);
-
-        Builder parentBuilder = getActualNode();
-        builder.setParent(parentBuilder);
-        addChildToParent(parentBuilder, builder, qname.getLocalName());
-
-        return builder;
-    }
-
-    public ChoiceCaseBuilder addCase(final int line, final QName qname, final SchemaPath path) {
-        Builder parentBuilder = getActualNode();
-        if (parentBuilder == null || parentBuilder.equals(this)) {
-            throw new YangParseException(name, line, "'case' parent not found");
-        }
-
-        final ChoiceCaseBuilder builder = new ChoiceCaseBuilder(name, line, qname, path);
-        builder.setParent(parentBuilder);
-
-        if (parentBuilder instanceof ChoiceBuilder) {
-            ((ChoiceBuilder) parentBuilder).addCase(builder);
-        } else if (parentBuilder instanceof AugmentationSchemaBuilder) {
-            ((AugmentationSchemaBuilder) parentBuilder).addChildNode(builder);
-        } else {
-            throw new YangParseException(name, line, "Unresolved parent of 'case' " + qname.getLocalName());
-        }
-
-        return builder;
-    }
-
-    public AnyXmlBuilder addAnyXml(final int line, final QName qname, final SchemaPath schemaPath) {
-        final AnyXmlBuilder builder = new AnyXmlBuilder(name, line, qname, schemaPath);
-
-        Builder parentBuilder = getActualNode();
-        builder.setParent(parentBuilder);
-        addChildToParent(parentBuilder, builder, qname.getLocalName());
-
-        return builder;
-    }
-
-    @Override
-    public void addTypedef(final TypeDefinitionBuilder typedefBuilder) {
-        String nodeName = typedefBuilder.getQName().getLocalName();
-        for (TypeDefinitionBuilder tdb : getTypeDefinitionBuilders()) {
-            if (tdb.getQName().getLocalName().equals(nodeName)) {
-                raiseYangParserException("", TYPEDEF_STR, nodeName, typedefBuilder.getLine(), tdb.getLine());
-            }
-        }
-        super.addTypedef(typedefBuilder);
-    }
-
-    public TypeDefinitionBuilderImpl addTypedef(final int line, final QName qname, final SchemaPath path) {
-        final TypeDefinitionBuilderImpl builder = new TypeDefinitionBuilderImpl(name, line, qname, path);
-
-        Builder parentBuilder = getActualNode();
-        builder.setParent(parentBuilder);
-
-        String typedefName = qname.getLocalName();
-        if (parentBuilder.equals(this)) {
-            addTypedef(builder);
-        } else {
-            if (parentBuilder instanceof DataNodeContainerBuilder) {
-                DataNodeContainerBuilder parentNode = (DataNodeContainerBuilder) parentBuilder;
-                for (TypeDefinitionBuilder child : parentNode.getTypeDefinitionBuilders()) {
-                    if (child.getQName().getLocalName().equals(typedefName)) {
-                        raiseYangParserException("", TYPEDEF_STR, typedefName, line, child.getLine());
-                    }
-                }
-                parentNode.addTypedef(builder);
-            } else if (parentBuilder instanceof RpcDefinitionBuilder) {
-                RpcDefinitionBuilder rpcParent = (RpcDefinitionBuilder) parentBuilder;
-                for (TypeDefinitionBuilder tdb : rpcParent.getTypeDefinitions()) {
-                    if (tdb.getQName().getLocalName().equals(builder.getQName().getLocalName())) {
-                        raiseYangParserException("", TYPEDEF_STR, typedefName, line, tdb.getLine());
-                    }
-                }
-                rpcParent.addTypedef(builder);
-            } else {
-                throw new YangParseException(name, line, "Unresolved parent of typedef " + typedefName);
-            }
-        }
-
-        return builder;
-    }
-
-    public void setType(final TypeDefinition<?> type) {
-        Builder parentBuilder = getActualNode();
-        if (!(parentBuilder instanceof TypeAwareBuilder)) {
-            throw new YangParseException("Failed to set type '" + type.getQName().getLocalName()
-                    + "'. Invalid parent node: " + parentBuilder);
-        }
-        ((TypeAwareBuilder) parentBuilder).setType(type);
-    }
-
-    public UnionTypeBuilder addUnionType(final int line, final QNameModule module) {
-        final Builder parentBuilder = getActualNode();
-        if (parentBuilder == null) {
-            throw new YangParseException(name, line, "Unresolved parent of union type");
-        } else {
-            final UnionTypeBuilder union = new UnionTypeBuilder(name, line);
-            if (parentBuilder instanceof TypeAwareBuilder) {
-                ((TypeAwareBuilder) parentBuilder).setTypedef(union);
-                return union;
-            } else {
-                throw new YangParseException(name, line, "Invalid parent of union type.");
-            }
-        }
-    }
-
-    public void addIdentityrefType(final int line, final SchemaPath schemaPath, final String baseString) {
-        final IdentityrefTypeBuilder identityref = new IdentityrefTypeBuilder(name, line, baseString, schemaPath);
-
-        final Builder parentBuilder = getActualNode();
-        if (parentBuilder == null) {
-            throw new YangParseException(name, line, "Unresolved parent of identityref type.");
-        } else {
-            if (parentBuilder instanceof TypeAwareBuilder) {
-                final TypeAwareBuilder typeParent = (TypeAwareBuilder) parentBuilder;
-                typeParent.setTypedef(identityref);
-                dirtyNodes.add(typeParent);
-            } else {
-                throw new YangParseException(name, line, "Invalid parent of identityref type.");
-            }
-        }
-    }
-
-    public DeviationBuilder addDeviation(final int line, final SchemaPath targetPath) {
-        Builder parentBuilder = getActualNode();
-        if (!(parentBuilder.equals(this))) {
-            throw new YangParseException(name, line, "deviation can be defined only in module or submodule");
-        }
-
-        final DeviationBuilder builder = new DeviationBuilder(name, line, targetPath);
-        builder.setParent(parentBuilder);
-        deviationBuilders.add(builder);
-        return builder;
-    }
-
-    public IdentitySchemaNodeBuilder addIdentity(final QName qname, final int line, final SchemaPath path) {
-        Builder parentBuilder = getActualNode();
-        if (!(parentBuilder.equals(this))) {
-            throw new YangParseException(name, line, "identity can be defined only in module or submodule");
-        }
-        String identityName = qname.getLocalName();
-        for (IdentitySchemaNodeBuilder idBuilder : addedIdentities) {
-            if (idBuilder.getQName().equals(qname)) {
-                raiseYangParserException("", "identity", identityName, line, idBuilder.getLine());
-            }
-        }
-
-        final IdentitySchemaNodeBuilder builder = new IdentitySchemaNodeBuilder(name, line, qname, path);
-        builder.setParent(parentBuilder);
-        addedIdentities.add(builder);
-        return builder;
-    }
-
-    @Override
-    public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder builder) {
-        addedUnknownNodes.add(builder);
-        allUnknownNodes.add(builder);
-    }
-
-    public UnknownSchemaNodeBuilderImpl addUnknownSchemaNode(final int line, final QName qname, final SchemaPath path) {
-        final Builder parentBuilder = getActualNode();
-        final UnknownSchemaNodeBuilderImpl builder = new UnknownSchemaNodeBuilderImpl(name, line, qname, path);
-        builder.setParent(parentBuilder);
-        allUnknownNodes.add(builder);
-
-        if (parentBuilder.equals(this)) {
-            addedUnknownNodes.add(builder);
-        } else {
-            if (parentBuilder instanceof SchemaNodeBuilder) {
-                parentBuilder.addUnknownNodeBuilder(builder);
-            } else if (parentBuilder instanceof DataNodeContainerBuilder) {
-                parentBuilder.addUnknownNodeBuilder(builder);
-            } else if (parentBuilder instanceof RefineHolderImpl) {
-                parentBuilder.addUnknownNodeBuilder(builder);
-            } else {
-                throw new YangParseException(name, line, "Unresolved parent of unknown node '" + qname.getLocalName()
-                        + "'");
-            }
-        }
-
-        return builder;
-    }
-
-    public Set<RpcDefinition> getRpcs() {
-        return rpcs;
-    }
-
-    public Set<RpcDefinitionBuilder> getAddedRpcs() {
-        return addedRpcs;
-    }
-
-    public Set<NotificationDefinition> getNotifications() {
-        return notifications;
-    }
-
-    public Set<NotificationBuilder> getAddedNotifications() {
-        return addedNotifications;
-    }
-
-    @Override
-    public String toString() {
-        return "module " + name;
-    }
-
-    public void setSource(final ByteSource byteSource) throws IOException {
-        setSource(byteSource.asCharSource(Charsets.UTF_8).read());
-    }
-
-    public void setSource(final String source) {
-        this.source = source;
-    }
-
-    /**
-     * Add child to parent. Method checks for duplicates and add given child
-     * node to parent. If node with same name is found, throws exception. If
-     * parent is null, child node will be added directly to module.
-     *
-     * @param parent
-     * @param child
-     * @param childName
-     */
-    private void addChildToParent(final Builder parent, final DataSchemaNodeBuilder child, final String childName) {
-        final int lineNum = child.getLine();
-        if (parent.equals(this)) {
-            addChildToModule(child, childName, lineNum);
-        } else {
-            addChildToSubnodeOfModule(parent, child, childName, lineNum);
-        }
-    }
-
-    public String getYangVersion() {
-        return yangVersion;
-    }
-
-    public String getContact() {
-        return contact;
-    }
-
-    public String getOrganization() {
-        return organization;
-    }
-
-    /**
-     * Adds child node <code>child</code> to the set of nodes child nodes.
-     *
-     * The method reduces the complexity of the method
-     * {@link #addChildToParent(Builder, DataSchemaNodeBuilder, String)
-     * addChildToParent}.
-     *
-     * @param child
-     *            data schema node builder for child node
-     * @param childName
-     *            string with name of child node
-     * @param lineNum
-     *            line number in YANG file where is the node with the name equal
-     *            to <code>childName</code> is defined
-     */
-    private void addChildToModule(final DataSchemaNodeBuilder child, final String childName, final int lineNum) {
-        // if parent == null => node is defined under module
-        // All leafs, leaf-lists, lists, containers, choices, rpcs,
-        // notifications, and anyxmls defined within a parent node or at the
-        // top level of the module or its submodules share the same
-        // identifier namespace.
-        for (DataSchemaNodeBuilder childNode : getChildNodeBuilders()) {
-            if (childNode.getQName().getLocalName().equals(childName)) {
-                raiseYangParserException("'" + child + "'", "node", childName, lineNum, childNode.getLine());
-            }
-        }
-        for (RpcDefinitionBuilder rpc : addedRpcs) {
-            if (rpc.getQName().getLocalName().equals(childName)) {
-                raiseYangParserException("'" + child + "'", "rpc", childName, lineNum, rpc.getLine());
-            }
-        }
-        for (NotificationBuilder notification : addedNotifications) {
-            if (notification.getQName().getLocalName().equals(childName)) {
-                raiseYangParserException("'" + child + "'", "notification", childName, lineNum, notification.getLine());
-            }
-        }
-        addChildNode(child);
-    }
-
-    /**
-     * Adds child node <code>child</code> to the group of child nodes of the
-     * <code>parent</code>
-     *
-     * The method reduces the complexity of the method
-     * {@link #addChildToParent(Builder, DataSchemaNodeBuilder, String)
-     * addChildToParent}. *
-     *
-     * @param parent
-     *            builder of node which is parent for <code>child</code>
-     * @param child
-     *            data schema node builder for child node
-     * @param childName
-     *            string with name of child node
-     * @param lineNum
-     *            line number in YANG file where is the node with the name equal
-     *            to <code>childName</code> is defined
-     */
-    private void addChildToSubnodeOfModule(final Builder parent, final DataSchemaNodeBuilder child,
-            final String childName, final int lineNum) {
-        // no need for checking rpc and notification because they can be
-        // defined only under module or submodule
-        if (parent instanceof DataNodeContainerBuilder) {
-            DataNodeContainerBuilder parentNode = (DataNodeContainerBuilder) parent;
-            for (DataSchemaNodeBuilder childNode : parentNode.getChildNodeBuilders()) {
-                if (childNode.getQName().getLocalName().equals(childName)) {
-                    raiseYangParserException("'" + child + "'", "node", childName, lineNum, childNode.getLine());
-                }
-            }
-            parentNode.addChildNode(child);
-        } else if (parent instanceof ChoiceBuilder) {
-            ChoiceBuilder parentNode = (ChoiceBuilder) parent;
-            for (ChoiceCaseBuilder caseBuilder : parentNode.getCases()) {
-                if (caseBuilder.getQName().getLocalName().equals(childName)) {
-                    raiseYangParserException("'" + child + "'", "node", childName, lineNum, caseBuilder.getLine());
-                }
-            }
-            parentNode.addCase(child);
-        } else {
-            throw new YangParseException(name, lineNum, "Unresolved parent of node '" + childName + "'.");
-        }
-    }
-
-    private void raiseYangParserException(final String cantAddType, final String type, final String name,
-            final int currentLine, final int duplicateLine) {
-
-        StringBuilder msgPrefix = new StringBuilder("");
-        if (cantAddType != null && !cantAddType.isEmpty()) {
-            msgPrefix.append("Can not add ");
-            msgPrefix.append(cantAddType);
-            msgPrefix.append(": ");
-        }
-
-        String msg = String.format("%s%s with same name '%s' already declared at line %d.", msgPrefix, type, name,
-                duplicateLine);
-        throw new YangParseException(getModuleName(), currentLine, msg);
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(name);
-        result = prime * result + qnameModule.hashCode();
-        result = prime * result + Objects.hashCode(prefix);
-
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ModuleBuilder other = (ModuleBuilder) obj;
-        if (name == null) {
-            if (other.name != null) {
-                return false;
-            }
-        } else if (!name.equals(other.name)) {
-            return false;
-        }
-        if (!qnameModule.equals(other.qnameModule)) {
-            return false;
-        }
-        if (prefix == null) {
-            if (other.prefix != null) {
-                return false;
-            }
-        } else if (!prefix.equals(other.prefix)) {
-            return false;
-        }
-        return true;
-    }
-
-    public List<UnknownSchemaNode> getExtensionInstances() {
-        return unknownNodes;
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ModuleImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/ModuleImpl.java
deleted file mode 100644 (file)
index 7b5255d..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (c) 2014, 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.builder.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.net.URI;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.NavigableSet;
-import java.util.Objects;
-import java.util.Set;
-import java.util.TreeSet;
-import org.opendaylight.yangtools.concepts.Immutable;
-import org.opendaylight.yangtools.concepts.SemVer;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.Deviation;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
-import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
-import org.opendaylight.yangtools.yang.parser.builder.util.Comparators;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class ModuleImpl extends AbstractDocumentedDataNodeContainer implements Module, Immutable {
-
-    private final QNameModule qnameModule;
-    private final String name;
-    private final String sourcePath;
-    private final String prefix;
-    private final String yangVersion;
-    private final String organization;
-    private final String contact;
-    private final Set<ModuleImport> imports;
-    private final Set<Module> submodules;
-    private final Set<FeatureDefinition> features;
-    private final Set<NotificationDefinition> notifications;
-    private final Set<AugmentationSchema> augmentations;
-    private final Set<RpcDefinition> rpcs;
-    private final Set<Deviation> deviations;
-    private final List<ExtensionDefinition> extensionNodes;
-    private final Set<IdentitySchemaNode> identities;
-    private final List<UnknownSchemaNode> unknownNodes;
-    private final String source;
-
-    /**
-     *
-     *
-     * <b>Note</b>Constructor has intentionality limited visibility to package, since
-     * this class should be only instantiated via builders.
-     *
-     * @param name
-     * @param sourcePath
-     * @param builder
-     */
-    ModuleImpl(final String name, final String sourcePath, final ModuleBuilder builder) {
-        super(builder);
-        this.name = checkNotNull(name, "Missing name");
-        this.sourcePath = sourcePath; //TODO: can this be nullable?
-        this.imports = ImmutableSet.copyOf(builder.imports.values());
-        this.submodules = ImmutableSet.copyOf(builder.submodules);
-        this.prefix = builder.getPrefix();
-
-        this.qnameModule = QNameModule.create(builder.getNamespace(),
-                builder.getRevision() == null ? null : new Date(builder.getRevision().getTime())).intern();
-        this.yangVersion = builder.getYangVersion();
-        this.organization = builder.getOrganization();
-        this.contact = builder.getContact();
-        this.features = toImmutableSortedSet(builder.getFeatures());
-        this.notifications = toImmutableSortedSet(builder.getNotifications());
-        this.augmentations = ImmutableSet.copyOf(builder.getAugments());
-        this.rpcs = toImmutableSortedSet(builder.getRpcs());
-        this.deviations = ImmutableSet.copyOf(builder.getDeviations());
-        this.extensionNodes = ImmutableList.copyOf(builder.getExtensions());
-        this.identities = ImmutableSet.copyOf(builder.getIdentities());
-        this.unknownNodes = ImmutableList.copyOf(builder.getExtensionInstances());
-        this.source = checkNotNull(builder.getSource(), "Missing source");
-
-    }
-
-    @Override
-    public String getModuleSourcePath() {
-        return sourcePath;
-    }
-
-    @Override
-    public URI getNamespace() {
-        return qnameModule.getNamespace();
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public Date getRevision() {
-        return qnameModule.getRevision();
-    }
-
-    @Override
-    public String getPrefix() {
-        return prefix;
-    }
-
-    @Override
-    public String getYangVersion() {
-        return yangVersion;
-    }
-
-    @Override
-    public String getOrganization() {
-        return organization;
-    }
-
-    @Override
-    public String getContact() {
-        return contact;
-    }
-
-    @Override
-    public Set<ModuleImport> getImports() {
-        return imports;
-    }
-
-    @Override
-    public Set<Module> getSubmodules() {
-        return submodules;
-    }
-
-    @Override
-    public Set<FeatureDefinition> getFeatures() {
-        return features;
-    }
-
-    @Override
-    public Set<NotificationDefinition> getNotifications() {
-        return notifications;
-    }
-
-    @Override
-    public Set<AugmentationSchema> getAugmentations() {
-        return augmentations;
-    }
-
-    @Override
-    public Set<RpcDefinition> getRpcs() {
-        return rpcs;
-    }
-
-    @Override
-    public Set<Deviation> getDeviations() {
-        return deviations;
-    }
-
-    @Override
-    public List<ExtensionDefinition> getExtensionSchemaNodes() {
-        return extensionNodes;
-    }
-
-    @Override
-    public Set<IdentitySchemaNode> getIdentities() {
-        return identities;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public String getSource() {
-        return source;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(name);
-        result = prime * result + Objects.hashCode(yangVersion);
-        result = prime * result + qnameModule.hashCode();
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ModuleImpl other = (ModuleImpl) obj;
-        if (name == null) {
-            if (other.name != null) {
-                return false;
-            }
-        } else if (!name.equals(other.name)) {
-            return false;
-        }
-        if (!qnameModule.equals(other.qnameModule)) {
-            return false;
-        }
-        if (yangVersion == null) {
-            if (other.yangVersion != null) {
-                return false;
-            }
-        } else if (!yangVersion.equals(other.yangVersion)) {
-            return false;
-        }
-        return true;
-    }
-
-    private static <T extends SchemaNode> Set<T> toImmutableSortedSet(final Set<T> original) {
-        NavigableSet<T> sorted = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-        sorted.addAll(original);
-        return Collections.unmodifiableSet(sorted);
-    }
-
-    @Override
-    public String toString() {
-        return ModuleImpl.class.getSimpleName() + "[" +
-                "name=" + name +
-                ", namespace=" + getNamespace() +
-                ", revision=" + getRevision() +
-                ", prefix=" + prefix +
-                ", yangVersion=" + yangVersion +
-                "]";
-    }
-
-    @Override
-    public QNameModule getQNameModule() {
-        return qnameModule;
-    }
-
-    @Override
-    public SemVer getSemanticVersion() {
-        return DEFAULT_SEMANTIC_VERSION;
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/NotificationBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/NotificationBuilder.java
deleted file mode 100644 (file)
index 9edcef9..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.ArrayList;
-import java.util.List;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class NotificationBuilder extends AbstractDocumentedDataNodeContainerBuilder implements SchemaNodeBuilder,
-AugmentationTargetBuilder {
-    private NotificationDefinitionImpl instance;
-    // SchemaNode args
-    private SchemaPath schemaPath;
-    // AugmentationTarget args
-    private final List<AugmentationSchema> augmentations = new ArrayList<>();
-    private final List<AugmentationSchemaBuilder> augmentationBuilders = new ArrayList<>();
-
-    NotificationBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-    }
-
-    NotificationBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path,
-            final NotificationDefinition base) {
-        super(moduleName, line, qname, path, base);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-
-        addedUnknownNodes.addAll(BuilderUtils.wrapUnknownNodes(moduleName, line, base.getUnknownSchemaNodes(), path,
-                qname));
-        augmentations.addAll(base.getAvailableAugmentations());
-
-    }
-
-    @Override
-    public NotificationDefinition build() {
-        if (!(getParent() instanceof ModuleBuilder)) {
-            throw new YangParseException(getModuleName(), getLine(),
-                    "Notification can be defined only under module (was " + getParent() + ")");
-        }
-        if (instance != null) {
-            return instance;
-        }
-        buildChildren();
-
-        instance = new NotificationDefinitionImpl(qname, schemaPath, this);
-
-        // AUGMENTATIONS
-        for (AugmentationSchemaBuilder builder : augmentationBuilders) {
-            augmentations.add(builder.build());
-        }
-        instance.augmentations = ImmutableSet.copyOf(augmentations);
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.schemaPath = path;
-    }
-
-    @Override
-    public void addAugmentation(final AugmentationSchemaBuilder augment) {
-        augmentationBuilders.add(augment);
-    }
-
-    @Override
-    public String toString() {
-        return "notification " + getQName().getLocalName();
-    }
-
-    @Override
-    protected String getStatementName() {
-        return "notification";
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/NotificationDefinitionImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/NotificationDefinitionImpl.java
deleted file mode 100644 (file)
index 92bcfce..0000000
+++ /dev/null
@@ -1,102 +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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class NotificationDefinitionImpl extends AbstractDocumentedDataNodeContainer implements NotificationDefinition {
-    private final QName qname;
-    private final SchemaPath path;
-    ImmutableSet<AugmentationSchema> augmentations;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-
-    NotificationDefinitionImpl(final QName qname, final SchemaPath path, final NotificationBuilder builder) {
-        super(builder);
-        // TODO Auto-generated constructor stub
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public Set<AugmentationSchema> getAvailableAugmentations() {
-        return augmentations;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final NotificationDefinitionImpl other = (NotificationDefinitionImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return NotificationDefinitionImpl.class.getSimpleName() + "[qname=" + qname + ", path=" + path + "]";
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RefineHolderImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RefineHolderImpl.java
deleted file mode 100644 (file)
index 2fe4395..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.parser.builder.api.RefineBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class RefineHolderImpl extends AbstractBuilder implements RefineBuilder {
-    private final String targetPathString;
-    private String defaultStr;
-    private String description;
-    private String reference;
-    private Boolean config;
-    private Boolean mandatory;
-    private Boolean presence;
-    private MustDefinition must;
-    private Integer minElements;
-    private Integer maxElements;
-
-    public RefineHolderImpl(final String moduleName, final int line, final String name) {
-        super(moduleName, line);
-        this.targetPathString = name;
-    }
-
-    @Override
-    public String getDefaultStr() {
-        return defaultStr;
-    }
-
-    public void setDefaultStr(final String defaultStr) {
-        this.defaultStr = defaultStr;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getDescription()
-     */
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setDescription(java.lang.String)
-     */
-    @Override
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getReference()
-     */
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setReference(java.lang.String)
-     */
-    @Override
-    public void setReference(final String reference) {
-        this.reference = reference;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#isConfiguration()
-     */
-    @Override
-    public Boolean isConfiguration() {
-        return config;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setConfiguration(java.lang.Boolean)
-     */
-    @Override
-    public void setConfiguration(final Boolean config) {
-        this.config = config;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#isMandatory()
-     */
-    @Override
-    public Boolean isMandatory() {
-        return mandatory;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMandatory(java.lang.Boolean)
-     */
-    @Override
-    public void setMandatory(final Boolean mandatory) {
-        this.mandatory = mandatory;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#isPresence()
-     */
-    @Override
-    public Boolean isPresence() {
-        return presence;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setPresence(java.lang.Boolean)
-     */
-    @Override
-    public void setPresence(final Boolean presence) {
-        this.presence = presence;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getMust()
-     */
-    @Override
-    public MustDefinition getMust() {
-        return must;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMust(org.opendaylight.yangtools.yang.model.api.MustDefinition)
-     */
-    @Override
-    public void setMust(final MustDefinition must) {
-        this.must = must;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getMinElements()
-     */
-    @Override
-    public Integer getMinElements() {
-        return minElements;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMinElements(java.lang.Integer)
-     */
-    @Override
-    public void setMinElements(final Integer minElements) {
-        this.minElements = minElements;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getMaxElements()
-     */
-    @Override
-    public Integer getMaxElements() {
-        return maxElements;
-    }
-
-    /* (non-Javadoc)
-     * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMaxElements(java.lang.Integer)
-     */
-    @Override
-    public void setMaxElements(final Integer maxElements) {
-        this.maxElements = maxElements;
-    }
-
-    @Override
-    public String toString() {
-        return "refine " + targetPathString;
-    }
-
-    @Override
-    public Status getStatus() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public void setStatus(final Status status) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(addedUnknownNodes);
-        result = prime * result + Objects.hashCode(config);
-        result = prime * result + Objects.hashCode(defaultStr);
-        result = prime * result + Objects.hashCode(description);
-        result = prime * result + Objects.hashCode(mandatory);
-        result = prime * result + Objects.hashCode(maxElements);
-        result = prime * result + Objects.hashCode(minElements);
-        result = prime * result + Objects.hashCode(must);
-        result = prime * result + Objects.hashCode(targetPathString);
-        result = prime * result + Objects.hashCode(getParent());
-        result = prime * result + Objects.hashCode(presence);
-        result = prime * result + Objects.hashCode(reference);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        RefineHolderImpl other = (RefineHolderImpl) obj;
-        if (addedUnknownNodes == null) {
-            if (other.addedUnknownNodes != null) {
-                return false;
-            }
-        } else if (!addedUnknownNodes.equals(other.addedUnknownNodes)) {
-            return false;
-        }
-        if (config == null) {
-            if (other.config != null) {
-                return false;
-            }
-        } else if (!config.equals(other.config)) {
-            return false;
-        }
-        if (defaultStr == null) {
-            if (other.defaultStr != null) {
-                return false;
-            }
-        } else if (!defaultStr.equals(other.defaultStr)) {
-            return false;
-        }
-        if (description == null) {
-            if (other.description != null) {
-                return false;
-            }
-        } else if (!description.equals(other.description)) {
-            return false;
-        }
-        if (mandatory == null) {
-            if (other.mandatory != null) {
-                return false;
-            }
-        } else if (!mandatory.equals(other.mandatory)) {
-            return false;
-        }
-        if (maxElements == null) {
-            if (other.maxElements != null) {
-                return false;
-            }
-        } else if (!maxElements.equals(other.maxElements)) {
-            return false;
-        }
-        if (minElements == null) {
-            if (other.minElements != null) {
-                return false;
-            }
-        } else if (!minElements.equals(other.minElements)) {
-            return false;
-        }
-        if (must == null) {
-            if (other.must != null) {
-                return false;
-            }
-        } else if (!must.equals(other.must)) {
-            return false;
-        }
-        if (targetPathString == null) {
-            if (other.targetPathString != null) {
-                return false;
-            }
-        } else if (!targetPathString.equals(other.targetPathString)) {
-            return false;
-        }
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        if (presence == null) {
-            if (other.presence != null) {
-                return false;
-            }
-        } else if (!presence.equals(other.presence)) {
-            return false;
-        }
-        if (reference == null) {
-            if (other.reference != null) {
-                return false;
-            }
-        } else if (!reference.equals(other.reference)) {
-            return false;
-        }
-        return true;
-    }
-
-
-
-    @Override
-    public Object build() {
-        // FIXME: Currently RefineBuilder.build() is not used
-        // build should returned refined element, so
-        // whole refine process is encapsulated in this refinement
-        // statement.
-        return null;
-    }
-
-    @Override
-    public String getTargetPathString() {
-        return targetPathString;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RefineUtils.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RefineUtils.java
deleted file mode 100644 (file)
index b3a0aa7..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import java.util.List;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DocumentedNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.RefineBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Utility class with helper methods to perform operations tied to refine
- * process.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class RefineUtils {
-
-    private RefineUtils() {
-    }
-
-    private static void refineLeaf(final LeafSchemaNodeBuilder leaf, final RefineBuilder refine) {
-        String defaultStr = refine.getDefaultStr();
-        Boolean mandatory = refine.isMandatory();
-        MustDefinition must = refine.getMust();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
-
-        if (defaultStr != null && !defaultStr.isEmpty()) {
-            leaf.setDefaultStr(defaultStr);
-        }
-        if (mandatory != null) {
-            leaf.getConstraints().setMandatory(mandatory);
-        }
-        if (must != null) {
-            leaf.getConstraints().addMustDefinition(must);
-        }
-        if (unknownNodes != null) {
-            for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                unknown.setParent(leaf);
-                leaf.addUnknownNodeBuilder(unknown);
-            }
-        }
-    }
-
-    private static void refineContainer(final ContainerSchemaNodeBuilder container, final RefineBuilder refine) {
-        Boolean presence = refine.isPresence();
-        MustDefinition must = refine.getMust();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
-
-        if (presence != null) {
-            container.setPresence(presence);
-        }
-        if (must != null) {
-            container.getConstraints().addMustDefinition(must);
-        }
-        if (unknownNodes != null) {
-            for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                unknown.setParent(container);
-                container.addUnknownNodeBuilder(unknown);
-            }
-        }
-    }
-
-    private static void refineList(final ListSchemaNodeBuilder list, final RefineBuilder refine) {
-        MustDefinition must = refine.getMust();
-        Integer min = refine.getMinElements();
-        Integer max = refine.getMaxElements();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
-
-        if (must != null) {
-            list.getConstraints().addMustDefinition(must);
-        }
-        if (min != null) {
-            list.getConstraints().setMinElements(min);
-        }
-        if (max != null) {
-            list.getConstraints().setMaxElements(max);
-        }
-        if (unknownNodes != null) {
-            for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                unknown.setParent(list);
-                list.addUnknownNodeBuilder(unknown);
-            }
-        }
-    }
-
-    public static void refineLeafList(final LeafListSchemaNodeBuilder leafList, final RefineBuilder refine) {
-        MustDefinition must = refine.getMust();
-        Integer min = refine.getMinElements();
-        Integer max = refine.getMaxElements();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
-
-        if (must != null) {
-            leafList.getConstraints().addMustDefinition(must);
-        }
-        if (min != null) {
-            leafList.getConstraints().setMinElements(min);
-        }
-        if (max != null) {
-            leafList.getConstraints().setMaxElements(max);
-        }
-        if (unknownNodes != null) {
-            for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                unknown.setParent(leafList);
-                leafList.addUnknownNodeBuilder(unknown);
-            }
-        }
-    }
-
-    public static void refineChoice(final ChoiceBuilder choice, final RefineBuilder refine) {
-        String defaultStr = refine.getDefaultStr();
-        Boolean mandatory = refine.isMandatory();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
-
-        if (defaultStr != null) {
-            choice.setDefaultCase(defaultStr);
-        }
-        if (mandatory != null) {
-            choice.getConstraints().setMandatory(mandatory);
-        }
-        if (unknownNodes != null) {
-            for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                unknown.setParent(choice);
-                choice.addUnknownNodeBuilder(unknown);
-            }
-        }
-    }
-
-    public static void refineAnyxml(final AnyXmlBuilder anyXml, final RefineBuilder refine) {
-        Boolean mandatory = refine.isMandatory();
-        MustDefinition must = refine.getMust();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
-
-        if (mandatory != null) {
-            anyXml.getConstraints().setMandatory(mandatory);
-        }
-        if (must != null) {
-            anyXml.getConstraints().addMustDefinition(must);
-        }
-        if (unknownNodes != null) {
-            for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                unknown.setParent(anyXml);
-                anyXml.addUnknownNodeBuilder(unknown);
-            }
-        }
-    }
-
-    /**
-     * Check if refine can be performed on given node.
-     *
-     * @param node
-     *            node to refine
-     * @param refine
-     *            refine object containing information about refine process
-     */
-    private static void checkRefine(final SchemaNodeBuilder node, final RefineBuilder refine) {
-        String moduleName = refine.getModuleName();
-        int line = refine.getLine();
-        String name = node.getQName().getLocalName();
-
-        String defaultStr = refine.getDefaultStr();
-        Boolean mandatory = refine.isMandatory();
-        Boolean presence = refine.isPresence();
-        MustDefinition must = refine.getMust();
-        Integer min = refine.getMinElements();
-        Integer max = refine.getMaxElements();
-
-        if (node instanceof AnyXmlBuilder) {
-            checkRefineDefault(node, defaultStr, moduleName, line);
-            checkRefinePresence(node, presence, moduleName, line);
-            checkRefineMinMax(name, min, max, moduleName, line);
-        } else if (node instanceof ChoiceBuilder) {
-            checkRefinePresence(node, presence, moduleName, line);
-            checkRefineMust(node, must, moduleName, line);
-            checkRefineMinMax(name, min, max, moduleName, line);
-        } else if (node instanceof ContainerSchemaNodeBuilder) {
-            checkRefineDefault(node, defaultStr, moduleName, line);
-            checkRefineMandatory(node, mandatory, moduleName, line);
-            checkRefineMinMax(name, min, max, moduleName, line);
-        } else if (node instanceof LeafSchemaNodeBuilder) {
-            checkRefinePresence(node, presence, moduleName, line);
-            checkRefineMinMax(name, min, max, moduleName, line);
-        } else if (node instanceof LeafListSchemaNodeBuilder || node instanceof ListSchemaNodeBuilder) {
-            checkRefineDefault(node, defaultStr, moduleName, line);
-            checkRefinePresence(node, presence, moduleName, line);
-            checkRefineMandatory(node, mandatory, moduleName, line);
-        } else if (node instanceof GroupingBuilder || node instanceof TypeDefinitionBuilder
-                || node instanceof UsesNodeBuilder) {
-            checkRefineDefault(node, defaultStr, moduleName, line);
-            checkRefinePresence(node, presence, moduleName, line);
-            checkRefineMandatory(node, mandatory, moduleName, line);
-            checkRefineMust(node, must, moduleName, line);
-            checkRefineMinMax(name, min, max, moduleName, line);
-        }
-    }
-
-    private static void checkRefineDefault(final SchemaNodeBuilder node, final String defaultStr, final String moduleName, final int line) {
-        if (defaultStr != null) {
-            throw new YangParseException(moduleName, line, "Can not refine 'default' for '"
-                    + node.getQName().getLocalName() + "'.");
-        }
-    }
-
-    private static void checkRefineMandatory(final SchemaNodeBuilder node, final Boolean mandatory, final String moduleName, final int line) {
-        if (mandatory != null) {
-            throw new YangParseException(moduleName, line, "Can not refine 'mandatory' for '"
-                    + node.getQName().getLocalName() + "'.");
-        }
-    }
-
-    private static void checkRefinePresence(final SchemaNodeBuilder node, final Boolean presence, final String moduleName, final int line) {
-        if (presence != null) {
-            throw new YangParseException(moduleName, line, "Can not refine 'presence' for '"
-                    + node.getQName().getLocalName() + "'.");
-        }
-    }
-
-    private static void checkRefineMust(final SchemaNodeBuilder node, final MustDefinition must, final String moduleName, final int line) {
-        if (must != null) {
-            throw new YangParseException(moduleName, line, "Can not refine 'must' for '"
-                    + node.getQName().getLocalName() + "'.");
-        }
-    }
-
-    private static void checkRefineMinMax(final String refineTargetName, final Integer min, final Integer max, final String moduleName, final int line) {
-        if (min != null || max != null) {
-            throw new YangParseException(moduleName, line, "Can not refine 'min-elements' or 'max-elements' for '"
-                    + refineTargetName + "'.");
-        }
-    }
-
-    /**
-     * Perform refine operation of following parameters:
-     * <ul>
-     * <li>description</li>
-     * <li>reference</li>
-     * <li>config</li>
-     * </ul>
-     *
-     * These parameters may be refined for any node.
-     *
-     * @param node
-     *            node to refine
-     * @param refine
-     *            refine object containing information about refine process
-     */
-    private static void refineDefault(final Builder node, final RefineBuilder refine) {
-        final String moduleName = refine.getModuleName();
-        final int line = refine.getLine();
-
-
-        final DocumentedNodeBuilder documentedNode;
-        if (node instanceof DocumentedNodeBuilder) {
-            documentedNode = ((DocumentedNodeBuilder) node);
-        } else {
-            documentedNode = null;
-        }
-
-        String description = refine.getDescription();
-
-
-        if (description != null) {
-            if (documentedNode != null) {
-                documentedNode.setDescription(description);
-            } else {
-                throw new YangParseException(moduleName, line, String.format("Cannot refine description in of target %s",refine.getTargetPathString()));
-            }
-
-        }
-
-        String reference = refine.getReference();
-        if (reference != null) {
-            if (documentedNode != null) {
-                documentedNode.setReference(reference);
-            } else {
-                throw new YangParseException(moduleName, line, String.format("Cannot refine reference in of target %s",refine.getTargetPathString()));
-            }
-        }
-
-        Boolean config = refine.isConfiguration();
-        if (config != null) {
-            if (node instanceof DataSchemaNodeBuilder) {
-                ((DataSchemaNodeBuilder) node).setConfiguration(config);
-            } else {
-                throw new YangParseException(moduleName, line, String.format("Cannot refine config of target %s ",refine.getTargetPathString()));
-            }
-        }
-    }
-
-    /**
-     * Perform refine operation on given node.
-     *
-     * @param nodeToRefine
-     *            builder of node to refine
-     * @param refine
-     *            refine object containing information about refine process
-     */
-    static void performRefine(final SchemaNodeBuilder nodeToRefine, final RefineBuilder refine) {
-        checkRefine(nodeToRefine, refine);
-        refineDefault(nodeToRefine, refine);
-        if (nodeToRefine instanceof LeafSchemaNodeBuilder) {
-            refineLeaf((LeafSchemaNodeBuilder) nodeToRefine, refine);
-        } else if (nodeToRefine instanceof ContainerSchemaNodeBuilder) {
-            refineContainer((ContainerSchemaNodeBuilder) nodeToRefine, refine);
-        } else if (nodeToRefine instanceof ListSchemaNodeBuilder) {
-            refineList((ListSchemaNodeBuilder) nodeToRefine, refine);
-        } else if (nodeToRefine instanceof LeafListSchemaNodeBuilder) {
-            refineLeafList((LeafListSchemaNodeBuilder) nodeToRefine, refine);
-        } else if (nodeToRefine instanceof ChoiceBuilder) {
-            refineChoice((ChoiceBuilder) nodeToRefine, refine);
-        } else if (nodeToRefine instanceof AnyXmlBuilder) {
-            refineAnyxml((AnyXmlBuilder) nodeToRefine, refine);
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RpcDefinitionBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RpcDefinitionBuilder.java
deleted file mode 100644 (file)
index 1835e84..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-import java.util.TreeSet;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.Comparators;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class RpcDefinitionBuilder extends AbstractSchemaNodeBuilder {
-    private RpcDefinitionImpl instance;
-    private ContainerSchemaNodeBuilder inputBuilder;
-    private ContainerSchemaNodeBuilder outputBuilder;
-    private final Set<TypeDefinitionBuilder> addedTypedefs = new HashSet<>();
-    private final Set<GroupingBuilder> addedGroupings = new HashSet<>();
-
-    RpcDefinitionBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-    }
-
-    public ContainerSchemaNodeBuilder getInput() {
-        return inputBuilder;
-    }
-
-    public ContainerSchemaNodeBuilder getOutput() {
-        return outputBuilder;
-    }
-
-    @Override
-    public RpcDefinition build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new RpcDefinitionImpl(qname, schemaPath);
-
-        final ContainerSchemaNode input = inputBuilder == null ? null : inputBuilder.build();
-        final ContainerSchemaNode output = outputBuilder == null ? null : outputBuilder.build();
-        instance.setInput(input);
-        instance.setOutput(output);
-
-        instance.description = description;
-        instance.reference = reference;
-        instance.status = status;
-
-        // TYPEDEFS
-        final Set<TypeDefinition<?>> typedefs = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-        for (TypeDefinitionBuilder entry : addedTypedefs) {
-            typedefs.add(entry.build());
-        }
-        instance.typeDefinitions = ImmutableSet.copyOf(typedefs);
-
-        // GROUPINGS
-        final Set<GroupingDefinition> groupings = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-        for (GroupingBuilder builder : addedGroupings) {
-            groupings.add(builder.build());
-        }
-        instance.groupings = ImmutableSet.copyOf(groupings);
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    void setInput(final ContainerSchemaNodeBuilder inputBuilder) {
-        this.inputBuilder = inputBuilder;
-    }
-
-    void setOutput(final ContainerSchemaNodeBuilder outputBuilder) {
-        this.outputBuilder = outputBuilder;
-    }
-
-    public Set<TypeDefinitionBuilder> getTypeDefinitions() {
-        return addedTypedefs;
-    }
-
-    public void addTypedef(final TypeDefinitionBuilder type) {
-        addedTypedefs.add(type);
-    }
-
-    public Set<GroupingBuilder> getGroupings() {
-        return addedGroupings;
-    }
-
-    public void addGrouping(final GroupingBuilder grouping) {
-        addedGroupings.add(grouping);
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof RpcDefinitionBuilder)) {
-            return false;
-        }
-        final RpcDefinitionBuilder other = (RpcDefinitionBuilder) obj;
-        if (other.qname == null) {
-            if (this.qname != null) {
-                return false;
-            }
-        } else if (!other.qname.equals(this.qname)) {
-            return false;
-        }
-        if (other.schemaPath == null) {
-            if (this.schemaPath != null) {
-                return false;
-            }
-        } else if (!other.schemaPath.equals(this.schemaPath)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "rpc " + qname.getLocalName();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RpcDefinitionImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/RpcDefinitionImpl.java
deleted file mode 100644 (file)
index aa052c2..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class RpcDefinitionImpl implements RpcDefinition {
-    private final QName qname;
-    private final SchemaPath path;
-    String description;
-    String reference;
-    Status status;
-    private ContainerSchemaNode input;
-    private ContainerSchemaNode output;
-    ImmutableSet<TypeDefinition<?>> typeDefinitions;
-    ImmutableSet<GroupingDefinition> groupings;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-
-    RpcDefinitionImpl(final QName qname, final SchemaPath path) {
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public ContainerSchemaNode getInput() {
-        return input;
-    }
-
-    void setInput(final ContainerSchemaNode input) {
-        this.input = input;
-    }
-
-    @Override
-    public ContainerSchemaNode getOutput() {
-        return output;
-    }
-
-    void setOutput(final ContainerSchemaNode output) {
-        this.output = output;
-    }
-
-    @Override
-    public Set<TypeDefinition<?>> getTypeDefinitions() {
-        return typeDefinitions;
-    }
-
-    @Override
-    public Set<GroupingDefinition> getGroupings() {
-        return groupings;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final RpcDefinitionImpl other = (RpcDefinitionImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return RpcDefinitionImpl.class.getSimpleName() + "[" +
-                "qname=" +
-                qname +
-                ", path=" +
-                path +
-                ", input=" +
-                input +
-                ", output=" +
-                output +
-                "]";
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/TypeDefinitionBuilderImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/TypeDefinitionBuilderImpl.java
deleted file mode 100644 (file)
index a131d9f..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractTypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.Comparators;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class TypeDefinitionBuilderImpl extends AbstractTypeAwareBuilder implements TypeDefinitionBuilder {
-    private SchemaPath schemaPath;
-    private List<RangeConstraint> ranges = Collections.emptyList();
-    private List<LengthConstraint> lengths = Collections.emptyList();
-    private List<PatternConstraint> patterns = Collections.emptyList();
-    private Integer fractionDigits = null;
-
-    private String description;
-    private String reference;
-    private Status status = Status.CURRENT;
-    private String units;
-    private Object defaultValue;
-    private boolean addedByUses;
-
-    public TypeDefinitionBuilderImpl(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line, qname);
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-    }
-
-    public TypeDefinitionBuilderImpl(final String moduleName, final int line, final QName qname, final SchemaPath path, final ExtendedType base) {
-        super(moduleName, line, base.getQName());
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-
-        this.type = base.getBaseType();
-        this.description = base.getDescription();
-        this.reference = base.getReference();
-        this.status = base.getStatus();
-        this.units = base.getUnits();
-        this.defaultValue = base.getDefaultValue();
-
-        this.addedByUses = base.isAddedByUses();
-        this.ranges = base.getRangeConstraints();
-        this.lengths = base.getLengthConstraints();
-        this.patterns = base.getPatternConstraints();
-        this.fractionDigits = base.getFractionDigits();
-        this.unknownNodes.addAll(base.getUnknownSchemaNodes());
-    }
-
-    @Override
-    public TypeDefinition<? extends TypeDefinition<?>> build() {
-        TypeDefinition<?> result;
-        ExtendedType.Builder typeBuilder;
-        if (type == null) {
-            if (typedef == null) {
-                throw new YangParseException("Unresolved type: '" + qname.getLocalName() + "'.");
-            } else {
-                type = typedef.build();
-            }
-        }
-
-        typeBuilder = ExtendedType.builder(qname, type, Optional.fromNullable(description),
-                Optional.fromNullable(reference), schemaPath);
-        typeBuilder.status(status);
-        typeBuilder.units(units);
-        typeBuilder.defaultValue(defaultValue);
-        typeBuilder.addedByUses(addedByUses);
-        typeBuilder.ranges(ranges);
-        typeBuilder.lengths(lengths);
-        typeBuilder.patterns(patterns);
-        typeBuilder.fractionDigits(fractionDigits);
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        Collections.sort(unknownNodes, Comparators.SCHEMA_NODE_COMP);
-        typeBuilder.unknownSchemaNodes(unknownNodes);
-        result = typeBuilder.build();
-        return result;
-    }
-
-    @Override
-    public void setQName(final QName qname) {
-        this.qname = qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.schemaPath = path;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public void setReference(final String reference) {
-        this.reference = reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public void setStatus(final Status status) {
-        if (status != null) {
-            this.status = status;
-        }
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public String getUnits() {
-        return units;
-    }
-
-    @Override
-    public void setUnits(final String units) {
-        this.units = units;
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return defaultValue;
-    }
-
-    @Override
-    public void setDefaultValue(final Object defaultValue) {
-        this.defaultValue = defaultValue;
-    }
-
-    @Override
-    public List<RangeConstraint> getRanges() {
-        return ranges;
-    }
-
-    @Override
-    public void setRanges(final List<RangeConstraint> ranges) {
-        if (ranges != null) {
-            this.ranges = ranges;
-        }
-    }
-
-    @Override
-    public List<LengthConstraint> getLengths() {
-        return lengths;
-    }
-
-    @Override
-    public void setLengths(final List<LengthConstraint> lengths) {
-        if (lengths != null) {
-            this.lengths = lengths;
-        }
-    }
-
-    @Override
-    public List<PatternConstraint> getPatterns() {
-        return patterns;
-    }
-
-    @Override
-    public void setPatterns(final List<PatternConstraint> patterns) {
-        if (patterns != null) {
-            this.patterns = patterns;
-        }
-    }
-
-    @Override
-    public Integer getFractionDigits() {
-        return fractionDigits;
-    }
-
-    @Override
-    public void setFractionDigits(final Integer fractionDigits) {
-        this.fractionDigits = fractionDigits;
-    }
-
-    @Override
-    public String toString() {
-        return "typedef " + qname.getLocalName();
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + Objects.hashCode(schemaPath);
-
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        TypeDefinitionBuilderImpl other = (TypeDefinitionBuilderImpl) obj;
-
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-
-        return true;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/TypeUtils.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/TypeUtils.java
deleted file mode 100644 (file)
index a9c0816..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import static org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils.findBaseIdentity;
-import java.net.URI;
-import java.util.Date;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.DecimalTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.util.TypeConstraints;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Utility class which contains helper methods for dealing with type operations.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class TypeUtils {
-
-    private TypeUtils() {
-    }
-
-    /**
-     * Resolve unknown type of node. It is assumed that type of node is either
-     * UnknownType or ExtendedType with UnknownType as base type.
-     *
-     * @param nodeToResolve
-     *            node with type to resolve
-     * @param modules
-     *            all loaded modules
-     * @param module
-     *            current module
-     */
-    public static void resolveType(final TypeAwareBuilder nodeToResolve,
-            final Map<URI, NavigableMap<Date, ModuleBuilder>> modules, final ModuleBuilder module) {
-        QName unknownTypeQName = nodeToResolve.getTypeQName();
-        final ModuleBuilder dependentModuleBuilder = BuilderUtils.findModule(unknownTypeQName, modules);
-        if (dependentModuleBuilder == null) {
-            throw new YangParseException(module.getName(), nodeToResolve.getLine(), "Type not found: "
-                    + unknownTypeQName);
-        }
-        TypeDefinitionBuilder resolvedType = findUnknownTypeDefinition(nodeToResolve, dependentModuleBuilder, modules,
-                module);
-        nodeToResolve.setTypedef(resolvedType);
-    }
-
-    /**
-     * Resolve union type which contains one or more unresolved types.
-     *
-     * @param union
-     *            union type builder to resolve
-     * @param modules
-     *            all loaded modules
-     * @param module
-     *            current module
-     */
-    public static void resolveTypeUnion(final UnionTypeBuilder union,
-            final Map<URI, NavigableMap<Date, ModuleBuilder>> modules, final ModuleBuilder module) {
-        // special handling for identityref types under union
-        for (TypeDefinitionBuilder unionType : union.getTypedefs()) {
-            if (unionType instanceof IdentityrefTypeBuilder) {
-                IdentityrefTypeBuilder idref = (IdentityrefTypeBuilder) unionType;
-                IdentitySchemaNodeBuilder identity = findBaseIdentity(module, idref.getBaseString(),
-                        idref.getLine());
-                if (identity == null) {
-                    throw new YangParseException(module.getName(), idref.getLine(), "Failed to find base identity");
-                }
-                idref.setBaseIdentity(identity);
-            }
-        }
-        for (QName unknownTypeQName : union.getBaseTypeQNames()) {
-            final ModuleBuilder dependentModuleBuilder = BuilderUtils.findModule(unknownTypeQName, modules);
-            if (dependentModuleBuilder == null) {
-                throw new YangParseException(module.getName(), union.getLine(), "Type not found: " + unknownTypeQName);
-            }
-
-            final TypeDefinitionBuilder targetTypeBuilder = findTypeDefinitionBuilder(union, dependentModuleBuilder,
-                    unknownTypeQName.getLocalName(), module.getName(), union.getLine());
-            union.setTypedef(targetTypeBuilder);
-        }
-    }
-
-    /**
-     * Find type definition of type of unresolved node.
-     *
-     * @param nodeToResolve
-     *            node with unresolved type
-     * @param dependentModuleBuilder
-     *            module in which type definition is present
-     * @param modules
-     *            all loaded modules
-     * @param module
-     *            current module
-     * @return TypeDefinitionBuilder of node type
-     */
-    private static TypeDefinitionBuilder findUnknownTypeDefinition(final TypeAwareBuilder nodeToResolve,
-            final ModuleBuilder dependentModuleBuilder, final Map<URI, NavigableMap<Date, ModuleBuilder>> modules,
-            final ModuleBuilder module) {
-        final int line = nodeToResolve.getLine();
-        final QName unknownTypeQName = nodeToResolve.getTypeQName();
-        final TypeDefinitionBuilder targetTypeBuilder = findTypeDefinitionBuilder(nodeToResolve,
-                dependentModuleBuilder, unknownTypeQName.getLocalName(), module.getName(), line);
-
-        // validate constraints
-        final TypeConstraints constraints = findConstraintsFromTypeBuilder(nodeToResolve,
-                new TypeConstraints(module.getName(), nodeToResolve.getLine()), modules, module);
-        constraints.validateConstraints();
-
-        return targetTypeBuilder;
-    }
-
-    /**
-     * Search types for type with given name.
-     *
-     * @param types
-     *            types to search
-     * @param name
-     *            name of type
-     * @return type with given name if present in collection, null otherwise
-     */
-    private static TypeDefinitionBuilder findTypedefBuilderByName(final Set<TypeDefinitionBuilder> types, final String name) {
-        for (TypeDefinitionBuilder td : types) {
-            if (td.getQName().getLocalName().equals(name)) {
-                return td;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Pull restriction from type and add them to constraints.
-     *
-     * @param type
-     *            type from which constraints will be read
-     * @param constraints
-     *            constraints object to which constraints will be added
-     */
-    private static TypeConstraints mergeConstraints(final TypeDefinition<?> type, final TypeConstraints constraints) {
-        if (type instanceof DecimalTypeDefinition) {
-            constraints.addRanges(((DecimalTypeDefinition) type).getRangeConstraints());
-            constraints.addFractionDigits(((DecimalTypeDefinition) type).getFractionDigits());
-        } else if (type instanceof IntegerTypeDefinition) {
-            constraints.addRanges(((IntegerTypeDefinition) type).getRangeConstraints());
-        } else if (type instanceof UnsignedIntegerTypeDefinition) {
-            constraints.addRanges(((UnsignedIntegerTypeDefinition) type).getRangeConstraints());
-        } else if (type instanceof StringTypeDefinition) {
-            constraints.addPatterns(((StringTypeDefinition) type).getPatternConstraints());
-            constraints.addLengths(((StringTypeDefinition) type).getLengthConstraints());
-        } else if (type instanceof BinaryTypeDefinition) {
-            constraints.addLengths(((BinaryTypeDefinition) type).getLengthConstraints());
-        } else if (type instanceof ExtendedType) {
-            constraints.addFractionDigits(((ExtendedType) type).getFractionDigits());
-            constraints.addLengths(((ExtendedType) type).getLengthConstraints());
-            constraints.addPatterns(((ExtendedType) type).getPatternConstraints());
-            constraints.addRanges(((ExtendedType) type).getRangeConstraints());
-        }
-        return constraints;
-    }
-
-    private static TypeConstraints findConstraintsFromTypeBuilder(final TypeAwareBuilder nodeToResolve,
-            final TypeConstraints constraints, final Map<URI, NavigableMap<Date, ModuleBuilder>> modules,
-            final ModuleBuilder builder) {
-
-        // union and identityref types cannot be restricted
-        if (nodeToResolve instanceof UnionTypeBuilder || nodeToResolve instanceof IdentityrefTypeBuilder) {
-            return constraints;
-        }
-
-        if (nodeToResolve instanceof TypeDefinitionBuilder) {
-            TypeDefinitionBuilder typedefToResolve = (TypeDefinitionBuilder) nodeToResolve;
-            constraints.addFractionDigits(typedefToResolve.getFractionDigits());
-            constraints.addLengths(typedefToResolve.getLengths());
-            constraints.addPatterns(typedefToResolve.getPatterns());
-            constraints.addRanges(typedefToResolve.getRanges());
-        }
-
-        TypeDefinition<?> type = nodeToResolve.getType();
-        if (type == null) {
-            final QName unknownTypeQName = nodeToResolve.getTypeQName();
-            if (unknownTypeQName == null) {
-                return constraints;
-            }
-            final ModuleBuilder dependentModuleBuilder = BuilderUtils.findModule(unknownTypeQName, modules);
-            final TypeDefinitionBuilder targetTypeBuilder = findTypeDefinitionBuilder(nodeToResolve,
-                    dependentModuleBuilder, unknownTypeQName.getLocalName(), builder.getName(), 0);
-            return findConstraintsFromTypeBuilder(targetTypeBuilder, constraints, modules, dependentModuleBuilder);
-        } else {
-            if (type instanceof ExtendedType) {
-                mergeConstraints(type, constraints);
-                // it has to be base yang type
-                return mergeConstraints(type, constraints);
-            } else {
-                // it is base yang type
-                return mergeConstraints(type, constraints);
-            }
-        }
-    }
-
-    /**
-     * Search for type definition builder by name.
-     *
-     * @param nodeToResolve
-     *            node which contains unresolved type
-     * @param dependentModule
-     *            module which should contains referenced type
-     * @param typeName
-     *            name of type definition
-     * @param currentModuleName
-     *            name of current module
-     * @param line
-     *            current line in module
-     * @return typeDefinitionBuilder
-     */
-    private static TypeDefinitionBuilder findTypeDefinitionBuilder(final TypeAwareBuilder nodeToResolve,
-            final ModuleBuilder dependentModule, final String typeName, final String currentModuleName, final int line) {
-        Set<TypeDefinitionBuilder> typedefs = dependentModule.getTypeDefinitionBuilders();
-        TypeDefinitionBuilder result = findTypedefBuilderByName(typedefs, typeName);
-        if (result != null) {
-            return result;
-        }
-
-        Builder parent = nodeToResolve.getParent();
-        while (parent != null) {
-            if (parent instanceof DataNodeContainerBuilder) {
-                typedefs = ((DataNodeContainerBuilder) parent).getTypeDefinitionBuilders();
-            } else if (parent instanceof RpcDefinitionBuilder) {
-                typedefs = ((RpcDefinitionBuilder) parent).getTypeDefinitions();
-            }
-            result = findTypedefBuilderByName(typedefs, typeName);
-            if (result == null) {
-                parent = parent.getParent();
-            } else {
-                break;
-            }
-        }
-
-        if (result == null) {
-            throw new YangParseException(currentModuleName, line, "Referenced type '" + typeName + "' not found.");
-        }
-        return result;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnionTypeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnionTypeBuilder.java
deleted file mode 100644 (file)
index 023b24b..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
-import org.opendaylight.yangtools.yang.model.util.BaseTypes;
-import org.opendaylight.yangtools.yang.model.util.UnionType;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractTypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Builder for YANG union type. User can add type to this union as
- * TypeDefinition object (resolved type) or in form of TypeDefinitionBuilder.
- * When build is called, types in builder form will be built and add to resolved
- * types.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class UnionTypeBuilder extends AbstractTypeAwareBuilder implements TypeDefinitionBuilder {
-    private static final SchemaPath SCHEMA_PATH = SchemaPath.create(true, BaseTypes.UNION_QNAME);
-    private static final String NAME = "union";
-
-    private final List<TypeDefinition<?>> types;
-    private final List<TypeDefinitionBuilder> typedefs;
-    private UnionType instance;
-    private boolean isBuilt;
-
-    private final List<QName> baseTypesQNames = new ArrayList<>();
-
-    public UnionTypeBuilder(final String moduleName, final int line) {
-        super(moduleName, line, BaseTypes.UNION_QNAME);
-        types = new ArrayList<>();
-        typedefs = new ArrayList<>();
-    }
-
-    public List<QName> getBaseTypeQNames() {
-        return baseTypesQNames;
-    }
-
-    @Override
-    public void setTypeQName(final QName qname) {
-        baseTypesQNames.add(qname);
-    }
-
-    public List<TypeDefinition<?>> getTypes() {
-        return types;
-    }
-
-    @Override
-    public void setQName(final QName qname) {
-        throw new UnsupportedOperationException("Can not set qname to union type");
-    }
-
-    @Override
-    public TypeDefinition<?> getType() {
-        return null;
-    }
-
-    public List<TypeDefinitionBuilder> getTypedefs() {
-        return typedefs;
-    }
-
-    @Override
-    public TypeDefinitionBuilder getTypedef() {
-        return null;
-    }
-
-    @Override
-    public void setType(final TypeDefinition<?> type) {
-        types.add(type);
-    }
-
-    @Override
-    public void setTypedef(final TypeDefinitionBuilder tdb) {
-        typedefs.add(tdb);
-    }
-
-    @Override
-    public UnionType build() {
-        if (!isBuilt) {
-            for (TypeDefinitionBuilder tdb : typedefs) {
-                types.add(tdb.build());
-            }
-            instance = UnionType.create(types);
-            isBuilt = true;
-        }
-        return instance;
-    }
-
-    @Override
-    public void setDescription(final String description) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set description to " + NAME);
-    }
-
-    @Override
-    public void setReference(final String reference) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set reference to " + NAME);
-    }
-
-    @Override
-    public void setStatus(final Status status) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set status to " + NAME);
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return false;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        throw new YangParseException(getModuleName(), getLine(), "Union type can not be added by uses.");
-    }
-
-    @Override
-    public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder unknownNode) {
-        // not yet supported
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return SCHEMA_PATH;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set path to " + NAME);
-    }
-
-    @Override
-    public String getDescription() {
-        return null;
-    }
-
-    @Override
-    public String getReference() {
-        return null;
-    }
-
-    @Override
-    public Status getStatus() {
-        return null;
-    }
-
-    @Override
-    public List<RangeConstraint> getRanges() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void setRanges(final List<RangeConstraint> ranges) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set ranges to " + NAME);
-    }
-
-    @Override
-    public List<LengthConstraint> getLengths() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void setLengths(final List<LengthConstraint> lengths) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set lengths to " + NAME);
-    }
-
-    @Override
-    public List<PatternConstraint> getPatterns() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void setPatterns(final List<PatternConstraint> patterns) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set patterns to " + NAME);
-    }
-
-    @Override
-    public Integer getFractionDigits() {
-        return null;
-    }
-
-    @Override
-    public void setFractionDigits(final Integer fractionDigits) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set fraction digits to " + NAME);
-    }
-
-    @Override
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public void setDefaultValue(final Object defaultValue) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set default value to " + NAME);
-    }
-
-    @Override
-    public String getUnits() {
-        return null;
-    }
-
-    @Override
-    public void setUnits(final String units) {
-        throw new YangParseException(getModuleName(), getLine(), "Can not set units to " + NAME);
-    }
-
-    @Override
-    public String toString() {
-        return UnionTypeBuilder.class.getSimpleName() + "[" +
-                "types=" +
-                types +
-                ", typedefs=" +
-                typedefs +
-                "]";
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnknownSchemaNodeBuilderImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnknownSchemaNodeBuilderImpl.java
deleted file mode 100644 (file)
index fe93bfe..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.base.Preconditions;
-import java.util.Collections;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.api.ExtensionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.Comparators;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class UnknownSchemaNodeBuilderImpl extends AbstractBuilder implements UnknownSchemaNodeBuilder {
-    private final QName qname;
-    private SchemaPath schemaPath;
-    private String description;
-    private String reference;
-    private Status status = Status.CURRENT;
-    private boolean addedByUses;
-
-    private UnknownSchemaNodeImpl instance;
-    private QName nodeType;
-    private String nodeParameter;
-
-    private ExtensionDefinition extensionDefinition;
-    private ExtensionBuilder extensionBuilder;
-
-    public UnknownSchemaNodeBuilderImpl(final String moduleName, final int line, final QName qname, final SchemaPath path) {
-        super(moduleName, line);
-        this.qname = qname;
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-    }
-
-    public UnknownSchemaNodeBuilderImpl(final String moduleName, final int line, final QName qname, final SchemaPath path, final UnknownSchemaNode base) {
-        super(moduleName, line);
-        this.qname = base.getQName();
-        this.schemaPath = Preconditions.checkNotNull(path, "Schema Path must not be null");
-
-        this.nodeType = base.getNodeType();
-        this.nodeParameter = base.getNodeParameter();
-        this.description = base.getDescription();
-        this.reference = base.getReference();
-        this.status = base.getStatus();
-        this.addedByUses = base.isAddedByUses();
-        this.extensionDefinition = base.getExtensionDefinition();
-        this.unknownNodes.addAll(base.getUnknownSchemaNodes());
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath schemaPath) {
-        this.schemaPath = schemaPath;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(schemaPath);
-        result = prime * result + Objects.hashCode(nodeType);
-        result = prime * result + Objects.hashCode(nodeParameter);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        UnknownSchemaNodeBuilderImpl other = (UnknownSchemaNodeBuilderImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        if (nodeType == null) {
-            if (other.nodeType != null) {
-                return false;
-            }
-        } else if (!nodeType.equals(other.nodeType)) {
-            return false;
-        }
-        if (nodeParameter == null) {
-            if (other.nodeParameter != null) {
-                return false;
-            }
-        } else if (!nodeParameter.equals(other.nodeParameter)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public UnknownSchemaNode build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new UnknownSchemaNodeImpl(qname, schemaPath);
-
-        instance.setNodeType(nodeType);
-        instance.setNodeParameter(nodeParameter);
-
-        instance.description = description;
-        instance.reference = reference;
-        instance.status = status;
-        instance.addedByUses = addedByUses;
-
-        // EXTENSION
-        if (extensionDefinition != null) {
-            instance.setExtensionDefinition(extensionDefinition);
-        } else {
-            if (extensionBuilder != null) {
-                instance.setExtensionDefinition(extensionBuilder.build());
-            }
-        }
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        Collections.sort(unknownNodes, Comparators.SCHEMA_NODE_COMP);
-        instance.setUnknownSchemaNodes(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public void setReference(final String reference) {
-        this.reference = reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public void setStatus(final Status status) {
-        if (status != null) {
-            this.status = status;
-        }
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public QName getNodeType() {
-        return nodeType;
-    }
-
-    @Override
-    public void setNodeType(final QName nodeType) {
-        this.nodeType = nodeType;
-    }
-
-    @Override
-    public String getNodeParameter() {
-        return nodeParameter;
-    }
-
-    @Override
-    public void setNodeParameter(final String nodeParameter) {
-        this.nodeParameter = nodeParameter;
-    }
-
-    @Override
-    public ExtensionDefinition getExtensionDefinition() {
-        return extensionDefinition;
-    }
-
-    @Override
-    public void setExtensionDefinition(final ExtensionDefinition extensionDefinition) {
-        this.extensionDefinition = extensionDefinition;
-    }
-
-    @Override
-    public ExtensionBuilder getExtensionBuilder() {
-        return extensionBuilder;
-    }
-
-    @Override
-    public void setExtensionBuilder(final ExtensionBuilder extension) {
-        this.extensionBuilder = extension;
-    }
-
-    @Override
-    public String toString() {
-        return String.valueOf(nodeType.getNamespace()) +
-                ":" +
-                nodeType.getLocalName() +
-                " " +
-                nodeParameter;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnknownSchemaNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnknownSchemaNodeImpl.java
deleted file mode 100644 (file)
index 02ba73e..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class UnknownSchemaNodeImpl implements UnknownSchemaNode {
-    private final QName qname;
-    private final SchemaPath path;
-    private ExtensionDefinition extension;
-    String description;
-    String reference;
-    Status status = Status.CURRENT;
-    private List<UnknownSchemaNode> unknownNodes = ImmutableList.of();
-    private QName nodeType;
-    private String nodeParameter;
-    boolean addedByUses;
-
-    UnknownSchemaNodeImpl(final QName qname, final SchemaPath path) {
-        this.qname = qname;
-        this.path = path;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public ExtensionDefinition getExtensionDefinition() {
-        return extension;
-    }
-
-    void setExtensionDefinition(final ExtensionDefinition extension) {
-        this.extension = extension;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    void setUnknownSchemaNodes(final List<UnknownSchemaNode> unknownNodes) {
-        if (unknownNodes != null) {
-            this.unknownNodes = ImmutableList.copyOf(unknownNodes);
-        }
-    }
-
-    @Override
-    public QName getNodeType() {
-        return nodeType;
-    }
-
-    void setNodeType(final QName nodeType) {
-        this.nodeType = nodeType;
-    }
-
-    @Override
-    public String getNodeParameter() {
-        return nodeParameter;
-    }
-
-    void setNodeParameter(final String nodeParameter) {
-        this.nodeParameter = nodeParameter;
-    }
-
-    @Override
-    public String toString() {
-        return String.valueOf(nodeType.getNamespace()) +
-                ":" +
-                nodeType.getLocalName() +
-                " " +
-                nodeParameter;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(qname);
-        result = prime * result + Objects.hashCode(path);
-        result = prime * result + Objects.hashCode(nodeType);
-        result = prime * result + Objects.hashCode(nodeParameter);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        UnknownSchemaNodeImpl other = (UnknownSchemaNodeImpl) obj;
-        if (qname == null) {
-            if (other.qname != null) {
-                return false;
-            }
-        } else if (!qname.equals(other.qname)) {
-            return false;
-        }
-        if (path == null) {
-            if (other.path != null) {
-                return false;
-            }
-        } else if (!path.equals(other.path)) {
-            return false;
-        }
-        if (nodeType == null) {
-            if (other.nodeType != null) {
-                return false;
-            }
-        } else if (!nodeType.equals(other.nodeType)) {
-            return false;
-        }
-        if (nodeParameter == null) {
-            if (other.nodeParameter != null) {
-                return false;
-            }
-        } else if (!nodeParameter.equals(other.nodeParameter)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public boolean isAddedByAugmentation() {
-        return false;
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UsesNodeBuilderImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UsesNodeBuilderImpl.java
deleted file mode 100644 (file)
index 6e4e290..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.RefineBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.AbstractBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class UsesNodeBuilderImpl extends AbstractBuilder implements UsesNodeBuilder {
-    private UsesNodeImpl instance;
-    private DataNodeContainerBuilder parentBuilder;
-    private final SchemaPath targetGroupingPath;
-    private SchemaPath groupingPath;
-    private GroupingDefinition groupingDefinition;
-    private GroupingBuilder groupingBuilder;
-    private boolean addedByUses;
-    private boolean augmenting;
-    private boolean resolved;
-    private final Set<AugmentationSchemaBuilder> augmentationBuilders = new HashSet<>();
-    private final List<SchemaNodeBuilder> refineBuilders = new ArrayList<>();
-    private final List<RefineBuilder> refines = new ArrayList<>();
-
-    public UsesNodeBuilderImpl(final String moduleName, final int line, final SchemaPath targetGroupingPath) {
-        super(moduleName, line);
-        this.targetGroupingPath = targetGroupingPath;
-    }
-
-    @Override
-    public UsesNode build() {
-        if (instance != null) {
-            return instance;
-        }
-
-        instance = new UsesNodeImpl(groupingPath);
-        instance.setAddedByUses(addedByUses);
-
-        // AUGMENTATIONS
-        final Set<AugmentationSchema> augments = new HashSet<>();
-        for (AugmentationSchemaBuilder builder : augmentationBuilders) {
-            if (!builder.isUnsupportedTarget()) {
-                augments.add(builder.build());
-            }
-        }
-        instance.augmentations = ImmutableSet.copyOf(augments);
-
-        // REFINES
-        final Map<SchemaPath, SchemaNode> refineNodes = new HashMap<>();
-        for (SchemaNodeBuilder refineBuilder : refineBuilders) {
-            SchemaNode refineNode = refineBuilder.build();
-            refineNodes.put(refineNode.getPath(), refineNode);
-        }
-        instance.refines = ImmutableMap.copyOf(refineNodes);
-
-        // UNKNOWN NODES
-        for (UnknownSchemaNodeBuilder b : addedUnknownNodes) {
-            unknownNodes.add(b.build());
-        }
-        instance.unknownNodes = ImmutableList.copyOf(unknownNodes);
-
-        return instance;
-    }
-
-    @Override
-    public DataNodeContainerBuilder getParent() {
-        return parentBuilder;
-    }
-
-    @Override
-    public void setParent(final Builder parent) {
-        if (!(parent instanceof DataNodeContainerBuilder)) {
-            throw new YangParseException(getModuleName(), getLine(),
-                    "Parent of 'uses' has to be instance of DataNodeContainerBuilder, but was: '" + parent + "'.");
-        }
-        this.parentBuilder = (DataNodeContainerBuilder) parent;
-    }
-
-    @Override
-    public SchemaPath getGroupingPath() {
-        return groupingPath;
-    }
-
-    @Override
-    public GroupingDefinition getGroupingDefinition() {
-        return groupingDefinition;
-    }
-
-    @Override
-    public void setGroupingDefinition(final GroupingDefinition groupingDefinition) {
-        this.groupingDefinition = groupingDefinition;
-        if (groupingDefinition != null) {
-            this.groupingPath = groupingDefinition.getPath();
-        }
-    }
-
-    @Override
-    public GroupingBuilder getGroupingBuilder() {
-        return groupingBuilder;
-    }
-
-    @Override
-    public void setGrouping(final GroupingBuilder grouping) {
-        this.groupingBuilder = grouping;
-        if (groupingBuilder != null) {
-            this.groupingPath = groupingBuilder.getPath();
-        }
-    }
-
-    @Override
-    public SchemaPath getTargetGroupingPath() {
-        return targetGroupingPath;
-    }
-
-    @Override
-    public Set<AugmentationSchemaBuilder> getAugmentations() {
-        return augmentationBuilders;
-    }
-
-    @Override
-    public void addAugment(final AugmentationSchemaBuilder augmentBuilder) {
-        augmentationBuilders.add(augmentBuilder);
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    @Override
-    public void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return augmenting;
-    }
-
-    @Override
-    public void setAugmenting(final boolean augmenting) {
-        this.augmenting = augmenting;
-    }
-
-    @Override
-    public boolean isResolved() {
-        return resolved;
-    }
-
-    @Override
-    public void setResolved(final boolean resolved) {
-        this.resolved = resolved;
-    }
-
-    @Override
-    public List<SchemaNodeBuilder> getRefineNodes() {
-        return refineBuilders;
-    }
-
-    @Override
-    public void addRefineNode(final DataSchemaNodeBuilder refineNode) {
-        refineBuilders.add(refineNode);
-    }
-
-    @Override
-    public List<RefineBuilder> getRefines() {
-        return refines;
-    }
-
-    @Override
-    public void addRefine(final RefineBuilder refine) {
-        refines.add(refine);
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(groupingPath);
-        result = prime * result + Objects.hashCode(parentBuilder);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        UsesNodeBuilderImpl other = (UsesNodeBuilderImpl) obj;
-        if (groupingPath == null) {
-            if (other.groupingPath != null) {
-                return false;
-            }
-        } else if (!groupingPath.equals(other.groupingPath)) {
-            return false;
-        }
-        if (parentBuilder == null) {
-            if (other.parentBuilder != null) {
-                return false;
-            }
-        } else if (!parentBuilder.equals(other.parentBuilder)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "uses '" + groupingPath + "'";
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UsesNodeImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UsesNodeImpl.java
deleted file mode 100644 (file)
index 889f2df..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2013, 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.builder.impl;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class UsesNodeImpl implements UsesNode {
-    private final SchemaPath groupingPath;
-    ImmutableSet<AugmentationSchema> augmentations;
-    private boolean addedByUses;
-    ImmutableMap<SchemaPath, SchemaNode> refines;
-    ImmutableList<UnknownSchemaNode> unknownNodes;
-
-    UsesNodeImpl(final SchemaPath groupingPath) {
-        this.groupingPath = groupingPath;
-    }
-
-    @Override
-    public SchemaPath getGroupingPath() {
-        return groupingPath;
-    }
-
-    @Override
-    public Set<AugmentationSchema> getAugmentations() {
-        return augmentations;
-    }
-
-    @Override
-    public boolean isAugmenting() {
-        return false;
-    }
-
-    @Override
-    public boolean isAddedByUses() {
-        return addedByUses;
-    }
-
-    void setAddedByUses(final boolean addedByUses) {
-        this.addedByUses = addedByUses;
-    }
-
-    @Override
-    public Map<SchemaPath, SchemaNode> getRefines() {
-        return refines;
-    }
-
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return unknownNodes;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(groupingPath);
-        result = prime * result + Objects.hashCode(augmentations);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final UsesNodeImpl other = (UsesNodeImpl) obj;
-        if (groupingPath == null) {
-            if (other.groupingPath != null) {
-                return false;
-            }
-        } else if (!groupingPath.equals(other.groupingPath)) {
-            return false;
-        }
-        if (augmentations == null) {
-            if (other.augmentations != null) {
-                return false;
-            }
-        } else if (!augmentations.equals(other.augmentations)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return UsesNodeImpl.class.getSimpleName() + "[groupingPath=" +
-                groupingPath +
-                "]";
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractBuilder.java
deleted file mode 100644 (file)
index ba38dda..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.util;
-
-import com.google.common.base.Preconditions;
-import java.util.ArrayList;
-import java.util.List;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-
-/**
- * Base helper implementation of Builders for Yang Model elements.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public abstract class AbstractBuilder implements Builder {
-    private final String moduleName;
-    private final int line;
-    private Builder parentBuilder;
-
-    protected final List<UnknownSchemaNode> unknownNodes = new ArrayList<>();
-    protected final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<>();
-    private boolean sealed;
-
-    protected AbstractBuilder(final String moduleName, final int line) {
-        this.moduleName = Preconditions.checkNotNull(moduleName,"moduleName must not be null");
-        this.line = line;
-    }
-
-    @Override
-    public String getModuleName() {
-        return moduleName;
-    }
-
-    @Override
-    public int getLine() {
-        return line;
-    }
-
-    @Override
-    public Builder getParent() {
-        return parentBuilder;
-    }
-
-    @Override
-    public void setParent(final Builder parentBuilder) {
-        checkNotSealed();
-        this.parentBuilder = parentBuilder;
-    }
-
-    @Override
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-        return addedUnknownNodes;
-    }
-
-    @Override
-    public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder unknownNode) {
-        addedUnknownNodes.add(unknownNode);
-    }
-
-    void seal() {
-        checkNotSealed();
-        sealed  = true;
-    }
-
-    protected final void checkNotSealed() {
-        Preconditions.checkState(!sealed, "Builder is sealed. No further modifications allowed");
-    }
-
-    boolean isSealed() {
-        return sealed;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedDataNodeContainer.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedDataNodeContainer.java
deleted file mode 100644 (file)
index 67b74b7..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2014 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.builder.util;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import java.util.Map;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public abstract class AbstractDocumentedDataNodeContainer extends AbstractDocumentedNode implements DataNodeContainer {
-
-    private final Map<QName, DataSchemaNode> childNodes;
-    private final Set<GroupingDefinition> groupings;
-    private final Set<UsesNode> uses;
-    private final Set<TypeDefinition<?>> typeDefinitions;
-    private final Set<DataSchemaNode> publicChildNodes;
-
-    protected AbstractDocumentedDataNodeContainer(final AbstractDocumentedDataNodeContainerBuilder data) {
-        super(data);
-        // FIXME : Should be unmodifiable ordered set (ordered by QName... or appearance in YANG file).
-        // consider using new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-
-        childNodes = ImmutableMap.copyOf(data.getChildNodes());
-        groupings = ImmutableSet.copyOf(data.getGroupings());
-        uses = ImmutableSet.copyOf(data.getUsesNodes());
-        typeDefinitions = ImmutableSet.copyOf(data.getTypeDefinitions());
-        publicChildNodes = ImmutableSet.copyOf(childNodes.values());
-    }
-
-    @Override
-    public final Set<TypeDefinition<?>> getTypeDefinitions() {
-        return typeDefinitions;
-    }
-
-    @Override
-    public final Set<DataSchemaNode> getChildNodes() {
-        return publicChildNodes;
-    }
-
-    @Override
-    public final Set<GroupingDefinition> getGroupings() {
-        return groupings;
-    }
-
-    @Override
-    public final DataSchemaNode getDataChildByName(final QName name) {
-        // Child nodes are keyed by their container name, so we can do a direct lookup
-        return childNodes.get(name);
-    }
-
-    @Override
-    public final DataSchemaNode getDataChildByName(final String name) {
-        for (DataSchemaNode node : childNodes.values()) {
-            if (node.getQName().getLocalName().equals(name)) {
-                return node;
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public Set<UsesNode> getUses() {
-        return uses;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedDataNodeContainerBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedDataNodeContainerBuilder.java
deleted file mode 100644 (file)
index 22b2a98..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.util;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DocumentedNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Basic implementation of DataNodeContainerBuilder.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public abstract class AbstractDocumentedDataNodeContainerBuilder extends AbstractDocumentedNodeBuilder implements DataNodeContainerBuilder {
-    protected final QName qname;
-
-    private final Map<QName, DataSchemaNode> childNodes = new LinkedHashMap<>();
-    private final List<DataSchemaNodeBuilder> addedChildNodes = new ArrayList<>();
-
-    private final Set<GroupingDefinition> groupings = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-    private final Set<GroupingBuilder> addedGroupings = new HashSet<>();
-
-    private final Set<TypeDefinition<?>> typedefs = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
-    private final Set<TypeDefinitionBuilder> addedTypedefs = new HashSet<>();
-
-    private final Set<UsesNode> usesNodes = new HashSet<>();
-    private final List<UsesNodeBuilder> addedUsesNodes = new ArrayList<>();
-
-    protected AbstractDocumentedDataNodeContainerBuilder(final String moduleName, final int line, final QName qname) {
-        super(moduleName, line);
-        this.qname = qname;
-    }
-
-    protected AbstractDocumentedDataNodeContainerBuilder(final String moduleName, final int line, final QName qname, final SchemaPath path, final DataNodeContainer base) {
-        super(moduleName, line);
-        this.qname = qname;
-
-        // We do copy of child nodes with namespace change
-        // FIXME: Copy should be part of builder API so impl we prevent
-        // cyclic dependencies and each builder carries its own semantic for copy.
-        addedChildNodes.addAll(BuilderUtils.wrapChildNodes(moduleName, line, base.getChildNodes(), path, qname));
-        addedGroupings.addAll(BuilderUtils.wrapGroupings(moduleName, line, base.getGroupings(), path, qname));
-        addedTypedefs.addAll(BuilderUtils.wrapTypedefs(moduleName, line, base, path, qname));
-        // FIXME: unkownSchemaNodes should be available in DataNodeContainer
-        // addedUnknownNodes.addAll(BuilderUtils.wrapUnknownNodes(moduleName,
-        // line, base.getUnknownSchemaNodes(), path, qname));
-        usesNodes.addAll(base.getUses());
-
-        if (base instanceof DocumentedNode) {
-            DocumentedNode node = (DocumentedNode) base;
-            setDescription(node.getDescription());
-            setReference(node.getReference());
-            setStatus(node.getStatus());
-        }
-    }
-
-    @Override
-    public final QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public final Map<QName, DataSchemaNode> getChildNodes() {
-        return childNodes;
-    }
-
-    @Override
-    public final List<DataSchemaNodeBuilder> getChildNodeBuilders() {
-        return addedChildNodes;
-    }
-
-    @Override
-    public final DataSchemaNodeBuilder getDataChildByName(final String name) {
-        for (DataSchemaNodeBuilder child : addedChildNodes) {
-            if (child.getQName().getLocalName().equals(name)) {
-                return child;
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public final void addChildNode(final DataSchemaNodeBuilder child) {
-        checkIsPresent(child);
-        addedChildNodes.add(child);
-    }
-
-    @Override
-    public final void addChildNode(final int index, final DataSchemaNodeBuilder child) {
-        checkIsPresent(child);
-        if (index > addedChildNodes.size()) {
-            addedChildNodes.add(child);
-        } else {
-            addedChildNodes.add(index, child);
-        }
-    }
-
-    private void checkIsPresent(final DataSchemaNodeBuilder child) {
-        for (DataSchemaNodeBuilder addedChildNode : addedChildNodes) {
-            if (addedChildNode.getQName().equals(child.getQName())) {
-                throw new YangParseException(child.getModuleName(), child.getLine(), String.format(
-                        "Can not add '%s' to '%s' in module '%s': node with same name already declared at line %d",
-                        child, this, getModuleName(), addedChildNode.getLine()));
-            }
-        }
-    }
-
-    @Override
-    public final void addChildNodeToContext(final DataSchemaNodeBuilder child) {
-        addedChildNodes.add(child);
-    }
-
-    @Override
-    public final void addChildNode(final DataSchemaNode child) {
-        checkNotSealed();
-        QName childName = child.getQName();
-        if (childNodes.containsKey(childName)) {
-            throw new YangParseException(getModuleName(), getLine(), String.format(
-                    "Can not add '%s' to '%s' in module '%s': node with same name already declared", child, this,
-                    getModuleName()));
-        }
-        childNodes.put(childName, child);
-    }
-
-    @Override
-    public final Set<GroupingDefinition> getGroupings() {
-        return groupings;
-    }
-
-    @Override
-    public final Set<GroupingBuilder> getGroupingBuilders() {
-        return addedGroupings;
-    }
-
-    @Override
-    public void addGrouping(final GroupingBuilder grouping) {
-        checkNotSealed();
-        QName groupingName = grouping.getQName();
-        for (GroupingBuilder addedGrouping : addedGroupings) {
-            if (addedGrouping.getQName().equals(groupingName)) {
-                throw new YangParseException(grouping.getModuleName(), grouping.getLine(), String.format(
-                        "Can not add '%s': grouping with same name already declared in module '%s' at line %d",
-                        grouping, getModuleName(), addedGrouping.getLine()));
-            }
-        }
-        addedGroupings.add(grouping);
-    }
-
-    @Override
-    public final Set<TypeDefinition<?>> getTypeDefinitions() {
-        return typedefs;
-    }
-
-    public final Set<UsesNode> getUsesNodes() {
-        return usesNodes;
-    }
-
-    @Override
-    public final List<UsesNodeBuilder> getUsesNodeBuilders() {
-        return addedUsesNodes;
-    }
-
-    @Override
-    public final void addUsesNode(final UsesNodeBuilder usesNode) {
-        checkNotSealed();
-        addedUsesNodes.add(usesNode);
-    }
-
-
-    @Override
-    public final Set<TypeDefinitionBuilder> getTypeDefinitionBuilders() {
-        return addedTypedefs;
-    }
-
-    @Override
-    public void addTypedef(final TypeDefinitionBuilder type) {
-        checkNotSealed();
-        String typeName = type.getQName().getLocalName();
-        for (TypeDefinitionBuilder addedTypedef : addedTypedefs) {
-            if (addedTypedef.getQName().getLocalName().equals(typeName)) {
-                throw new YangParseException(getModuleName(), type.getLine(), "Can not add typedef '" + typeName
-                        + "': typedef with same name already declared at line " + addedTypedef.getLine());
-            }
-        }
-        addedTypedefs.add(type);
-    }
-
-    protected abstract String getStatementName();
-
-    protected void buildChildren() {
-        checkNotSealed();
-        seal();
-
-        for (DataSchemaNodeBuilder node : addedChildNodes) {
-            childNodes.put(node.getQName(), node.build());
-        }
-
-        for (GroupingBuilder builder : addedGroupings) {
-            groupings.add(builder.build());
-        }
-
-        for (TypeDefinitionBuilder entry : addedTypedefs) {
-            typedefs.add(entry.build());
-        }
-
-        for (UsesNodeBuilder builder : addedUsesNodes) {
-            usesNodes.add(builder.build());
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedNode.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedNode.java
deleted file mode 100644 (file)
index d375aba..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2014 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.builder.util;
-
-import com.google.common.base.Preconditions;
-import org.opendaylight.yangtools.yang.model.api.DocumentedNode;
-import org.opendaylight.yangtools.yang.model.api.Status;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public abstract class AbstractDocumentedNode implements DocumentedNode {
-
-    private final String description;
-    private final String reference;
-    private final Status status;
-
-    AbstractDocumentedNode(final AbstractDocumentedNodeBuilder builder) {
-        Preconditions.checkArgument(builder.isSealed(), "Builder must be sealed.");
-        this.description = builder.getDescription();
-        this.reference = builder.getReference();
-        this.status = builder.getStatus();
-    }
-
-    @Override
-    public final String getDescription() {
-        return description;
-    }
-
-    @Override
-    public final String getReference() {
-        return reference;
-    }
-
-    @Override
-    public final Status getStatus() {
-        return status;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractDocumentedNodeBuilder.java
deleted file mode 100644 (file)
index a7554b5..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2014 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.builder.util;
-
-import org.opendaylight.yangtools.yang.model.api.DocumentedNode;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.parser.builder.api.DocumentedNodeBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public abstract class AbstractDocumentedNodeBuilder extends AbstractBuilder implements DocumentedNodeBuilder{
-    private String description = null;
-    private String reference = null;
-    private Status status = Status.CURRENT;
-
-
-
-    public AbstractDocumentedNodeBuilder(final String moduleName, final int line) {
-        super(moduleName, line);
-    }
-
-    public AbstractDocumentedNodeBuilder(final String moduleName, final int line, final DocumentedNode node) {
-        super(moduleName, line);
-        description = node.getDescription();
-        reference = node.getReference();
-        status = node.getStatus();
-    }
-
-    @Override
-    public final void setDescription(final String description) {
-        this.description = description;
-    }
-
-    @Override
-    public final void setReference(final String reference) {
-        this.reference = reference;
-    }
-
-    @Override
-    public final void setStatus(final Status status) {
-        this.status  = status;
-    }
-
-    @Override
-    public final String getDescription() {
-        return description;
-    }
-
-    @Override
-    public final String getReference() {
-        return reference;
-    }
-
-    @Override
-    public final Status getStatus() {
-        return status;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractSchemaNodeBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractSchemaNodeBuilder.java
deleted file mode 100644 (file)
index 88cc73d..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.util;
-
-import com.google.common.base.Preconditions;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-
-/**
- * Basic implementation of SchemaNodeBuilder.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public abstract class AbstractSchemaNodeBuilder extends AbstractBuilder implements SchemaNodeBuilder {
-    protected final QName qname;
-    protected SchemaPath schemaPath;
-    protected String description;
-    protected String reference;
-    protected Status status = Status.CURRENT;
-
-    protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) {
-        super(moduleName, line);
-        this.qname = qname;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return schemaPath;
-    }
-
-    @Override
-    public void setPath(final SchemaPath path) {
-        this.schemaPath = path;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    @Override
-    public String getReference() {
-        return reference;
-    }
-
-    @Override
-    public void setReference(final String reference) {
-        this.reference = reference;
-    }
-
-    @Override
-    public Status getStatus() {
-        return status;
-    }
-
-    @Override
-    public void setStatus(final Status status) {
-        this.status = Preconditions.checkNotNull(status, "status cannot be null");
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + Objects.hashCode(getParent());
-        result = prime * result + Objects.hashCode(schemaPath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        AbstractSchemaNodeBuilder other = (AbstractSchemaNodeBuilder) obj;
-        if (getParent() == null) {
-            if (other.getParent() != null) {
-                return false;
-            }
-        } else if (!getParent().equals(other.getParent())) {
-            return false;
-        }
-        if (schemaPath == null) {
-            if (other.schemaPath != null) {
-                return false;
-            }
-        } else if (!schemaPath.equals(other.schemaPath)) {
-            return false;
-        }
-        return true;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractTypeAwareBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/AbstractTypeAwareBuilder.java
deleted file mode 100644 (file)
index 2687881..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.util;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-
-/**
- * Basic implementation for TypeAwareBuilder builders.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public abstract class AbstractTypeAwareBuilder extends AbstractBuilder implements TypeAwareBuilder {
-    protected QName qname;
-    protected TypeDefinition<?> type;
-    protected TypeDefinitionBuilder typedef;
-
-    private QName baseTypeName;
-
-    protected AbstractTypeAwareBuilder(final String moduleName, final int line, final QName qname) {
-        super(moduleName, line);
-        this.qname = qname;
-    }
-
-    @Override
-    public QName getQName() {
-        return qname;
-    }
-
-    @Override
-    public TypeDefinition<?> getType() {
-        return type;
-    }
-
-    @Override
-    public TypeDefinitionBuilder getTypedef() {
-        return typedef;
-    }
-
-    @Override
-    public void setType(final TypeDefinition<?> type) {
-        this.type = type;
-        this.typedef = null;
-    }
-
-    @Override
-    public void setTypedef(final TypeDefinitionBuilder typedef) {
-        this.typedef = typedef;
-        this.type = null;
-    }
-
-    @Override
-    public QName getTypeQName() {
-        return baseTypeName;
-    }
-
-    @Override
-    public void setTypeQName(final QName qname) {
-        this.baseTypeName = qname;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/Comparators.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/util/Comparators.java
deleted file mode 100644 (file)
index 3b4576d..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2013 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.builder.util;
-
-import com.google.common.collect.Iterables;
-import java.util.Comparator;
-import java.util.Iterator;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class Comparators {
-
-    /**
-     * Comparator based on alphabetical order of local name of SchemaNode's
-     * qname.
-     */
-    public static final SchemaNodeComparator SCHEMA_NODE_COMP = new SchemaNodeComparator();
-
-    /**
-     * Comparator based on augment target path.
-     */
-    public static final AugmentComparator AUGMENT_COMP = new AugmentComparator();
-
-    public static final AugmentBuilderComparator AUGMENT_BUILDER_COMP = new AugmentBuilderComparator();
-
-    private Comparators() {
-    }
-
-    private static final class SchemaNodeComparator implements Comparator<SchemaNode> {
-        @Override
-        public int compare(final SchemaNode o1, final SchemaNode o2) {
-            return o1.getQName().compareTo(o2.getQName());
-        }
-    }
-
-    private static final class AugmentBuilderComparator implements Comparator<AugmentationSchemaBuilder> {
-        @Override
-        public int compare(final AugmentationSchemaBuilder o1, final AugmentationSchemaBuilder o2) {
-            int length1 = Iterables.size(o1.getTargetPath().getPathFromRoot());
-            int length2 = Iterables.size(o2.getTargetPath().getPathFromRoot());
-            return length1 - length2;
-        }
-    }
-
-    private static final class AugmentComparator implements Comparator<AugmentationSchema> {
-        @Override
-        public int compare(final AugmentationSchema augSchema1, final AugmentationSchema augSchema2) {
-            final Iterator<QName> thisIt = augSchema1.getTargetPath().getPathFromRoot().iterator();
-            final Iterator<QName> otherIt = augSchema2.getTargetPath().getPathFromRoot().iterator();
-
-            while (thisIt.hasNext()) {
-                if (otherIt.hasNext()) {
-                    final int comp = thisIt.next().compareTo(otherIt.next());
-                    if (comp != 0) {
-                        return comp;
-                    }
-                } else {
-                    return 1;
-                }
-            }
-            if (otherIt.hasNext()) {
-                return -1;
-            }
-            return 0;
-        }
-
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/BasicValidations.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/BasicValidations.java
deleted file mode 100644 (file)
index 3fda4e0..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (c) 2013 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.impl;
-
-import static java.lang.String.format;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.Sets;
-
-import java.text.ParseException;
-import java.util.Date;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Yang_version_stmtContext;
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-/**
- * Reusable checks of basic constraints on yang statements
- */
-final class BasicValidations {
-
-    static final String SUPPORTED_YANG_VERSION = "1";
-    private static final Splitter SLASH_SPLITTER = Splitter.on('/').omitEmptyStrings();
-    private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*");
-    private static final Pattern PREFIX_IDENTIFIER_PATTERN = Pattern.compile("(.+):(.+)");
-
-    /**
-     * It isn't desirable to create instance of this class.
-     */
-    private BasicValidations() {
-    }
-
-    static void checkNotPresentBoth(final ParseTree parent, final Class<? extends ParseTree> childType1,
-            final Class<? extends ParseTree> childType2) {
-        if (BasicValidations.checkPresentChildOfTypeSafe(parent, childType1, true)
-                && BasicValidations.checkPresentChildOfTypeSafe(parent, childType2, false)) {
-            ValidationUtil.ex(ValidationUtil.f("(In (sub)module:%s) Both %s and %s statement present in %s:%s",
-                    ValidationUtil.getRootParentName(parent), ValidationUtil.getSimpleStatementName(childType1),
-                    ValidationUtil.getSimpleStatementName(childType2),
-                    ValidationUtil.getSimpleStatementName(parent.getClass()), ValidationUtil.getName(parent)));
-        }
-    }
-
-    static void checkOnlyPermittedValues(final ParseTree ctx, final Set<String> permittedValues) {
-        String mandatory = ValidationUtil.getName(ctx);
-        String rootParentName = ValidationUtil.getRootParentName(ctx);
-
-        if (!permittedValues.contains(mandatory)) {
-            ValidationUtil.ex(ValidationUtil.f(
-                    "(In (sub)module:%s) %s:%s, illegal value for %s statement, only permitted:%s", rootParentName,
-                    ValidationUtil.getSimpleStatementName(ctx.getClass()), mandatory,
-                    ValidationUtil.getSimpleStatementName(ctx.getClass()), permittedValues));
-        }
-    }
-
-    static void checkUniquenessInNamespace(final ParseTree stmt, final Set<String> uniques) {
-        String name = ValidationUtil.getName(stmt);
-        String rootParentName = ValidationUtil.getRootParentName(stmt);
-
-        if (uniques.contains(name)) {
-            ValidationUtil.ex(ValidationUtil.f("(In (sub)module:%s) %s:%s not unique in (sub)module", rootParentName,
-                    ValidationUtil.getSimpleStatementName(stmt.getClass()), name));
-        }
-        uniques.add(name);
-    }
-
-    /**
-     * Check if only one module or submodule is present in session(one yang
-     * file)
-     */
-    static void checkIsModuleIdNull(final String globalId) {
-        if (globalId != null) {
-            ValidationUtil.ex(ValidationUtil.f("Multiple (sub)modules per file"));
-        }
-    }
-
-    static void checkPresentYangVersion(final ParseTree ctx, final String moduleName) {
-        if (!checkPresentChildOfTypeSafe(ctx, Yang_version_stmtContext.class, true)) {
-            ValidationUtil.ex(ValidationUtil.f(
-                    "Yang version statement not present in module:%s, Validating as yang version:%s", moduleName,
-                    SUPPORTED_YANG_VERSION));
-        }
-    }
-
-    static void checkDateFormat(final ParseTree stmt) {
-        try {
-            SimpleDateFormatUtil.getRevisionFormat().parse(ValidationUtil.getName(stmt));
-        } catch (ParseException e) {
-            String exceptionMessage = ValidationUtil.f(
-                    "(In (sub)module:%s) %s:%s, invalid date format expected date format is:%s",
-                    ValidationUtil.getRootParentName(stmt), ValidationUtil.getSimpleStatementName(stmt.getClass()),
-                    ValidationUtil.getName(stmt), SimpleDateFormatUtil.getRevisionFormat().format(new Date()));
-            ValidationUtil.ex(exceptionMessage);
-        }
-    }
-
-    static void checkIdentifier(final ParseTree statement) {
-        checkIdentifierInternal(statement, ValidationUtil.getName(statement));
-    }
-
-    static void checkIdentifierInternal(final ParseTree statement, final String name) {
-        if (!IDENTIFIER_PATTERN.matcher(name).matches()) {
-
-            String message = ValidationUtil.f("%s statement identifier:%s is not in required format:%s",
-                    ValidationUtil.getSimpleStatementName(statement.getClass()), name, IDENTIFIER_PATTERN.toString());
-            String parent = ValidationUtil.getRootParentName(statement);
-            message = parent.equals(name) ? message : ValidationUtil.f("(In (sub)module:%s) %s", parent, message);
-
-            if (statement instanceof ParserRuleContext) {
-                message = "Error on line " + ((ParserRuleContext) statement).getStart().getLine() + ": " + message;
-            }
-
-            ValidationUtil.ex(message);
-        }
-    }
-
-    static void checkPrefixedIdentifier(final ParseTree statement) {
-        checkPrefixedIdentifierInternal(statement, ValidationUtil.getName(statement));
-    }
-
-    private static void checkPrefixedIdentifierInternal(final ParseTree statement, final String id) {
-        Matcher matcher = PREFIX_IDENTIFIER_PATTERN.matcher(id);
-
-        if (matcher.matches()) {
-            try {
-                // check prefix
-                checkIdentifierInternal(statement, matcher.group(1));
-                // check ID
-                checkIdentifierInternal(statement, matcher.group(2));
-            } catch (YangValidationException e) {
-                ValidationUtil.ex(ValidationUtil.f("Prefixed id:%s not in required format, details:%s", id,
-                        e.getMessage()));
-            }
-        } else {
-            checkIdentifierInternal(statement, id);
-        }
-    }
-
-    static void checkSchemaNodeIdentifier(final ParseTree statement) {
-        String id = ValidationUtil.getName(statement);
-
-        try {
-            for (String oneOfId : SLASH_SPLITTER.split(id)) {
-                checkPrefixedIdentifierInternal(statement, oneOfId);
-            }
-        } catch (YangValidationException e) {
-            ValidationUtil.ex(ValidationUtil.f("Schema node id:%s not in required format, details:%s", id,
-                    e.getMessage()));
-        }
-    }
-
-    private interface MessageProvider {
-        String getMessage();
-    }
-
-    private static void checkPresentChildOfTypeInternal(final ParseTree parent, final Set<Class<? extends ParseTree>> expectedChildType,
-            final MessageProvider message, final boolean atMostOne) {
-        if (!checkPresentChildOfTypeSafe(parent, expectedChildType, atMostOne)) {
-            String str = atMostOne ? "(Expected exactly one statement) " + message.getMessage() : message.getMessage();
-            ValidationUtil.ex(str);
-        }
-    }
-
-    static void checkPresentChildOfType(final ParseTree parent, final Class<? extends ParseTree> expectedChildType,
-            final boolean atMostOne) {
-
-        // Construct message in checkPresentChildOfTypeInternal only if
-        // validation fails, not in advance
-        MessageProvider message = new MessageProvider() {
-
-            @Override
-            public String getMessage() {
-                String message = ValidationUtil.f("Missing %s statement in %s:%s",
-                        ValidationUtil.getSimpleStatementName(expectedChildType),
-                        ValidationUtil.getSimpleStatementName(parent.getClass()), ValidationUtil.getName(parent));
-
-                String root = ValidationUtil.getRootParentName(parent);
-                message = format("(In (sub)module:%s) %s", root, message);
-                return message;
-            }
-        };
-
-        Set<Class<? extends ParseTree>> expectedChildTypeSet = Sets.newHashSet();
-        expectedChildTypeSet.add(expectedChildType);
-
-        checkPresentChildOfTypeInternal(parent, expectedChildTypeSet, message, atMostOne);
-    }
-
-    /**
-     *
-     * Implementation of interface <code>MessageProvider</code> for method
-     * {@link BasicValidations#checkPresentChildOfTypeSafe(ParseTree, Set, boolean)
-     * checkPresentChildOfTypeSafe(ParseTree, Set, boolean) * }
-     */
-    private static class MessageProviderForSetOfChildTypes implements MessageProvider {
-
-        private final Set<Class<? extends ParseTree>> expectedChildTypes;
-        private final ParseTree parent;
-
-        public MessageProviderForSetOfChildTypes(final Set<Class<? extends ParseTree>> expectedChildTypes, final ParseTree parent) {
-            this.expectedChildTypes = expectedChildTypes;
-            this.parent = parent;
-        }
-
-        @Override
-        public String getMessage() {
-            StringBuilder childTypes = new StringBuilder();
-            for (Class<? extends ParseTree> type : expectedChildTypes) {
-                childTypes.append(ValidationUtil.getSimpleStatementName(type));
-                childTypes.append(" OR ");
-            }
-            String message = ValidationUtil.f("Missing %s statement in %s:%s", childTypes.toString(),
-                    ValidationUtil.getSimpleStatementName(parent.getClass()), ValidationUtil.getName(parent));
-
-            String root = ValidationUtil.getRootParentName(parent);
-            message = format("(In (sub)module:%s) %s", root, message);
-            return message;
-        }
-    }
-
-    static void checkPresentChildOfTypes(final ParseTree parent,
-            final Set<Class<? extends ParseTree>> expectedChildTypes, final boolean atMostOne) {
-
-        // Construct message in checkPresentChildOfTypeInternal only if
-        // validation fails, not in advance
-        MessageProvider message = new MessageProviderForSetOfChildTypes(expectedChildTypes, parent);
-        checkPresentChildOfTypeInternal(parent, expectedChildTypes, message, atMostOne);
-    }
-
-    private static boolean checkPresentChildOfTypeSafe(final ParseTree parent, final Set<Class<? extends ParseTree>> expectedChildType,
-            final boolean atMostOne) {
-
-        int foundChildrenOfType = ValidationUtil.countPresentChildrenOfType(parent, expectedChildType);
-
-        return atMostOne ? foundChildrenOfType == 1 : foundChildrenOfType != 0;
-    }
-
-    private static boolean checkPresentChildOfTypeSafe(final ParseTree parent, final Class<? extends ParseTree> expectedChildType,
-            final boolean atMostOne) {
-
-        int foundChildrenOfType = ValidationUtil.countPresentChildrenOfType(parent, expectedChildType);
-
-        return atMostOne ? foundChildrenOfType == 1 : foundChildrenOfType != 0;
-    }
-
-    static Iterable<String> getAndCheckUniqueKeys(final ParseTree ctx) {
-        String key = ValidationUtil.getName(ctx);
-        ParseTree parent = ctx.getParent();
-        String rootParentName = ValidationUtil.getRootParentName(ctx);
-
-        Iterable<String> keyList = ValidationUtil.listKeysFromId(key);
-        Set<String> duplicates = ValidationUtil.getDuplicates(keyList);
-
-        if (!duplicates.isEmpty()) {
-            ValidationUtil.ex(ValidationUtil.f("(In (sub)module:%s) %s:%s, %s:%s contains duplicates:%s",
-                    rootParentName, ValidationUtil.getSimpleStatementName(parent.getClass()),
-                    ValidationUtil.getName(parent), ValidationUtil.getSimpleStatementName(ctx.getClass()), key,
-                    duplicates));
-        }
-        return keyList;
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/GroupingSort.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/GroupingSort.java
deleted file mode 100644 (file)
index 4112d4f..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2013 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.impl;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ChoiceBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ChoiceCaseBuilder;
-import org.opendaylight.yangtools.yang.parser.util.NodeWrappedType;
-import org.opendaylight.yangtools.yang.parser.util.TopologicalSort;
-import org.opendaylight.yangtools.yang.parser.util.TopologicalSort.Node;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class GroupingSort {
-    private GroupingSort() {
-        throw new UnsupportedOperationException("Utility class should not be instantiated");
-    }
-
-    /**
-     * Sorts set <code>groupingDefinitions</code> according to the mutual
-     * dependencies.<br>
-     *
-     * Elements of <code>groupingDefinitions</code> are firstly transformed to
-     * {@link org.opendaylight.yangtools.yang.parser.util.TopologicalSort.Node
-     * Node} interfaces and then are sorted by
-     * {@link org.opendaylight.yangtools.yang.parser.util.TopologicalSort#sort(Set)
-     * sort()} method of <code>TopologicalSort</code>.<br>
-     * <br>
-     *
-     *
-     * <i>Definition of dependency relation:<br>
-     * The first <code>GroupingDefinition</code> object (in this context)
-     * depends on second <code>GroupingDefinition</code> object if the first one
-     * contains in its set of <code>UsesNode</code> (obtained through
-     * {@link org.opendaylight.yangtools.yang.model.api.DataNodeContainer#getUses()
-     * getUses} method) reference to the second one.</i>
-     *
-     * @param groupingDefinitions
-     *            set of grouping definition which should be sorted according to
-     *            mutual dependencies
-     * @return list of grouping definitions which are sorted by mutual
-     *         dependencies
-     * @throws IllegalArgumentException
-     *             if <code>groupingDefinitions</code>
-     *
-     */
-    public static List<GroupingBuilder> sort(final Collection<GroupingBuilder> groupingDefinitions) {
-        if (groupingDefinitions == null) {
-            throw new IllegalArgumentException("Set of Type Definitions " + "cannot be NULL!");
-        }
-
-        final List<GroupingBuilder> resultGroupingDefinitions = new ArrayList<>();
-        final Set<Node> unsorted = groupingDefinitionsToNodes(groupingDefinitions);
-        final List<Node> sortedNodes = TopologicalSort.sort(unsorted);
-        for (Node node : sortedNodes) {
-            NodeWrappedType nodeWrappedType = (NodeWrappedType) node;
-            resultGroupingDefinitions.add((GroupingBuilder) (nodeWrappedType.getWrappedType()));
-        }
-        return resultGroupingDefinitions;
-
-    }
-
-    /**
-     * Wraps every grouping definition to node type and adds to every node
-     * information about dependencies.
-     *
-     * The map with mapping from schema path (represents grouping definition) to
-     * node is created. For every created node (next <i>nodeFrom</i>) is for its
-     * wrapped grouping definition passed the set of its <i>uses nodes</i>
-     * through. For every uses node is found its wrapping node (next as
-     * <i>nodeTo</i>). This dependency relationship between nodeFrom and all
-     * found nodesTo is modeled with creating of one edge from nodeFrom to
-     * nodeTo.
-     *
-     *
-     * @param groupingDefinitions
-     *            set of goruping definition which will be wrapped to nodes
-     *
-     * @return set of nodes where every one contains wrapped grouping definition
-     */
-    private static Set<Node> groupingDefinitionsToNodes(final Collection<GroupingBuilder> groupingDefinitions) {
-        final Map<SchemaPath, Node> nodeMap = Maps.newHashMap();
-        final Set<Node> resultNodes = Sets.newHashSet();
-
-        for (final GroupingBuilder groupingDefinition : groupingDefinitions) {
-            final Node node = new NodeWrappedType(groupingDefinition);
-            nodeMap.put(groupingDefinition.getPath(), node);
-            resultNodes.add(node);
-        }
-
-        for (final Node node : resultNodes) {
-            final NodeWrappedType nodeWrappedType = (NodeWrappedType) node;
-            final GroupingBuilder groupingDefinition = (GroupingBuilder) nodeWrappedType.getWrappedType();
-
-            Set<UsesNodeBuilder> usesNodes = getAllUsesNodes(groupingDefinition);
-            for (UsesNodeBuilder usesNode : usesNodes) {
-                SchemaPath schemaPath = usesNode.getGroupingBuilder().getPath();
-                Node nodeTo = nodeMap.get(schemaPath);
-                if (nodeTo == null) {
-                    throw new IllegalArgumentException("target grouping not found for uses " + usesNode);
-                }
-                nodeWrappedType.addEdge(nodeTo);
-            }
-        }
-
-        return resultNodes;
-    }
-
-    /**
-     * Returns the set of the uses nodes which are get from uses in
-     * <code>container</code>, from uses in groupings inside
-     * <code>container</code> and from uses inside child nodes of the
-     * <code>container</code>.
-     *
-     * @param container
-     *            data node container which can contain some uses of grouping
-     * @return set of uses nodes which were find in <code>container</code>.
-     */
-    public static Set<UsesNodeBuilder> getAllUsesNodes(final DataNodeContainerBuilder container) {
-        Set<UsesNodeBuilder> ret = new HashSet<>();
-        List<UsesNodeBuilder> usesNodes = container.getUsesNodeBuilders();
-        ret.addAll(usesNodes);
-
-        for (UsesNodeBuilder usesNode : usesNodes) {
-            for (AugmentationSchemaBuilder augment : usesNode.getAugmentations()) {
-                ret.addAll(getAllUsesNodes(augment));
-            }
-        }
-        Set<GroupingBuilder> groupings = container.getGroupingBuilders();
-        for (GroupingBuilder groupingDefinition : groupings) {
-            ret.addAll(getAllUsesNodes(groupingDefinition));
-        }
-        List<DataSchemaNodeBuilder> childNodes = container.getChildNodeBuilders();
-        for (DataSchemaNodeBuilder childNode : childNodes) {
-            if (childNode instanceof DataNodeContainerBuilder) {
-                ret.addAll(getAllUsesNodes((DataNodeContainerBuilder) childNode));
-            } else if (childNode instanceof ChoiceBuilder) {
-                Set<ChoiceCaseBuilder> cases = ((ChoiceBuilder) childNode).getCases();
-                for (ChoiceCaseBuilder choiceCaseNode : cases) {
-                    ret.addAll(getAllUsesNodes(choiceCaseNode));
-                }
-            }
-        }
-        return ret;
-    }
-
-}
index 2311abf1d2d8b287acb2e517bf8970e6b8820f47..6971226c793c6057112b8cc3e5e0e0cd31601f51 100644 (file)
 
 package org.opendaylight.yangtools.yang.parser.impl;
 
-import static com.google.common.base.Preconditions.checkState;
-import com.google.common.base.CharMatcher;
 import com.google.common.base.Optional;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
 import org.antlr.v4.runtime.ParserRuleContext;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Argument_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Base_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Bit_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Bits_specificationContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Config_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Config_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Decimal64_specificationContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Default_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Description_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Enum_specificationContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Enum_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Error_app_tag_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Error_message_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Fraction_digits_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Identityref_specificationContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Instance_identifier_specificationContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Key_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Leafref_specificationContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Length_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Mandatory_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Mandatory_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Max_elements_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Max_value_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Min_elements_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Min_value_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Must_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Numerical_restrictionsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Ordered_by_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Ordered_by_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Path_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Pattern_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Position_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Presence_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Range_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Reference_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Refine_anyxml_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Refine_choice_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Refine_container_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Refine_leaf_list_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Refine_leaf_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Refine_list_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Refine_pomContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Refine_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Require_instance_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Require_instance_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Status_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Status_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.StringContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.String_restrictionsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Type_body_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Units_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Value_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.When_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Yin_element_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Yin_element_stmtContext;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit;
-import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair;
-import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
-import org.opendaylight.yangtools.yang.model.util.BaseConstraints;
-import org.opendaylight.yangtools.yang.model.util.BaseTypes;
-import org.opendaylight.yangtools.yang.model.util.BinaryType;
-import org.opendaylight.yangtools.yang.model.util.BitImpl;
-import org.opendaylight.yangtools.yang.model.util.BitsType;
-import org.opendaylight.yangtools.yang.model.util.Decimal64;
-import org.opendaylight.yangtools.yang.model.util.EnumerationType;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.model.util.InstanceIdentifierType;
-import org.opendaylight.yangtools.yang.model.util.Int16;
-import org.opendaylight.yangtools.yang.model.util.Int32;
-import org.opendaylight.yangtools.yang.model.util.Int64;
-import org.opendaylight.yangtools.yang.model.util.Int8;
-import org.opendaylight.yangtools.yang.model.util.Leafref;
-import org.opendaylight.yangtools.yang.model.util.MustDefinitionImpl;
-import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
-import org.opendaylight.yangtools.yang.model.util.StringType;
-import org.opendaylight.yangtools.yang.model.util.Uint16;
-import org.opendaylight.yangtools.yang.model.util.Uint32;
-import org.opendaylight.yangtools.yang.model.util.Uint64;
-import org.opendaylight.yangtools.yang.model.util.Uint8;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.RefineBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ChoiceCaseBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.RefineHolderImpl;
-import org.opendaylight.yangtools.yang.parser.builder.impl.TypeDefinitionBuilderImpl;
-import org.opendaylight.yangtools.yang.parser.builder.impl.UnionTypeBuilder;
-import org.opendaylight.yangtools.yang.parser.util.TypeConstraints;
-import org.opendaylight.yangtools.yang.parser.util.UnknownBoundaryNumber;
 import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public final class ParserListenerUtils {
-    private static final int UNICODE_SCRIPT_FIX_COUNTER = 30;
-    private static final Logger LOG = LoggerFactory.getLogger(ParserListenerUtils.class);
-    private static final Splitter KEYDEF_SPLITTER = Splitter.on(' ').omitEmptyStrings();
-    private static final Splitter PIPE_SPLITTER = Splitter.on('|').trimResults();
-    private static final Splitter DOT_DOT_SPLITTER = Splitter.on("..").trimResults();
-    private static final CharMatcher DOUBLE_QUOTE_MATCHER = CharMatcher.is('"');
-    private static final CharMatcher SINGLE_QUOTE_MATCHER = CharMatcher.is('\'');
-    private static final Pattern BETWEEN_CURLY_BRACES_PATTERN = Pattern.compile("\\{(.+?)\\}");
-    private static final Set<String> JAVA_UNICODE_BLOCKS = ImmutableSet.<String>builder()
-            .add("AegeanNumbers")
-            .add("AlchemicalSymbols")
-            .add("AlphabeticPresentationForms")
-            .add("AncientGreekMusicalNotation")
-            .add("AncientGreekNumbers")
-            .add("AncientSymbols")
-            .add("Arabic")
-            .add("ArabicPresentationForms-A")
-            .add("ArabicPresentationForms-B")
-            .add("ArabicSupplement")
-            .add("Armenian")
-            .add("Arrows")
-            .add("Avestan")
-            .add("Balinese")
-            .add("Bamum")
-            .add("BamumSupplement")
-            .add("BasicLatin")
-            .add("Batak")
-            .add("Bengali")
-            .add("BlockElements")
-            .add("Bopomofo")
-            .add("BopomofoExtended")
-            .add("BoxDrawing")
-            .add("Brahmi")
-            .add("BraillePatterns")
-            .add("Buginese")
-            .add("Buhid")
-            .add("ByzantineMusicalSymbols")
-            .add("Carian")
-            .add("Cham")
-            .add("Cherokee")
-            .add("CJKCompatibility")
-            .add("CJKCompatibilityForms")
-            .add("CJKCompatibilityIdeographs")
-            .add("CJKCompatibilityIdeographsSupplement")
-            .add("CJKRadicalsSupplement")
-            .add("CJKStrokes")
-            .add("CJKSymbolsandPunctuation")
-            .add("CJKUnifiedIdeographs")
-            .add("CJKUnifiedIdeographsExtensionA")
-            .add("CJKUnifiedIdeographsExtensionB")
-            .add("CJKUnifiedIdeographsExtensionC")
-            .add("CJKUnifiedIdeographsExtensionD")
-            .add("CombiningDiacriticalMarks")
-            .add("CombiningDiacriticalMarksSupplement")
-            .add("CombiningHalfMarks")
-            .add("CombiningDiacriticalMarksforSymbols")
-            .add("CommonIndicNumberForms")
-            .add("ControlPictures")
-            .add("Coptic")
-            .add("CountingRodNumerals")
-            .add("Cuneiform")
-            .add("CuneiformNumbersandPunctuation")
-            .add("CurrencySymbols")
-            .add("CypriotSyllabary")
-            .add("Cyrillic")
-            .add("CyrillicExtended-A")
-            .add("CyrillicExtended-B")
-            .add("CyrillicSupplementary")
-            .add("Deseret")
-            .add("Devanagari")
-            .add("DevanagariExtended")
-            .add("Dingbats")
-            .add("DominoTiles")
-            .add("EgyptianHieroglyphs")
-            .add("Emoticons")
-            .add("EnclosedAlphanumericSupplement")
-            .add("EnclosedAlphanumerics")
-            .add("EnclosedCJKLettersandMonths")
-            .add("EnclosedIdeographicSupplement")
-            .add("Ethiopic")
-            .add("EthiopicExtended")
-            .add("EthiopicExtended-A")
-            .add("EthiopicSupplement")
-            .add("GeneralPunctuation")
-            .add("GeometricShapes")
-            .add("Georgian")
-            .add("GeorgianSupplement")
-            .add("Glagolitic")
-            .add("Gothic")
-            .add("GreekandCoptic")
-            .add("GreekExtended")
-            .add("Gujarati")
-            .add("Gurmukhi")
-            .add("HalfwidthandFullwidthForms")
-            .add("HangulCompatibilityJamo")
-            .add("HangulJamo")
-            .add("HangulJamoExtended-A")
-            .add("HangulJamoExtended-B")
-            .add("HangulSyllables")
-            .add("Hanunoo")
-            .add("Hebrew")
-            .add("HighPrivateUseSurrogates")
-            .add("HighSurrogates")
-            .add("Hiragana")
-            .add("IdeographicDescriptionCharacters")
-            .add("ImperialAramaic")
-            .add("InscriptionalPahlavi")
-            .add("InscriptionalParthian")
-            .add("IPAExtensions")
-            .add("Javanese")
-            .add("Kaithi")
-            .add("KanaSupplement")
-            .add("Kanbun")
-            .add("Kangxi Radicals")
-            .add("Kannada")
-            .add("Katakana")
-            .add("KatakanaPhoneticExtensions")
-            .add("KayahLi")
-            .add("Kharoshthi")
-            .add("Khmer")
-            .add("KhmerSymbols")
-            .add("Lao")
-            .add("Latin-1Supplement")
-            .add("LatinExtended-A")
-            .add("LatinExtendedAdditional")
-            .add("LatinExtended-B")
-            .add("LatinExtended-C")
-            .add("LatinExtended-D")
-            .add("Lepcha")
-            .add("LetterlikeSymbols")
-            .add("Limbu")
-            .add("LinearBIdeograms")
-            .add("LinearBSyllabary")
-            .add("Lisu")
-            .add("LowSurrogates")
-            .add("Lycian")
-            .add("Lydian")
-            .add("MahjongTiles")
-            .add("Malayalam")
-            .add("Mandaic")
-            .add("MathematicalAlphanumericSymbols")
-            .add("MathematicalOperators")
-            .add("MeeteiMayek")
-            .add("MiscellaneousMathematicalSymbols-A")
-            .add("MiscellaneousMathematicalSymbols-B")
-            .add("MiscellaneousSymbols")
-            .add("MiscellaneousSymbolsandArrows")
-            .add("MiscellaneousSymbolsAndPictographs")
-            .add("MiscellaneousTechnical")
-            .add("ModifierToneLetters")
-            .add("Mongolian")
-            .add("MusicalSymbols")
-            .add("Myanmar")
-            .add("MyanmarExtended-A")
-            .add("NewTaiLue")
-            .add("NKo")
-            .add("NumberForms")
-            .add("Ogham")
-            .add("OlChiki")
-            .add("OldItalic")
-            .add("OldPersian")
-            .add("OldSouthArabian")
-            .add("OldTurkic")
-            .add("OpticalCharacterRecognition")
-            .add("Oriya")
-            .add("Osmanya")
-            .add("Phags-pa")
-            .add("PhaistosDisc")
-            .add("Phoenician")
-            .add("PhoneticExtensions")
-            .add("PhoneticExtensionsSupplement")
-            .add("PlayingCards")
-            .add("PrivateUseArea")
-            .add("Rejang")
-            .add("RumiNumeralSymbols")
-            .add("Runic")
-            .add("Samaritan")
-            .add("Saurashtra")
-            .add("Shavian")
-            .add("Sinhala")
-            .add("SmallFormVariants")
-            .add("SpacingModifierLetters")
-            .add("Specials")
-            .add("Sundanese")
-            .add("SuperscriptsandSubscripts")
-            .add("SupplementalArrows-A")
-            .add("SupplementalArrows-B")
-            .add("SupplementalMathematicalOperators")
-            .add("SupplementalPunctuation")
-            .add("SupplementaryPrivateUseArea-A")
-            .add("SupplementaryPrivateUseArea-B")
-            .add("SylotiNagri")
-            .add("Syriac")
-            .add("Tagalog")
-            .add("Tagbanwa")
-            .add("Tags")
-            .add("TaiLe")
-            .add("TaiTham")
-            .add("TaiViet")
-            .add("TaiXuanJingSymbols")
-            .add("Tamil")
-            .add("Telugu")
-            .add("Thaana")
-            .add("Thai")
-            .add("Tibetan")
-            .add("Tifinagh")
-            .add("TransportAndMapSymbols")
-            .add("Ugaritic")
-            .add("UnifiedCanadianAboriginalSyllabics")
-            .add("UnifiedCanadianAboriginalSyllabicsExtended")
-            .add("Vai")
-            .add("VariationSelectors")
-            .add("VariationSelectorsSupplement")
-            .add("VedicExtensions")
-            .add("VerticalForms")
-            .add("YiRadicals")
-            .add("YiSyllables")
-            .add("YijingHexagramSymbols").build();
 
     private ParserListenerUtils() {
     }
 
-    /**
-     * Parse given tree and get first string value.
-     *
-     * @param treeNode
-     *            tree to parse
-     * @return first string value from given tree
-     */
-    public static String stringFromNode(final ParseTree treeNode) {
-        String result = "";
-        for (int i = 0; i < treeNode.getChildCount(); ++i) {
-            final ParseTree child = treeNode.getChild(i);
-            if (child instanceof StringContext) {
-                return stringFromStringContext((StringContext)child);
-            }
-        }
-        return result;
-    }
-
-    private static String stringFromStringContext(final StringContext context) {
-        StringBuilder sb = new StringBuilder();
-        for (TerminalNode stringNode : context.STRING()) {
-            final String str = stringNode.getText();
-            char firstChar = str.charAt(0);
-            final CharMatcher quoteMatcher;
-            if (SINGLE_QUOTE_MATCHER.matches(firstChar)) {
-                quoteMatcher = SINGLE_QUOTE_MATCHER;
-            } else if (DOUBLE_QUOTE_MATCHER.matches(firstChar)) {
-                quoteMatcher = DOUBLE_QUOTE_MATCHER;
-            } else {
-                sb.append(str);
-                continue;
-            }
-            /*
-             *
-             * It is safe not to check last argument to be same
-             * grammars enforces that.
-             *
-             * FIXME: Introduce proper escaping and translation of escaped
-             * characters here.
-             *
-             */
-            sb.append(quoteMatcher.removeFrom(str.substring(1, str.length()-1)));
-        }
-        return sb.toString();
-    }
-
-    private static String getParentModule(final ParseTree ctx) {
-        ParseTree current = ctx;
-        while (current != null && !(current instanceof Module_stmtContext)) {
-            current = current.getParent();
-        }
-        if (current != null) {
-            Module_stmtContext module = (Module_stmtContext) current;
-            for (int i = 0; i < module.getChildCount(); i++) {
-                if (module.getChild(i) instanceof StringContext) {
-                    final StringContext str = (StringContext) module.getChild(i);
-                    return str.getChild(0).getText();
-                }
-            }
-        }
-        return "";
-    }
-
-    /**
-     * Parse 'description', 'reference' and 'status' statements and fill in
-     * given builder.
-     *
-     * @param ctx
-     *            context to parse
-     * @param builder
-     *            builder to fill in with parsed statements
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    public static void parseSchemaNodeArgs(final ParseTree ctx, final SchemaNodeBuilder builder) {
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Description_stmtContext) {
-                final String desc = stringFromNode(child);
-                builder.setDescription(desc);
-            } else if (child instanceof Reference_stmtContext) {
-                final String ref = stringFromNode(child);
-                builder.setReference(ref);
-            } else if (child instanceof Status_stmtContext) {
-                final Status status = parseStatus((Status_stmtContext) child);
-                builder.setStatus(status);
-            }
-        }
-    }
-
-    /**
-     * Parse given context and return its value;
-     *
-     * @param ctx
-     *            status context
-     * @return value parsed from context
-     */
-    public static Status parseStatus(final Status_stmtContext ctx) {
-        Status result = null;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree statusArg = ctx.getChild(i);
-            if (statusArg instanceof Status_argContext) {
-                String statusArgStr = stringFromNode(statusArg);
-                switch (statusArgStr) {
-                case "current":
-                    result = Status.CURRENT;
-                    break;
-                case "deprecated":
-                    result = Status.DEPRECATED;
-                    break;
-                case "obsolete":
-                    result = Status.OBSOLETE;
-                    break;
-                default:
-                    LOG.warn("Invalid 'status' statement: " + statusArgStr);
-                }
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Parse given tree and returns units statement as string.
-     *
-     * @param ctx
-     *            context to parse
-     * @return value of units statement as string or null if there is no units
-     *         statement
-     */
-    public static String parseUnits(final ParseTree ctx) {
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Units_stmtContext) {
-                return stringFromNode(child);
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Parse given tree and returns default statement as string.
-     *
-     * @param ctx
-     *            context to parse
-     * @return value of default statement as string or null if there is no
-     *         default statement
-     */
-    public static String parseDefault(final ParseTree ctx) {
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Default_stmtContext) {
-                return stringFromNode(child);
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Create java.util.LinkedHashSet of key node names.
-     *
-     * @param ctx
-     *            Key_stmtContext context
-     * @return YANG list key as java.util.LinkedHashSet of key node names
-     */
-    public static Set<String> createListKey(final Key_stmtContext ctx) {
-        final String keyDefinition = stringFromNode(ctx);
-        return Sets.newLinkedHashSet(KEYDEF_SPLITTER.split(keyDefinition));
-    }
-
-    /**
-     * Parse given type body of enumeration statement.
-     *
-     * @param ctx
-     *            type body context to parse
-     * @param path
-     *            actual position in YANG model
-     * @param moduleName
-     *            current module name
-     * @return List of EnumPair object parsed from given context
-     */
-    private static List<EnumTypeDefinition.EnumPair> getEnumConstants(final Type_body_stmtsContext ctx,
-            final SchemaPath path, final String moduleName) {
-        List<EnumTypeDefinition.EnumPair> enumConstants = new ArrayList<>();
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree enumSpecChild = ctx.getChild(i);
-            if (enumSpecChild instanceof Enum_specificationContext) {
-                int highestValue = -1;
-                for (int j = 0; j < enumSpecChild.getChildCount(); j++) {
-                    ParseTree enumChild = enumSpecChild.getChild(j);
-                    if (enumChild instanceof Enum_stmtContext) {
-                        EnumPair enumPair = createEnumPair((Enum_stmtContext) enumChild, highestValue, path, moduleName);
-                        if (enumPair.getValue() > highestValue) {
-                            highestValue = enumPair.getValue();
-                        }
-                        enumConstants.add(enumPair);
-                    }
-                }
-            }
-        }
-        return enumConstants;
-    }
-
-    /**
-     * Parse enum statement context
-     *
-     * @param ctx
-     *            enum statement context
-     * @param highestValue
-     *            current highest value in enumeration
-     * @param actualPath
-     *            actual position in YANG model
-     * @param moduleName
-     *            current module name
-     * @return EnumPair object parsed from given context
-     */
-    private static EnumTypeDefinition.EnumPair createEnumPair(final Enum_stmtContext ctx, final int highestValue,
-            final SchemaPath actualPath, final String moduleName) {
-        final String name = stringFromNode(ctx);
-        SchemaPath path = createTypePath(actualPath, name);
-        Integer value = null;
-
-        String description = null;
-        String reference = null;
-        Status status = null;
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Value_stmtContext) {
-                String valueStr = stringFromNode(child);
-                try {
-                    // yang enum value has same restrictions as JAVA Integer
-                    value = Integer.valueOf(valueStr);
-                } catch (NumberFormatException e) {
-                    String err = String
-                            .format("Error on enum '%s': the enum value MUST be in the range from -2147483648 to 2147483647, but was: %s",
-                                    name, valueStr);
-                    throw new YangParseException(moduleName, ctx.getStart().getLine(), err, e);
-                }
-            } else if (child instanceof Description_stmtContext) {
-                description = stringFromNode(child);
-            } else if (child instanceof Reference_stmtContext) {
-                reference = stringFromNode(child);
-            } else if (child instanceof Status_stmtContext) {
-                status = parseStatus((Status_stmtContext) child);
-            }
-        }
-
-        if (value == null) {
-            value = highestValue + 1;
-        }
-
-        EnumPairImpl result = new EnumPairImpl();
-        result.qname = path.getPathTowardsRoot().iterator().next();
-        result.path = path;
-        result.description = description;
-        result.reference = reference;
-        result.status = status;
-        result.name = name;
-        result.value = value;
-        return result;
-    }
-
-    /**
-     * Internal implementation of EnumPair.
-     */
-    private static class EnumPairImpl implements EnumTypeDefinition.EnumPair {
-        private QName qname;
-        private SchemaPath path;
-        private String description;
-        private String reference;
-        private Status status;
-        private final List<UnknownSchemaNode> unknownNodes = Collections.emptyList();
-        private String name;
-        private Integer value;
-
-        @Override
-        public QName getQName() {
-            return qname;
-        }
-
-        @Override
-        public SchemaPath getPath() {
-            return path;
-        }
-
-        @Override
-        public String getDescription() {
-            return description;
-        }
-
-        @Override
-        public String getReference() {
-            return reference;
-        }
-
-        @Override
-        public Status getStatus() {
-            return status;
-        }
-
-        @Override
-        public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-            return unknownNodes;
-        }
-
-        @Override
-        public String getName() {
-            return name;
-        }
-
-        @Override
-        public Integer getValue() {
-            return value;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + Objects.hashCode(qname);
-            result = prime * result + Objects.hashCode(path);
-            result = prime * result + Objects.hashCode(unknownNodes);
-            result = prime * result + Objects.hashCode(name);
-            result = prime * result + Objects.hashCode(value);
-            return result;
-        }
-
-        @Override
-        public boolean equals(final Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (getClass() != obj.getClass()) {
-                return false;
-            }
-            EnumPairImpl other = (EnumPairImpl) obj;
-            if (qname == null) {
-                if (other.qname != null) {
-                    return false;
-                }
-            } else if (!qname.equals(other.qname)) {
-                return false;
-            }
-            if (path == null) {
-                if (other.path != null) {
-                    return false;
-                }
-            } else if (!path.equals(other.path)) {
-                return false;
-            }
-            if (unknownNodes == null) {
-                if (other.unknownNodes != null) {
-                    return false;
-                }
-            } else if (!unknownNodes.equals(other.unknownNodes)) {
-                return false;
-            }
-            if (name == null) {
-                if (other.name != null) {
-                    return false;
-                }
-            } else if (!name.equals(other.name)) {
-                return false;
-            }
-            if (value == null) {
-                if (other.value != null) {
-                    return false;
-                }
-            } else if (!value.equals(other.value)) {
-                return false;
-            }
-            return true;
-        }
-
-        @Override
-        public String toString() {
-            return EnumTypeDefinition.EnumPair.class.getSimpleName() + "[name=" + name + ", value=" + value + "]";
-        }
-    }
-
-    /**
-     * Get and parse range from given type body context.
-     *
-     * @param ctx
-     *            type body context to parse
-     * @param moduleName
-     *            name of current module
-     * @return List of RangeConstraint created from this context
-     */
-    private static List<RangeConstraint> getRangeConstraints(final Type_body_stmtsContext ctx, final String moduleName) {
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree numRestrChild = ctx.getChild(i);
-
-            if (numRestrChild instanceof Numerical_restrictionsContext) {
-                for (int j = 0; j < numRestrChild.getChildCount(); j++) {
-                    ParseTree rangeChild = numRestrChild.getChild(j);
-                    if (rangeChild instanceof Range_stmtContext) {
-                        return parseRangeConstraints((Range_stmtContext) rangeChild, moduleName);
-                    }
-                }
-            }
-
-            if (numRestrChild instanceof Decimal64_specificationContext) {
-                for (int j = 0; j < numRestrChild.getChildCount(); j++) {
-                    ParseTree decRestr = numRestrChild.getChild(j);
-                    if (decRestr instanceof Numerical_restrictionsContext) {
-                        for (int k = 0; k < decRestr.getChildCount(); k++) {
-                            ParseTree rangeChild = decRestr.getChild(k);
-                            if (rangeChild instanceof Range_stmtContext) {
-                                return parseRangeConstraints((Range_stmtContext) rangeChild, moduleName);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return Collections.emptyList();
-    }
-
-    /**
-     * Parse given range context.
-     *
-     * @param ctx
-     *            range context to parse
-     * @param moduleName
-     *            name of current module
-     * @return List of RangeConstraints parsed from this context
-     */
-    private static List<RangeConstraint> parseRangeConstraints(final Range_stmtContext ctx, final String moduleName) {
-        final int line = ctx.getStart().getLine();
-        Optional<String> description = Optional.absent();
-        Optional<String> reference = Optional.absent();
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Description_stmtContext) {
-                description = Optional.fromNullable(stringFromNode(child));
-            } else if (child instanceof Reference_stmtContext) {
-                reference = Optional.fromNullable(stringFromNode(child));
-            }
-        }
-
-        List<RangeConstraint> rangeConstraints = new ArrayList<>();
-        for (String def : PIPE_SPLITTER.split(stringFromNode(ctx))) {
-            final Iterator<String> split = DOT_DOT_SPLITTER.split(def).iterator();
-            final Number min = parseNumberConstraintValue(split.next(), moduleName, line);
-
-            final Number max;
-            if (split.hasNext()) {
-                max = parseNumberConstraintValue(split.next(), moduleName, line);
-                if (split.hasNext()) {
-                    throw new YangParseException(moduleName, ctx.getStart().getLine(), "Malformed length constraint \"" + def + "\".");
-                }
-            } else {
-                max = min;
-            }
-
-            RangeConstraint range = BaseConstraints.newRangeConstraint(min, max, description, reference);
-            rangeConstraints.add(range);
-        }
-
-        return rangeConstraints;
-    }
-
-    /**
-     * Get and parse length from given type body context.
-     *
-     * @param ctx
-     *            type body context to parse
-     * @param moduleName
-     *            name of current module
-     * @return List of LengthConstraint created from this context
-     */
-    private static List<LengthConstraint> getLengthConstraints(final Type_body_stmtsContext ctx, final String moduleName) {
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree stringRestrChild = ctx.getChild(i);
-            if (stringRestrChild instanceof String_restrictionsContext) {
-                for (int j = 0; j < stringRestrChild.getChildCount(); j++) {
-                    ParseTree lengthChild = stringRestrChild.getChild(j);
-                    if (lengthChild instanceof Length_stmtContext) {
-                        return parseLengthConstraints((Length_stmtContext) lengthChild, moduleName);
-                    }
-                }
-            }
-        }
-        return Collections.emptyList();
-    }
-
-    /**
-     * Parse given length context.
-     *
-     * @param ctx
-     *            length context to parse
-     * @param moduleName
-     *            name of current module
-     * @return List of LengthConstraints parsed from this context
-     */
-    private static List<LengthConstraint> parseLengthConstraints(final Length_stmtContext ctx, final String moduleName) {
-        final int line = ctx.getStart().getLine();
-        Optional<String> description = Optional.absent();
-        Optional<String> reference = Optional.absent();
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Description_stmtContext) {
-                description = Optional.fromNullable(stringFromNode(child));
-            } else if (child instanceof Reference_stmtContext) {
-                reference = Optional.fromNullable(stringFromNode(child));
-            }
-        }
-
-        List<LengthConstraint> lengthConstraints = new ArrayList<>();
-        for (String def : PIPE_SPLITTER.split(stringFromNode(ctx))) {
-            final Iterator<String> split = DOT_DOT_SPLITTER.split(def).iterator();
-            final Number min = parseNumberConstraintValue(split.next(), moduleName, line);
-
-            final Number max;
-            if (split.hasNext()) {
-                max = parseNumberConstraintValue(split.next(), moduleName, line);
-                if (split.hasNext()) {
-                    throw new YangParseException(moduleName, ctx.getStart().getLine(), "Malformed length constraint \"" + def + "\".");
-                }
-            } else {
-                max = min;
-            }
-
-            LengthConstraint range = BaseConstraints.newLengthConstraint(min, max, description, reference);
-            lengthConstraints.add(range);
-        }
-
-        return lengthConstraints;
-    }
-
-    /**
-     * @param value
-     *            value to parse
-     * @param moduleName
-     *            name of current module
-     * @param line
-     *            current line in module
-     * @return wrapper object of primitive java type or UnknownBoundaryNumber if
-     *         type is one of special YANG values 'min' or 'max'
-     */
-    private static Number parseNumberConstraintValue(final String value, final String moduleName, final int line) {
-        Number result;
-        if ("min".equals(value) || "max".equals(value)) {
-            result = new UnknownBoundaryNumber(value);
-        } else {
-            try {
-                if (value.indexOf('.') != -1) {
-                    result = new BigDecimal(value);
-                } else {
-                    result = new BigInteger(value);
-                }
-            } catch (NumberFormatException e) {
-                throw new YangParseException(moduleName, line, "Unable to parse range value '" + value + "'.", e);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Parse type body and return pattern constraints.
-     *
-     * @param ctx
-     *            type body
-     * @return list of pattern constraints
-     */
-    private static List<PatternConstraint> getPatternConstraint(final Type_body_stmtsContext ctx, final String moduleName) {
-        List<PatternConstraint> patterns = new ArrayList<>();
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree stringRestrChild = ctx.getChild(i);
-            if (stringRestrChild instanceof String_restrictionsContext) {
-                for (int j = 0; j < stringRestrChild.getChildCount(); j++) {
-                    ParseTree lengthChild = stringRestrChild.getChild(j);
-                    if (lengthChild instanceof Pattern_stmtContext) {
-                        final PatternConstraint constraint = parsePatternConstraint((Pattern_stmtContext) lengthChild,
-                            moduleName);
-                        if (constraint != null) {
-                            patterns.add(constraint);
-                        }
-                    }
-                }
-            }
-        }
-        return patterns;
-    }
-
-    /**
-     * Internal helper method.
-     *
-     * @param ctx
-     *            pattern context
-     * @return PatternConstraint object
-     */
-    private static PatternConstraint parsePatternConstraint(final Pattern_stmtContext ctx, final String moduleName) {
-        Optional<String> description = Optional.absent();
-        Optional<String> reference = Optional.absent();
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Description_stmtContext) {
-                description = Optional.of(stringFromNode(child));
-            } else if (child instanceof Reference_stmtContext) {
-                reference = Optional.of(stringFromNode(child));
-            }
-        }
-        final String rawPattern = parsePatternString(ctx);
-        final String fixedRawPattern = fixUnicodeScriptPattern(rawPattern);
-        final String pattern = wrapPattern(fixedRawPattern);
-        if (isValidPattern(pattern, ctx, moduleName)) {
-            return BaseConstraints.newPatternConstraint(pattern, description, reference);
-        }
-        return null;
-    }
-
-    private static String fixUnicodeScriptPattern(String rawPattern) {
-        for (int i = 0; i < UNICODE_SCRIPT_FIX_COUNTER; i++) {
-            try {
-                Pattern.compile(rawPattern);
-                return rawPattern;
-            } catch(PatternSyntaxException ex) {
-                LOG.debug("Invalid regex pattern syntax in: {}", rawPattern, ex);
-                if (ex.getMessage().contains("Unknown character script name")) {
-                    rawPattern = fixUnknownScripts(ex.getMessage(), rawPattern);
-                } else {
-                    return rawPattern;
-                }
-            }
-        }
-
-        LOG.warn("Regex pattern could not be fixed: {}", rawPattern);
-        return rawPattern;
-    }
-
-    private static String fixUnknownScripts(final String exMessage, final String rawPattern) {
-        StringBuilder result = new StringBuilder(rawPattern);
-        Matcher matcher = BETWEEN_CURLY_BRACES_PATTERN.matcher(exMessage);
-        if (matcher.find()) {
-            String capturedGroup = matcher.group(1);
-            if (JAVA_UNICODE_BLOCKS.contains(capturedGroup)) {
-                int idx = rawPattern.indexOf("Is" + capturedGroup);
-                result = result.replace(idx, idx + 2, "In");
-            }
-        }
-        return result.toString();
-    }
-
-    private static String wrapPattern(final String rawPattern) {
-        return "^" + rawPattern + '$';
-    }
-
-    private static boolean isValidPattern(final String pattern, final Pattern_stmtContext ctx, final String moduleName) {
-        try {
-            Pattern.compile(pattern);
-            return true;
-        } catch (PatternSyntaxException ex) {
-            LOG.warn("Unable to compile pattern defined in module {} at line {}. Error message: {}",
-                moduleName, ctx.getStart().getLine(), ex.getMessage());
-        }
-        return false;
-    }
-
-    /**
-     * Parse given context and return pattern value.
-     *
-     * @param ctx
-     *            context to parse
-     * @return pattern value as String
-     */
-    private static String parsePatternString(final Pattern_stmtContext ctx) {
-        StringBuilder result = new StringBuilder();
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof StringContext) {
-                for (int j = 0; j < child.getChildCount(); j++) {
-                    if (j % 2 == 0) {
-                        String patternToken = child.getChild(j).getText();
-                        result.append(patternToken.substring(1, patternToken.length() - 1));
-                    }
-                }
-            }
-        }
-        return result.toString();
-    }
-
-    /**
-     * Get fraction digits value from type body.
-     *
-     * @param ctx
-     *            type body context to parse
-     * @param moduleName
-     *            name of current module
-     * @return 'fraction-digits' value if present in given context, null
-     *         otherwise
-     */
-    private static Integer getFractionDigits(final Type_body_stmtsContext ctx, final String moduleName) {
-        Integer result = null;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree dec64specChild = ctx.getChild(i);
-            if (dec64specChild instanceof Decimal64_specificationContext) {
-                result = parseFractionDigits((Decimal64_specificationContext) dec64specChild, moduleName);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Parse decimal64 fraction-digits value.
-     *
-     * @param ctx
-     *            decimal64 context
-     * @param moduleName
-     *            name of current module
-     * @return fraction-digits value as Integer
-     */
-    private static Integer parseFractionDigits(final Decimal64_specificationContext ctx, final String moduleName) {
-        Integer result = null;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree fdChild = ctx.getChild(i);
-            if (fdChild instanceof Fraction_digits_stmtContext) {
-                String value = stringFromNode(fdChild);
-                try {
-                    result = Integer.valueOf(value);
-                } catch (NumberFormatException e) {
-                    throw new YangParseException(moduleName, ctx.getStart().getLine(),
-                            "Unable to parse fraction digits value '" + value + "'.", e);
-                }
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Internal helper method for parsing bit statements from given type body
-     * context.
-     *
-     * @param ctx
-     *            type body context to parse
-     * @param actualPath
-     *            current position in YANG model
-     * @param moduleName
-     *            current module name
-     * @return List of Bit objects created from this context
-     */
-    private static List<BitsTypeDefinition.Bit> getBits(final Type_body_stmtsContext ctx, final SchemaPath actualPath,
-            final String moduleName) {
-        final List<BitsTypeDefinition.Bit> bits = new ArrayList<>();
-        for (int j = 0; j < ctx.getChildCount(); j++) {
-            ParseTree bitsSpecChild = ctx.getChild(j);
-            if (bitsSpecChild instanceof Bits_specificationContext) {
-                long highestPosition = -1;
-                for (int k = 0; k < bitsSpecChild.getChildCount(); k++) {
-                    ParseTree bitChild = bitsSpecChild.getChild(k);
-                    if (bitChild instanceof Bit_stmtContext) {
-                        Bit bit = parseBit((Bit_stmtContext) bitChild, highestPosition, actualPath, moduleName);
-                        if (bit.getPosition() > highestPosition) {
-                            highestPosition = bit.getPosition();
-                        }
-                        bits.add(bit);
-                    }
-                }
-            }
-        }
-        return bits;
-    }
-
-    /**
-     * Internal helper method for parsing bit context.
-     *
-     * @param ctx
-     *            bit statement context to parse
-     * @param highestPosition
-     *            current highest position in bits type
-     * @param actualPath
-     *            current position in YANG model
-     * @param moduleName
-     *            current module name
-     * @return Bit object parsed from this context
-     */
-    private static BitsTypeDefinition.Bit parseBit(final Bit_stmtContext ctx, final long highestPosition,
-            final SchemaPath actualPath, final String moduleName) {
-        String name = stringFromNode(ctx);
-        Long position = null;
-
-        String description = null;
-        String reference = null;
-        Status status = Status.CURRENT;
-
-        SchemaPath schemaPath = createBaseTypePath(actualPath, name);
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Position_stmtContext) {
-                String positionStr = stringFromNode(child);
-                position = Long.valueOf(positionStr);
-            } else if (child instanceof Description_stmtContext) {
-                description = stringFromNode(child);
-            } else if (child instanceof Reference_stmtContext) {
-                reference = stringFromNode(child);
-            } else if (child instanceof Status_stmtContext) {
-                status = parseStatus((Status_stmtContext) child);
-            }
-        }
-
-        if (position == null) {
-            position = highestPosition + 1;
-        }
-        if (position < 0 || position > 4294967295L) {
-            throw new YangParseException(moduleName, ctx.getStart().getLine(), "Error on bit '" + name
-                    + "': the position value MUST be in the range 0 to 4294967295");
-        }
-
-        final List<UnknownSchemaNode> unknownNodes = Collections.emptyList();
-        return new BitImpl(position, schemaPath.getPathTowardsRoot().iterator().next(), schemaPath,
-                description, reference, status, unknownNodes);
-    }
-
-    /**
-     * Parse 'ordered-by' statement.
-     *
-     * The 'ordered-by' statement defines whether the order of entries within a
-     * list are determined by the user or the system. The argument is one of the
-     * strings "system" or "user". If not present, order defaults to "system".
-     *
-     * @param ctx
-     *            Ordered_by_stmtContext
-     * @return true, if ordered-by contains value 'user', false otherwise
-     */
-    public static boolean parseUserOrdered(final Ordered_by_stmtContext ctx) {
-        boolean result = false;
-        for (int j = 0; j < ctx.getChildCount(); j++) {
-            ParseTree orderArg = ctx.getChild(j);
-            if (orderArg instanceof Ordered_by_argContext) {
-                String orderStr = stringFromNode(orderArg);
-                switch (orderStr) {
-                case "system":
-                    result = false;
-                    break;
-                case "user":
-                    result = true;
-                    break;
-                default:
-                    LOG.warn("Invalid 'ordered-by' statement.");
-                }
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Get config statement from given context. If there is no config statement,
-     * return config value of parent
-     *
-     * @param ctx
-     *            context to parse
-     * @param node
-     *            current node
-     * @param moduleName
-     *            name of current module
-     * @param line
-     *            line in current module
-     * @return config statement parsed from given context
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    public static boolean getConfig(final ParseTree ctx, final Builder node, final String moduleName, final int line) {
-        boolean result;
-        // parse configuration statement
-        Boolean config = null;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Config_stmtContext) {
-                config = parseConfig((Config_stmtContext) child, moduleName);
-                break;
-            }
-        }
-
-        // If 'config' is not specified, the default is the same as the parent
-        // schema node's 'config' value
-        boolean parentConfig = getParentConfig(node);
-        if (config == null) {
-            result = parentConfig;
-        } else {
-            // Check: if a node has 'config' set to 'false', no node underneath
-            // it can have 'config' set to 'true'
-            if (!parentConfig && config) {
-                throw new YangParseException(moduleName, line,
-                        "Can not set 'config' to 'true' if parent node has 'config' set to 'false'");
-            }
-            result = config;
-        }
-
-        return result;
-    }
-
-    /**
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    private static boolean getParentConfig(final Builder node) {
-        Builder parent = node.getParent();
-        boolean config;
-
-        if (parent instanceof ChoiceCaseBuilder) {
-            parent = parent.getParent();
-        }
-        if (parent instanceof DataSchemaNodeBuilder) {
-            config = ((DataSchemaNodeBuilder) parent).isConfiguration();
-        } else {
-            config = true;
-        }
-        return config;
-    }
-
-    /**
-     * Parse config statement.
-     *
-     * @param ctx
-     *            config context to parse
-     * @param moduleName
-     *            current module name
-     * @return true if given context contains string 'true', false otherwise
-     */
-    private static Boolean parseConfig(final Config_stmtContext ctx, final String moduleName) {
-        Boolean result = null;
-        if (ctx != null) {
-            for (int i = 0; i < ctx.getChildCount(); ++i) {
-                final ParseTree configContext = ctx.getChild(i);
-                if (configContext instanceof Config_argContext) {
-                    final String value = stringFromNode(configContext);
-                    switch (value) {
-                    case "true":
-                        result = true;
-                        break;
-                    case "false":
-                        result = false;
-                        break;
-                    default:
-                        throw new YangParseException(moduleName, ctx.getStart().getLine(),
-                                "Failed to parse 'config' statement value: '" + value + "'.");
-                    }
-                }
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Parse unknown type with body.
-     *
-     * @param typeBody
-     *            type body
-     * @param parent
-     *            current node parent
-     * @param prefixedQName
-     *            type qname with prefix
-     * @param moduleBuilder
-     *            current module builder
-     * @param moduleQName
-     *            current module qname
-     * @param actualPath
-     *            actual path in model
-     *
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    public static void parseUnknownTypeWithBody(final Type_body_stmtsContext typeBody, final TypeAwareBuilder parent,
-            final QName prefixedQName, final ModuleBuilder moduleBuilder, final QName moduleQName, final SchemaPath actualPath) {
-        final int line = typeBody.getStart().getLine();
-
-        List<RangeConstraint> rangeStatements = getRangeConstraints(typeBody, moduleBuilder.getName());
-        List<LengthConstraint> lengthStatements = getLengthConstraints(typeBody, moduleBuilder.getName());
-        List<PatternConstraint> patternStatements = getPatternConstraint(typeBody, moduleBuilder.getName());
-        Integer fractionDigits = getFractionDigits(typeBody, moduleBuilder.getName());
-
-        if (parent instanceof TypeDefinitionBuilder && !(parent instanceof UnionTypeBuilder)) {
-            TypeDefinitionBuilder typedef = (TypeDefinitionBuilder) parent;
-            typedef.setRanges(rangeStatements);
-            typedef.setLengths(lengthStatements);
-            typedef.setPatterns(patternStatements);
-            typedef.setFractionDigits(fractionDigits);
-            typedef.setTypeQName(prefixedQName);
-            // add parent node of this type statement to dirty nodes
-            moduleBuilder.markActualNodeDirty();
-        } else {
-            QName qname = QName.create(moduleQName, prefixedQName.getLocalName());
-            SchemaPath schemaPath = createTypePath(actualPath, prefixedQName.getLocalName());
-            TypeDefinitionBuilder typeBuilder = new TypeDefinitionBuilderImpl(moduleBuilder.getName(), line, qname, schemaPath);
-            typeBuilder.setRanges(rangeStatements);
-            typeBuilder.setLengths(lengthStatements);
-            typeBuilder.setPatterns(patternStatements);
-            typeBuilder.setFractionDigits(fractionDigits);
-            typeBuilder.setTypeQName(prefixedQName);
-            parent.setTypedef(typeBuilder);
-            moduleBuilder.getDirtyNodes().add(typeBuilder);
-        }
-    }
-
-    /**
-     * Create TypeDefinition object based on given type name and type body.
-     *
-     * @param typeName
-     *            name of type
-     * @param typeBody
-     *            type body context
-     * @param actualPath
-     *            current path in schema
-     * @param moduleQName
-     *            current module qname
-     * @param parent
-     *            parent builder
-     * @return TypeDefinition object based on parsed values.
-     *
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    public static TypeDefinition<?> parseTypeWithBody(final String typeName, final Type_body_stmtsContext typeBody,
-            final SchemaPath actualPath, final QName moduleQName, final Builder parent) {
-
-        final String moduleName = parent.getModuleName();
-        final int line = typeBody.getStart().getLine();
-        TypeDefinition<?> baseType = null;
-
-        Integer fractionDigits = getFractionDigits(typeBody, moduleName);
-        List<LengthConstraint> lengthStatements = getLengthConstraints(typeBody, moduleName);
-        List<PatternConstraint> patternStatements = getPatternConstraint(typeBody, moduleName);
-        List<RangeConstraint> rangeStatements = getRangeConstraints(typeBody, moduleName);
-
-        TypeConstraints constraints = new TypeConstraints(moduleName, line);
-        constraints.addFractionDigits(fractionDigits);
-        constraints.addLengths(lengthStatements);
-        constraints.addPatterns(patternStatements);
-        constraints.addRanges(rangeStatements);
-
-        SchemaPath baseTypePath = createBaseTypePath(actualPath, typeName);
-        SchemaPath extBaseTypePath = createExtendedBaseTypePath(actualPath, moduleQName, typeName);
-
-        if (parent instanceof TypeDefinitionBuilder && !(parent instanceof UnionTypeBuilder)) {
-            extBaseTypePath = baseTypePath;
-        }
-
-        if ("decimal64".equals(typeName)) {
-            if (rangeStatements.isEmpty()) {
-                try {
-                    return Decimal64.create(baseTypePath, fractionDigits);
-                } catch(Exception e) {
-                    throw new YangParseException(moduleName, line, e.getMessage());
-                }
-            }
-            Decimal64 decimalType = Decimal64.create(extBaseTypePath, fractionDigits);
-            constraints.addRanges(decimalType.getRangeConstraints());
-            baseType = decimalType;
-        } else if (typeName.startsWith("int")) {
-            IntegerTypeDefinition intType = null;
-            switch (typeName) {
-            case "int8":
-                intType = Int8.getInstance();
-                break;
-            case "int16":
-                intType = Int16.getInstance();
-                break;
-            case "int32":
-                intType = Int32.getInstance();
-                break;
-            case "int64":
-                intType = Int64.getInstance();
-                break;
-            }
-            if (intType == null) {
-                throw new YangParseException(moduleName, line, "Unknown yang type " + typeName);
-            }
-            constraints.addRanges(intType.getRangeConstraints());
-            baseType = intType;
-        } else if (typeName.startsWith("uint")) {
-            UnsignedIntegerTypeDefinition uintType = null;
-            switch (typeName) {
-            case "uint8":
-                uintType = Uint8.getInstance();
-                break;
-            case "uint16":
-                uintType = Uint16.getInstance();
-                break;
-            case "uint32":
-                uintType = Uint32.getInstance();
-                break;
-            case "uint64":
-                uintType = Uint64.getInstance();
-                break;
-            }
-            if (uintType == null) {
-                throw new YangParseException(moduleName, line, "Unknown yang type " + typeName);
-            }
-            constraints.addRanges(uintType.getRangeConstraints());
-            baseType = uintType;
-        } else if ("enumeration".equals(typeName)) {
-            List<EnumTypeDefinition.EnumPair> enumConstants = getEnumConstants(typeBody, actualPath, moduleName);
-            return EnumerationType.create(baseTypePath, enumConstants, Optional.absent());
-        } else if ("string".equals(typeName)) {
-            StringTypeDefinition stringType = StringType.getInstance();
-            constraints.addLengths(stringType.getLengthConstraints());
-            baseType = stringType;
-        } else if ("bits".equals(typeName)) {
-            return BitsType.create(baseTypePath, getBits(typeBody, actualPath, moduleName));
-        } else if ("leafref".equals(typeName)) {
-            final String path = parseLeafrefPath(typeBody);
-            final boolean absolute = path.startsWith("/");
-            RevisionAwareXPath xpath = new RevisionAwareXPathImpl(path, absolute);
-            return new Leafref(xpath);
-        } else if ("binary".equals(typeName)) {
-            BinaryTypeDefinition binaryType = BinaryType.getInstance();
-            constraints.addLengths(binaryType.getLengthConstraints());
-            baseType = binaryType;
-        } else if ("instance-identifier".equals(typeName)) {
-            return InstanceIdentifierType.create(isRequireInstance(typeBody));
-        }
-
-        if (parent instanceof TypeDefinitionBuilder && !(parent instanceof UnionTypeBuilder)) {
-            TypeDefinitionBuilder typedef = (TypeDefinitionBuilder) parent;
-            typedef.setRanges(constraints.getRange());
-            typedef.setLengths(constraints.getLength());
-            typedef.setPatterns(constraints.getPatterns());
-            typedef.setFractionDigits(constraints.getFractionDigits());
-            return baseType;
-        }
-
-        QName qname = QName.create(moduleQName, typeName);
-        SchemaPath schemaPath = actualPath.createChild(qname);
-        final Optional<String> opt = Optional.of("");
-        ExtendedType.Builder typeBuilder = ExtendedType.builder(qname, baseType, opt, opt, schemaPath);
-
-        typeBuilder.ranges(constraints.getRange());
-        typeBuilder.lengths(constraints.getLength());
-        typeBuilder.patterns(constraints.getPatterns());
-        typeBuilder.fractionDigits(constraints.getFractionDigits());
-
-        return typeBuilder.build();
-    }
-
-    private static SchemaPath createTypePath(final SchemaPath actual, final String typeName) {
-        QName last = actual.getLastComponent();
-        return actual.createChild(QName.create(last, typeName));
-    }
-
-    private static SchemaPath createBaseTypePath(final SchemaPath actual, final String typeName) {
-        return actual.createChild(BaseTypes.constructQName(typeName));
-    }
-
-    private static SchemaPath createExtendedBaseTypePath(final SchemaPath actual, final QName moduleQName, final String typeName) {
-        return actual.createChild(
-                QName.create(moduleQName, typeName),
-                BaseTypes.constructQName(typeName));
-    }
-
-    /**
-     * Parse given context and find identityref base value.
-     *
-     * @param ctx
-     *            type body
-     * @return identityref base value as String
-     */
-    public static String getIdentityrefBase(final Type_body_stmtsContext ctx) {
-        String result = null;
-        outer: for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Identityref_specificationContext) {
-                for (int j = 0; j < child.getChildCount(); j++) {
-                    ParseTree baseArg = child.getChild(j);
-                    if (baseArg instanceof Base_stmtContext) {
-                        result = stringFromNode(baseArg);
-                        break outer;
-                    }
-                }
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Parse type body statement and find require-instance value.
-     *
-     * @param ctx
-     *            type body context
-     * @return require-instance value
-     */
-    private static boolean isRequireInstance(final Type_body_stmtsContext ctx) {
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Instance_identifier_specificationContext) {
-                for (int j = 0; j < child.getChildCount(); j++) {
-                    ParseTree reqStmt = child.getChild(j);
-                    if (reqStmt instanceof Require_instance_stmtContext) {
-                        for (int k = 0; k < reqStmt.getChildCount(); k++) {
-                            ParseTree reqArg = reqStmt.getChild(k);
-                            if (reqArg instanceof Require_instance_argContext) {
-                                return Boolean.valueOf(stringFromNode(reqArg));
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Parse type body statement and find leafref path.
-     *
-     * @param ctx
-     *            type body context
-     * @return leafref path as String
-     */
-    private static String parseLeafrefPath(final Type_body_stmtsContext ctx) {
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof Leafref_specificationContext) {
-                for (int j = 0; j < child.getChildCount(); j++) {
-                    ParseTree leafRefSpec = child.getChild(j);
-                    if (leafRefSpec instanceof Path_stmtContext) {
-                        return stringFromNode(leafRefSpec);
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Internal helper method for parsing must statement.
-     *
-     * @param ctx
-     *            Must_stmtContext
-     * @return MustDefinition object based on parsed context
-     */
-    private static MustDefinition parseMust(final YangParser.Must_stmtContext ctx) {
-        StringBuilder mustText = new StringBuilder();
-        Optional<String> description = Optional.absent();
-        Optional<String> reference = Optional.absent();
-        Optional<String> errorAppTag = Optional.absent();
-        Optional<String> errorMessage = Optional.absent();
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            ParseTree child = ctx.getChild(i);
-            if (child instanceof StringContext) {
-                final StringContext context = (StringContext) child;
-                if (context.getChildCount() == 1) {
-                    String mustPart = context.getChild(0).getText();
-                    // trim start and end quotation
-                    mustText.append(mustPart.substring(1, mustPart.length() - 1));
-                } else {
-                    for (int j = 0; j < context.getChildCount(); j++) {
-                        String mustPart = context.getChild(j).getText();
-                        if (j == 0) {
-                            mustText.append(mustPart.substring(0, mustPart.length() - 1));
-                            continue;
-                        }
-                        if (j % 2 == 0) {
-                            mustText.append(mustPart.substring(1));
-                        }
-                    }
-                }
-            } else if (child instanceof Description_stmtContext) {
-                description = Optional.of(stringFromNode(child));
-            } else if (child instanceof Reference_stmtContext) {
-                reference = Optional.of(stringFromNode(child));
-            } else if (child instanceof Error_app_tag_stmtContext) {
-                errorAppTag = Optional.of(stringFromNode(child));
-            } else if (child instanceof Error_message_stmtContext) {
-                errorMessage = Optional.of(stringFromNode(child));
-            }
-        }
-
-        return MustDefinitionImpl.create(mustText.toString(), description, reference, errorAppTag, errorMessage);
-    }
-
-    /**
-     * Parse given context and set constraints to constraints builder.
-     *
-     * @param ctx
-     *            context to parse
-     * @param constraints
-     *            ConstraintsBuilder to fill
-     *
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    public static void parseConstraints(final ParseTree ctx, final ConstraintsBuilder constraints) {
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            final ParseTree childNode = ctx.getChild(i);
-            if (childNode instanceof Max_elements_stmtContext) {
-                Integer max = parseMaxElements((Max_elements_stmtContext) childNode, constraints.getModuleName());
-                constraints.setMaxElements(max);
-            } else if (childNode instanceof Min_elements_stmtContext) {
-                Integer min = parseMinElements((Min_elements_stmtContext) childNode, constraints.getModuleName());
-                constraints.setMinElements(min);
-            } else if (childNode instanceof Must_stmtContext) {
-                MustDefinition must = parseMust((Must_stmtContext) childNode);
-                constraints.addMustDefinition(must);
-            } else if (childNode instanceof Mandatory_stmtContext) {
-                for (int j = 0; j < childNode.getChildCount(); j++) {
-                    ParseTree mandatoryTree = childNode.getChild(j);
-                    if (mandatoryTree instanceof Mandatory_argContext) {
-                        Boolean mandatory = Boolean.valueOf(stringFromNode(mandatoryTree));
-                        constraints.setMandatory(mandatory);
-                    }
-                }
-            } else if (childNode instanceof When_stmtContext) {
-                constraints.addWhenCondition(stringFromNode(childNode));
-            }
-        }
-    }
-
-    private static Integer parseMinElements(final Min_elements_stmtContext ctx, final String moduleName) {
-        Integer result = null;
-        try {
-            for (int i = 0; i < ctx.getChildCount(); i++) {
-                ParseTree minArg = ctx.getChild(i);
-                if (minArg instanceof Min_value_argContext) {
-                    result = Integer.valueOf(stringFromNode(minArg));
-                }
-            }
-            if (result == null) {
-                throw new IllegalArgumentException();
-            }
-            return result;
-        } catch (Exception e) {
-            throw new YangParseException(moduleName, ctx.getStart().getLine(), "Failed to parse min-elements.", e);
-        }
-    }
-
-    private static Integer parseMaxElements(final Max_elements_stmtContext ctx, final String moduleName) {
-        Integer result = null;
-        try {
-            for (int i = 0; i < ctx.getChildCount(); i++) {
-                ParseTree maxArg = ctx.getChild(i);
-                if (maxArg instanceof Max_value_argContext) {
-                    String maxValue = stringFromNode(maxArg);
-                    if ("unbounded".equals(maxValue)) {
-                        result = Integer.MAX_VALUE;
-                    } else {
-                        result = Integer.valueOf(maxValue);
-                    }
-                }
-            }
-            if (result == null) {
-                throw new IllegalArgumentException();
-            }
-            return result;
-        } catch (Exception e) {
-            throw new YangParseException(moduleName, ctx.getStart().getLine(), "Failed to parse max-elements.", e);
-        }
-    }
-
-    /**
-     * Parse given context and return yin value.
-     *
-     * @param ctx
-     *            context to parse
-     * @return true if value is 'true', false otherwise
-     */
-    public static boolean parseYinValue(final Argument_stmtContext ctx) {
-        boolean yinValue = false;
-        outer: for (int i = 0; i < ctx.getChildCount(); i++) {
-            ParseTree yin = ctx.getChild(i);
-            if (yin instanceof Yin_element_stmtContext) {
-                for (int j = 0; j < yin.getChildCount(); j++) {
-                    ParseTree yinArg = yin.getChild(j);
-                    if (yinArg instanceof Yin_element_argContext) {
-                        String yinString = stringFromNode(yinArg);
-                        if ("true".equals(yinString)) {
-                            yinValue = true;
-                            break outer;
-                        }
-                    }
-                }
-            }
-        }
-        return yinValue;
-    }
 
     /**
      * Check this base type.
@@ -1780,205 +51,6 @@ public final class ParserListenerUtils {
         }
     }
 
-    /**
-     * Parse refine statement.
-     *
-     * @param refineCtx
-     *            refine statement
-     * @param moduleName
-     *            name of current module
-     * @return RefineHolder object representing this refine statement
-     *
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    public static RefineHolderImpl parseRefine(final Refine_stmtContext refineCtx, final String moduleName) {
-        final String refineTarget = stringFromNode(refineCtx);
-        final RefineHolderImpl refine = new RefineHolderImpl(moduleName, refineCtx.getStart().getLine(), refineTarget);
-        for (int i = 0; i < refineCtx.getChildCount(); i++) {
-            ParseTree refinePom = refineCtx.getChild(i);
-            if (refinePom instanceof Refine_pomContext) {
-                for (int j = 0; j < refinePom.getChildCount(); j++) {
-                    ParseTree refineStmt = refinePom.getChild(j);
-                    parseRefineDefault(refine, refineStmt);
-
-                    if (refineStmt instanceof Refine_leaf_stmtsContext) {
-                        parseRefine(refine, (Refine_leaf_stmtsContext) refineStmt);
-                    } else if (refineStmt instanceof Refine_container_stmtsContext) {
-                        parseRefine(refine, (Refine_container_stmtsContext) refineStmt);
-                    } else if (refineStmt instanceof Refine_list_stmtsContext) {
-                        parseRefine(refine, (Refine_list_stmtsContext) refineStmt);
-                    } else if (refineStmt instanceof Refine_leaf_list_stmtsContext) {
-                        parseRefine(refine, (Refine_leaf_list_stmtsContext) refineStmt);
-                    } else if (refineStmt instanceof Refine_choice_stmtsContext) {
-                        parseRefine(refine, (Refine_choice_stmtsContext) refineStmt);
-                    } else if (refineStmt instanceof Refine_anyxml_stmtsContext) {
-                        parseRefine(refine, (Refine_anyxml_stmtsContext) refineStmt);
-                    }
-                }
-            }
-        }
-        return refine;
-    }
-
-    /**
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    private static void parseRefineDefault(final RefineHolderImpl refine, final ParseTree refineStmt) {
-        for (int i = 0; i < refineStmt.getChildCount(); i++) {
-            ParseTree refineArg = refineStmt.getChild(i);
-            if (refineArg instanceof Description_stmtContext) {
-                String description = stringFromNode(refineArg);
-                refine.setDescription(description);
-            } else if (refineArg instanceof Reference_stmtContext) {
-                String reference = stringFromNode(refineArg);
-                refine.setReference(reference);
-            } else if (refineArg instanceof Config_stmtContext) {
-                Boolean config = parseConfig((Config_stmtContext) refineArg, refine.getModuleName());
-                refine.setConfiguration(config);
-            }
-        }
-    }
-
-    /**
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    private static RefineBuilder parseRefine(final RefineHolderImpl refine, final Refine_leaf_stmtsContext refineStmt) {
-        for (int i = 0; i < refineStmt.getChildCount(); i++) {
-            ParseTree refineArg = refineStmt.getChild(i);
-            if (refineArg instanceof Default_stmtContext) {
-                String defaultStr = stringFromNode(refineArg);
-                refine.setDefaultStr(defaultStr);
-            } else if (refineArg instanceof Mandatory_stmtContext) {
-                for (int j = 0; j < refineArg.getChildCount(); j++) {
-                    ParseTree mandatoryTree = refineArg.getChild(j);
-                    if (mandatoryTree instanceof Mandatory_argContext) {
-                        Boolean mandatory = Boolean.valueOf(stringFromNode(mandatoryTree));
-                        refine.setMandatory(mandatory);
-                    }
-                }
-            } else if (refineArg instanceof Must_stmtContext) {
-                MustDefinition must = parseMust((Must_stmtContext) refineArg);
-                refine.setMust(must);
-
-            }
-        }
-        return refine;
-    }
-
-    /**
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    private static RefineBuilder parseRefine(final RefineBuilder refine, final Refine_container_stmtsContext refineStmt) {
-        for (int i = 0; i < refineStmt.getChildCount(); i++) {
-            ParseTree refineArg = refineStmt.getChild(i);
-            if (refineArg instanceof Must_stmtContext) {
-                MustDefinition must = parseMust((Must_stmtContext) refineArg);
-                refine.setMust(must);
-            } else if (refineArg instanceof Presence_stmtContext) {
-                refine.setPresence(true);
-            }
-        }
-        return refine;
-    }
-
-    /**
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    private static RefineBuilder parseRefine(final RefineHolderImpl refine, final Refine_list_stmtsContext refineStmt) {
-        for (int i = 0; i < refineStmt.getChildCount(); i++) {
-            ParseTree refineArg = refineStmt.getChild(i);
-            if (refineArg instanceof Must_stmtContext) {
-                MustDefinition must = parseMust((Must_stmtContext) refineArg);
-                refine.setMust(must);
-            } else if (refineArg instanceof Max_elements_stmtContext) {
-                Integer max = parseMaxElements((Max_elements_stmtContext) refineArg, refine.getModuleName());
-                refine.setMaxElements(max);
-            } else if (refineArg instanceof Min_elements_stmtContext) {
-                Integer min = parseMinElements((Min_elements_stmtContext) refineArg, refine.getModuleName());
-                refine.setMinElements(min);
-            }
-        }
-        return refine;
-    }
-
-    /**
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    private static RefineBuilder parseRefine(final RefineHolderImpl refine, final Refine_leaf_list_stmtsContext refineStmt) {
-        for (int i = 0; i < refineStmt.getChildCount(); i++) {
-            ParseTree refineArg = refineStmt.getChild(i);
-            if (refineArg instanceof Must_stmtContext) {
-                MustDefinition must = parseMust((Must_stmtContext) refineArg);
-                refine.setMust(must);
-            } else if (refineArg instanceof Max_elements_stmtContext) {
-                Integer max = parseMaxElements((Max_elements_stmtContext) refineArg, refine.getModuleName());
-                refine.setMaxElements(max);
-            } else if (refineArg instanceof Min_elements_stmtContext) {
-                Integer min = parseMinElements((Min_elements_stmtContext) refineArg, refine.getModuleName());
-                refine.setMinElements(min);
-            }
-        }
-        return refine;
-    }
-
-    /**
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    private static RefineBuilder parseRefine(final RefineHolderImpl refine, final Refine_choice_stmtsContext refineStmt) {
-        for (int i = 0; i < refineStmt.getChildCount(); i++) {
-            ParseTree refineArg = refineStmt.getChild(i);
-            if (refineArg instanceof Default_stmtContext) {
-                String defaultStr = stringFromNode(refineArg);
-                refine.setDefaultStr(defaultStr);
-            } else if (refineArg instanceof Mandatory_stmtContext) {
-                for (int j = 0; j < refineArg.getChildCount(); j++) {
-                    ParseTree mandatoryTree = refineArg.getChild(j);
-                    if (mandatoryTree instanceof Mandatory_argContext) {
-                        Boolean mandatory = Boolean.valueOf(stringFromNode(mandatoryTree));
-                        refine.setMandatory(mandatory);
-                    }
-                }
-            }
-        }
-        return refine;
-    }
-
-    /**
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    private static RefineBuilder parseRefine(final RefineBuilder refine, final Refine_anyxml_stmtsContext refineStmt) {
-        for (int i = 0; i < refineStmt.getChildCount(); i++) {
-            ParseTree refineArg = refineStmt.getChild(i);
-            if (refineArg instanceof Must_stmtContext) {
-                MustDefinition must = parseMust((Must_stmtContext) refineArg);
-                refine.setMust(must);
-            } else if (refineArg instanceof Mandatory_stmtContext) {
-                for (int j = 0; j < refineArg.getChildCount(); j++) {
-                    ParseTree mandatoryTree = refineArg.getChild(j);
-                    if (mandatoryTree instanceof Mandatory_argContext) {
-                        Boolean mandatory = Boolean.valueOf(stringFromNode(mandatoryTree));
-                        refine.setMandatory(mandatory);
-                    }
-                }
-            }
-        }
-        return refine;
-    }
-
-    public static String getArgumentString(final org.antlr.v4.runtime.ParserRuleContext ctx) {
-        List<StringContext> potentialValues = ctx.getRuleContexts(StringContext.class);
-        checkState(!potentialValues.isEmpty());
-        return ParserListenerUtils.stringFromStringContext(potentialValues.get(0));
-    }
-
     public static <T extends ParserRuleContext> Optional<T> getFirstContext(final ParserRuleContext context,final Class<T> contextType) {
         List<T> potential = context.getRuleContexts(contextType);
         if (potential.isEmpty()) {
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/SchemaPathStack.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/SchemaPathStack.java
deleted file mode 100644 (file)
index 15e97ea..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2013 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.impl;
-
-import com.google.common.base.Preconditions;
-import java.util.Deque;
-import java.util.LinkedList;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-final class SchemaPathStack {
-    private final Deque<SchemaPath> paths = new LinkedList<>();
-
-    SchemaPath addNodeToPath(final QName name) {
-        SchemaPath sp = paths.pop();
-        sp = sp.createChild(name);
-        paths.push(sp);
-        return sp;
-    }
-
-    QName removeNodeFromPath() {
-        SchemaPath sp = paths.pop();
-        QName ret = sp.getLastComponent();
-        paths.push(Preconditions.checkNotNull(sp.getParent(), "Attempted to remove too many nodes from schemapath at stack %s", paths));
-        return ret;
-    }
-
-    SchemaPath currentSchemaPath() {
-        return paths.peek();
-    }
-
-    void pop() {
-        paths.pop();
-    }
-
-    void push() {
-        paths.push(SchemaPath.ROOT);
-    }
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/ValidationUtil.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/ValidationUtil.java
deleted file mode 100644 (file)
index c00bebe..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2013 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.impl;
-
-import com.google.common.base.Splitter;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_stmtContext;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-/**
- * Validation utilities
- */
-final class ValidationUtil {
-    private static final Splitter SPACE_SPLITTER = Splitter.on(' ');
-
-    /**
-     * It isn't desirable to create instance of this class
-     */
-    private ValidationUtil() {
-    }
-
-    static void ex(final String message) {
-        throw new YangValidationException(message);
-    }
-
-    static Set<String> getDuplicates(final Iterable<String> keyList) {
-        Set<String> all = new HashSet<>();
-        Set<String> duplicates = new HashSet<>();
-
-        for (String key : keyList) {
-            if (!all.add(key)) {
-                duplicates.add(key);
-            }
-        }
-        return duplicates;
-    }
-
-    static Iterable<String> listKeysFromId(final String keys) {
-        return SPACE_SPLITTER.split(keys);
-    }
-
-    static String getRootParentName(final ParseTree ctx) {
-        ParseTree root = getRootParent(ctx);
-        return ValidationUtil.getName(root);
-    }
-
-    private static ParseTree getRootParent(final ParseTree ctx) {
-        ParseTree root = ctx;
-        while (root.getParent() != null) {
-            if (root.getClass().equals(Module_stmtContext.class) || root.getClass().equals(Submodule_stmtContext.class)) {
-                break;
-            }
-            root = root.getParent();
-        }
-        return root;
-    }
-
-    static String getName(final ParseTree child) {
-        return ParserListenerUtils.stringFromNode(child);
-    }
-
-    static String f(final String base, final Object... args) {
-        return String.format(base, args);
-    }
-
-    /**
-     * Get simple name from statement class e.g. Module from Module_stmt_context
-     */
-    static String getSimpleStatementName(final Class<? extends ParseTree> typeOfStatement) {
-
-        String className = typeOfStatement.getSimpleName();
-        int lastIndexOf = className.indexOf('$');
-        className = lastIndexOf == -1 ? className : className.substring(lastIndexOf + 1);
-        int indexOfStmt = className.indexOf("_stmt");
-        int index = indexOfStmt == -1 ? className.indexOf("_arg") : indexOfStmt;
-        return className.substring(0, index).replace('_', '-');
-    }
-
-    static int countPresentChildrenOfType(final ParseTree parent, final Set<Class<? extends ParseTree>> expectedChildTypes) {
-        int foundChildrenOfType = 0;
-
-        for (Class<? extends ParseTree> type : expectedChildTypes) {
-            foundChildrenOfType += countPresentChildrenOfType(parent, type);
-        }
-        return foundChildrenOfType;
-    }
-
-    static int countPresentChildrenOfType(final ParseTree parent, final Class<? extends ParseTree> expectedChildType) {
-        int foundChildrenOfType = 0;
-
-        for (int i = 0; i < parent.getChildCount(); i++) {
-            ParseTree child = parent.getChild(i);
-            if (expectedChildType.isInstance(child)) {
-                foundChildrenOfType++;
-            }
-        }
-        return foundChildrenOfType;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangModelBasicValidationListener.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangModelBasicValidationListener.java
deleted file mode 100644 (file)
index 3cb3f07..0000000
+++ /dev/null
@@ -1,639 +0,0 @@
-/*
- * Copyright (c) 2013 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.impl;
-
-import com.google.common.collect.Sets;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Anyxml_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Argument_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Augment_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Base_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Belongs_to_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Case_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Choice_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Config_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Container_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Default_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Deviate_add_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Deviation_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Extension_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Feature_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Grouping_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Identity_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.If_feature_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Import_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Include_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Key_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Leaf_list_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Leaf_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.List_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Mandatory_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Mandatory_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_header_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Namespace_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Notification_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Ordered_by_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Prefix_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Refine_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_date_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Rpc_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Status_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_header_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Type_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Typedef_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Unique_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Uses_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Yin_element_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParserBaseListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Validation listener that validates yang statements according to RFC-6020.
- * This validator expects only one module or submodule per file and performs
- * only basic validation where context from all yang models is not present.
- */
-public final class YangModelBasicValidationListener extends YangParserBaseListener {
-    private static final Logger LOGGER = LoggerFactory.getLogger(YangModelBasicValidationListener.class);
-    private final Set<String> uniquePrefixes = new HashSet<>();
-    private final Set<String> uniqueImports = new HashSet<>();
-    private final Set<String> uniqueIncludes = new HashSet<>();
-
-    private String globalModuleId;
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>Header statements present(mandatory prefix and namespace statements
-     * are in header)</li>
-     * <li>Only one module or submodule per file</li>
-     * </ol>
-     */
-    @Override
-    public void enterModule_stmt(final Module_stmtContext ctx) {
-
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkPresentChildOfType(ctx, Module_header_stmtsContext.class, true);
-
-        String moduleName = ValidationUtil.getName(ctx);
-        BasicValidations.checkIsModuleIdNull(globalModuleId);
-        globalModuleId = moduleName;
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>Header statements present(mandatory belongs-to statement is in
-     * header)</li>
-     * <li>Only one module or submodule per file</li>
-     * </ol>
-     */
-    @Override
-    public void enterSubmodule_stmt(final Submodule_stmtContext ctx) {
-
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkPresentChildOfType(ctx, Submodule_header_stmtsContext.class, true);
-
-        String submoduleName = ValidationUtil.getName(ctx);
-        BasicValidations.checkIsModuleIdNull(globalModuleId);
-        globalModuleId = submoduleName;
-
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>One Belongs-to statement present</li>
-     * </ol>
-     */
-    @Override
-    public void enterSubmodule_header_stmts(final Submodule_header_stmtsContext ctx) {
-        BasicValidations.checkPresentChildOfType(ctx, Belongs_to_stmtContext.class, true);
-
-        // check Yang version present, if not log
-        try {
-            BasicValidations.checkPresentYangVersion(ctx, ValidationUtil.getRootParentName(ctx));
-        } catch (Exception e) {
-            LOGGER.debug(e.getMessage());
-        }
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>One Namespace statement present</li>
-     * <li>One Prefix statement present</li>
-     * </ol>
-     */
-    @Override
-    public void enterModule_header_stmts(final Module_header_stmtsContext ctx) {
-        String moduleName = ValidationUtil.getRootParentName(ctx);
-
-        BasicValidations.checkPresentChildOfType(ctx, Namespace_stmtContext.class, true);
-        BasicValidations.checkPresentChildOfType(ctx, Prefix_stmtContext.class, true);
-
-        // check Yang version present, if not log
-        try {
-            BasicValidations.checkPresentYangVersion(ctx, moduleName);
-        } catch (Exception e) {
-            LOGGER.debug(e.getMessage());
-        }
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Date is in valid format</li>
-     * </ol>
-     */
-    @Override
-    public void enterRevision_stmt(final Revision_stmtContext ctx) {
-        BasicValidations.checkDateFormat(ctx);
-
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>One Prefix statement child</li>
-     * </ol>
-     */
-    @Override
-    public void enterBelongs_to_stmt(final Belongs_to_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkPresentChildOfType(ctx, Prefix_stmtContext.class, true);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Namespace string can be parsed as URI</li>
-     * </ol>
-     */
-    @Override
-    public void enterNamespace_stmt(final Namespace_stmtContext ctx) {
-        String namespaceName = ValidationUtil.getName(ctx);
-        String rootParentName = ValidationUtil.getRootParentName(ctx);
-
-        try {
-            new URI(namespaceName);
-        } catch (URISyntaxException e) {
-            ValidationUtil.ex(ValidationUtil.f("(In module:%s) Namespace:%s cannot be parsed as URI", rootParentName,
-                    namespaceName));
-        }
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>Every import(identified by identifier) within a module/submodule is
-     * present only once</li>
-     * <li>One prefix statement child</li>
-     * </ol>
-     */
-    @Override
-    public void enterImport_stmt(final Import_stmtContext ctx) {
-
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkUniquenessInNamespace(ctx, uniqueImports);
-
-        BasicValidations.checkPresentChildOfType(ctx, Prefix_stmtContext.class, true);
-
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Date is in valid format</li>
-     * </ol>
-     */
-    @Override
-    public void enterRevision_date_stmt(final Revision_date_stmtContext ctx) {
-        BasicValidations.checkDateFormat(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>Every include(identified by identifier) within a module/submodule is
-     * present only once</li>
-     * </ol>
-     */
-    @Override
-    public void enterInclude_stmt(final Include_stmtContext ctx) {
-
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkUniquenessInNamespace(ctx, uniqueIncludes);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Yang-version is specified as 1</li>
-     * </ol>
-     */
-    @Override
-    public void enterYang_version_stmt(final YangParser.Yang_version_stmtContext ctx) {
-        String version = ValidationUtil.getName(ctx);
-        String rootParentName = ValidationUtil.getRootParentName(ctx);
-        if (!version.equals(BasicValidations.SUPPORTED_YANG_VERSION)) {
-            ValidationUtil.ex(ValidationUtil.f("(In (sub)module:%s) Unsupported yang version:%s, supported version:%s",
-                    rootParentName, version, BasicValidations.SUPPORTED_YANG_VERSION));
-        }
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>Every prefix(identified by identifier) within a module/submodule is
-     * presented only once</li>
-     * </ol>
-     */
-    @Override
-    public void enterPrefix_stmt(final Prefix_stmtContext ctx) {
-
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkUniquenessInNamespace(ctx, uniquePrefixes);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>One type statement child</li>
-     * </ol>
-     */
-    @Override
-    public void enterTypedef_stmt(final Typedef_stmtContext ctx) {
-
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkPresentChildOfType(ctx, Type_stmtContext.class, true);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>(Prefix):Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterType_stmt(final Type_stmtContext ctx) {
-        BasicValidations.checkPrefixedIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterContainer_stmt(final Container_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>One type statement child</li>
-     * <li>Default statement must not be present if mandatory statement is</li>
-     * </ol>
-     */
-    @Override
-    public void enterLeaf_stmt(final Leaf_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkPresentChildOfType(ctx, Type_stmtContext.class, true);
-
-        BasicValidations.checkNotPresentBoth(ctx, Mandatory_stmtContext.class, Default_stmtContext.class);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>One type statement child</li>
-     * </ol>
-     */
-    @Override
-    public void enterLeaf_list_stmt(final Leaf_list_stmtContext ctx) {
-
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkPresentChildOfType(ctx, Type_stmtContext.class, true);
-    }
-
-    private static final Set<String> PERMITTED_ORDER_BY_ARGS = Sets.newHashSet("system", "user");
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Value must be one of: system, user</li>
-     * </ol>
-     */
-    @Override
-    public void enterOrdered_by_arg(final Ordered_by_argContext ctx) {
-        BasicValidations.checkOnlyPermittedValues(ctx, PERMITTED_ORDER_BY_ARGS);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterList_stmt(final List_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-        // TODO check: "if config==true then key must be present" could be
-        // performed
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>No duplicate keys</li>
-     * </ol>
-     */
-    @Override
-    public void enterKey_stmt(final Key_stmtContext ctx) {
-        BasicValidations.getAndCheckUniqueKeys(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>No duplicate uniques</li>
-     * </ol>
-     */
-    @Override
-    public void enterUnique_stmt(final Unique_stmtContext ctx) {
-        BasicValidations.getAndCheckUniqueKeys(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * <li>Default statement must not be present if mandatory statement is</li>
-     * </ol>
-     */
-    @Override
-    public void enterChoice_stmt(final Choice_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-
-        BasicValidations.checkNotPresentBoth(ctx, Mandatory_stmtContext.class, Default_stmtContext.class);
-
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterCase_stmt(final Case_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-    }
-
-    private static final Set<String> PERMITTED_BOOLEAN_ARGS = Sets.newHashSet("true", "false");
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Value must be one of: true, false</li>
-     * </ol>
-     */
-    @Override
-    public void enterMandatory_arg(final Mandatory_argContext ctx) {
-        BasicValidations.checkOnlyPermittedValues(ctx, PERMITTED_BOOLEAN_ARGS);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterAnyxml_stmt(final Anyxml_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterGrouping_stmt(final Grouping_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>(Prefix):Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterUses_stmt(final Uses_stmtContext ctx) {
-        BasicValidations.checkPrefixedIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterRefine_stmt(final Refine_stmtContext ctx) {
-        BasicValidations.checkSchemaNodeIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterRpc_stmt(final Rpc_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterNotification_stmt(final Notification_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Schema Node Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterAugment_stmt(final Augment_stmtContext ctx) {
-        BasicValidations.checkSchemaNodeIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterIdentity_stmt(final Identity_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>(Prefix):Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterBase_stmt(final Base_stmtContext ctx) {
-        BasicValidations.checkPrefixedIdentifier(ctx);
-
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Value must be one of: true, false</li>
-     * </ol>
-     */
-    @Override
-    public void enterYin_element_arg(final Yin_element_argContext ctx) {
-        BasicValidations.checkOnlyPermittedValues(ctx, PERMITTED_BOOLEAN_ARGS);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterExtension_stmt(final Extension_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterArgument_stmt(final Argument_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterFeature_stmt(final Feature_stmtContext ctx) {
-        BasicValidations.checkIdentifier(ctx);
-
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>(Prefix):Identifier is in required format</li>
-     * </ol>
-     */
-    @Override
-    public void enterIf_feature_stmt(final If_feature_stmtContext ctx) {
-        BasicValidations.checkPrefixedIdentifier(ctx);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Schema Node Identifier is in required format</li>
-     * <li>At least one deviate-* statement child</li>
-     * </ol>
-     */
-    @Override
-    public void enterDeviation_stmt(final Deviation_stmtContext ctx) {
-        BasicValidations.checkSchemaNodeIdentifier(ctx);
-
-        Set<Class<? extends ParseTree>> types = Sets.newHashSet();
-        types.add(Deviate_add_stmtContext.class);
-        types.add(Deviate_add_stmtContext.class);
-        BasicValidations.checkPresentChildOfTypes(ctx, types, false);
-    }
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Value must be one of: true, false</li>
-     * </ol>
-     */
-    @Override
-    public void enterConfig_arg(final Config_argContext ctx) {
-        BasicValidations.checkOnlyPermittedValues(ctx, PERMITTED_BOOLEAN_ARGS);
-    }
-
-    private static final Set<String> PERMITTED_STATUS_ARGS = Sets.newHashSet("current", "deprecated", "obsolete");
-
-    /**
-     * Constraints:
-     * <ol>
-     * <li>Value must be one of: "current", "deprecated", "obsolete"</li>
-     * </ol>
-     */
-    @Override
-    public void enterStatus_arg(final Status_argContext ctx) {
-        BasicValidations.checkOnlyPermittedValues(ctx, PERMITTED_STATUS_ARGS);
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangModelBasicValidator.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangModelBasicValidator.java
deleted file mode 100644 (file)
index 980647b..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2013 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.impl;
-
-import java.util.Collection;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.ParseTreeWalker;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-/**
- * Exposed basic yang validation.
- *
- * Every file is validated using {@link YangModelBasicValidationListener}.
- */
-public final class YangModelBasicValidator {
-
-    private final ParseTreeWalker walker;
-
-    public YangModelBasicValidator(ParseTreeWalker walker) {
-        this.walker = walker;
-    }
-
-    public YangModelBasicValidator() {
-        this.walker = new ParseTreeWalker();
-    }
-
-    public void validate(Collection<ParseTree> trees) {
-        for (ParseTree tree : trees) {
-            try {
-                final YangModelBasicValidationListener yangModelParser = new YangModelBasicValidationListener();
-                walker.walk(yangModelParser, tree);
-            } catch (YangValidationException e) {
-                // wrap exception to add information about which file failed
-                throw new YangValidationException("Yang validation failed for file" + e);
-            }
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangParserImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangParserImpl.java
deleted file mode 100644 (file)
index c8e88c4..0000000
+++ /dev/null
@@ -1,1324 +0,0 @@
-/*
- * Copyright (c) 2013 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.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils.fillAugmentTarget;
-import static org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils.findBaseIdentity;
-import static org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils.findModuleFromContext;
-import static org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils.findSchemaNodeInModule;
-import static org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils.findTargetNode;
-import static org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils.processAugmentation;
-import static org.opendaylight.yangtools.yang.parser.builder.impl.TypeUtils.resolveType;
-import static org.opendaylight.yangtools.yang.parser.builder.impl.TypeUtils.resolveTypeUnion;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.HashBiMap;
-import com.google.common.io.ByteSource;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.Set;
-import java.util.TreeMap;
-import javax.annotation.concurrent.Immutable;
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.CommonTokenStream;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.ParseTreeWalker;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangLexer;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.YangContext;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataNodeContainerBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ExtensionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ChoiceBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ChoiceCaseBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.GroupingUtils;
-import org.opendaylight.yangtools.yang.parser.builder.impl.IdentitySchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.IdentityrefTypeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleImpl;
-import org.opendaylight.yangtools.yang.parser.builder.impl.UnionTypeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.util.Comparators;
-import org.opendaylight.yangtools.yang.parser.util.ModuleDependencySort;
-import org.opendaylight.yangtools.yang.parser.util.NamedByteArrayInputStream;
-import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
-import org.opendaylight.yangtools.yang.parser.util.NamedInputStream;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-@Immutable
-public final class YangParserImpl implements YangContextParser {
-    private static final Logger LOG = LoggerFactory.getLogger(YangParserImpl.class);
-    private static final YangParserImpl INSTANCE = new YangParserImpl();
-
-    public static YangParserImpl getInstance() {
-        return INSTANCE;
-    }
-
-    @Override
-    @Deprecated
-    public Set<Module> parseYangModels(final File yangFile, final File directory) {
-        try {
-            return parseFile(yangFile, directory).getModules();
-        } catch (IOException | YangSyntaxErrorException e) {
-            throw new YangParseException("Failed to parse yang data", e);
-        }
-    }
-
-    @Override
-    public SchemaContext parseFile(final File yangFile, final File directory) throws IOException, YangSyntaxErrorException {
-        Preconditions.checkState(yangFile.exists(), yangFile + " does not exists");
-        Preconditions.checkState(directory.exists(), directory + " does not exists");
-        Preconditions.checkState(directory.isDirectory(), directory + " is not a directory");
-
-        final String yangFileName = yangFile.getName();
-        final String[] fileList = checkNotNull(directory.list(), directory + " not found or is not a directory");
-
-        Map<ByteSource, File> sourceToFile = new LinkedHashMap<>();
-        ByteSource mainFileSource = BuilderUtils.fileToByteSource(yangFile);
-        sourceToFile.put(mainFileSource, yangFile);
-
-        for (String fileName : fileList) {
-            if (fileName.equals(yangFileName)) {
-                continue;
-            }
-            File dependency = new File(directory, fileName);
-            if (dependency.isFile()) {
-                sourceToFile.put(BuilderUtils.fileToByteSource(dependency), dependency);
-            }
-        }
-
-        Map<ByteSource, ModuleBuilder> sourceToBuilder = parseSourcesToBuilders(sourceToFile.keySet(), null);
-        ModuleBuilder main = sourceToBuilder.get(mainFileSource);
-
-        List<ModuleBuilder> moduleBuilders = new ArrayList<>();
-        moduleBuilders.add(main);
-        filterImports(main, new ArrayList<>(sourceToBuilder.values()), moduleBuilders);
-        Collection<ModuleBuilder> resolved = resolveSubmodules(moduleBuilders);
-
-        // module builders sorted by dependencies
-        List<ModuleBuilder> sortedBuilders = ModuleDependencySort.sort(resolved);
-        Map<URI, NavigableMap<Date, ModuleBuilder>> modules = resolveModulesWithImports(sortedBuilders, null);
-        Collection<Module> unsorted = build(modules).values();
-        Set<Module> result = new LinkedHashSet<>(
-                ModuleDependencySort.sort(unsorted.toArray(new Module[unsorted.size()])));
-        return resolveSchemaContext(result);
-    }
-
-    @Override
-    @Deprecated
-    public Set<Module> parseYangModels(final List<File> yangFiles) {
-        return parseFiles(yangFiles).getModules();
-    }
-
-    @Override
-    public SchemaContext parseFiles(final Collection<File> yangFiles) {
-        Collection<Module> unsorted = parseYangModelsMapped(yangFiles).values();
-        Set<Module> sorted = new LinkedHashSet<>(
-                ModuleDependencySort.sort(unsorted.toArray(new Module[unsorted.size()])));
-        return resolveSchemaContext(sorted);
-    }
-
-    @Override
-    @Deprecated
-    public Set<Module> parseYangModels(final List<File> yangFiles, final SchemaContext context) {
-        try {
-            return parseFiles(yangFiles, context).getModules();
-        } catch (IOException | YangSyntaxErrorException e) {
-            throw new YangParseException("Failed to parse yang data", e);
-        }
-    }
-
-    @Override
-    public SchemaContext parseFiles(final Collection<File> yangFiles, final SchemaContext context) throws IOException,
-    YangSyntaxErrorException {
-        if (yangFiles == null) {
-            return resolveSchemaContext(Collections.emptySet());
-        }
-
-        Collection<ByteSource> sources = BuilderUtils.filesToByteSources(yangFiles);
-        return parseSources(sources, context);
-    }
-
-    @Override
-    @Deprecated
-    public Set<Module> parseYangModelsFromStreams(final List<InputStream> yangModelStreams) {
-        try {
-            Collection<ByteSource> sources = BuilderUtils.streamsToByteSources(yangModelStreams);
-            return parseSources(sources).getModules();
-        } catch (IOException | YangSyntaxErrorException e) {
-            throw new YangParseException("Failed to parse yang data", e);
-        }
-    }
-
-    @Override
-    public SchemaContext parseSources(final Collection<ByteSource> sources) throws IOException,YangSyntaxErrorException {
-        return assembleContext(parseYangModelSources(sources, null).values());
-    }
-
-    @Override
-    @Deprecated
-    public Set<Module> parseYangModelsFromStreams(final List<InputStream> yangModelStreams, final SchemaContext context) {
-        try {
-            Collection<ByteSource> sources = BuilderUtils.streamsToByteSources(yangModelStreams);
-            return parseSources(sources, context).getModules();
-        } catch (IOException | YangSyntaxErrorException e) {
-            throw new YangParseException("Failed to parse yang data", e);
-        }
-    }
-
-    @Override
-    public SchemaContext parseSources(final Collection<ByteSource> sources, final SchemaContext context)
-            throws IOException, YangSyntaxErrorException {
-        if (sources == null) {
-            return resolveSchemaContext(Collections.emptySet());
-        }
-
-        final List<ModuleBuilder> sorted = resolveModuleBuilders(sources, context);
-        final Map<URI, NavigableMap<Date, ModuleBuilder>> modules = resolveModulesWithImports(sorted, context);
-
-        final Set<Module> unsorted = new LinkedHashSet<>(build(modules).values());
-        if (context != null) {
-            for (Module m : context.getModules()) {
-                if (!unsorted.contains(m)) {
-                    unsorted.add(m);
-                }
-            }
-        }
-        Set<Module> result = new LinkedHashSet<>(
-                ModuleDependencySort.sort(unsorted.toArray(new Module[unsorted.size()])));
-        return resolveSchemaContext(result);
-    }
-
-    private static Map<URI, NavigableMap<Date, ModuleBuilder>> resolveModulesWithImports(final List<ModuleBuilder> sorted,
-            final SchemaContext context) {
-        final Map<URI, NavigableMap<Date, ModuleBuilder>> modules = orderModules(sorted);
-        for (ModuleBuilder module : sorted) {
-            if (module != null) {
-                for (ModuleImport imp : module.getImports().values()) {
-                    String prefix = imp.getPrefix();
-                    ModuleBuilder targetModule = BuilderUtils.findModuleFromBuilders(imp, sorted);
-                    if (targetModule == null) {
-                        Module result = findModuleFromContext(context, module, prefix, 0);
-                        targetModule = new ModuleBuilder(result);
-                        NavigableMap<Date, ModuleBuilder> map = modules.get(targetModule.getNamespace());
-                        if (map == null) {
-                            map = new TreeMap<>();
-                            map.put(targetModule.getRevision(), targetModule);
-                            modules.put(targetModule.getNamespace(), map);
-                        } else {
-                            map.put(targetModule.getRevision(), targetModule);
-                        }
-                    }
-                    module.addImportedModule(prefix, targetModule);
-                }
-            }
-        }
-        return modules;
-    }
-
-    @Override
-    public Map<File, Module> parseYangModelsMapped(final Collection<File> yangFiles) {
-        if (yangFiles == null || yangFiles.isEmpty()) {
-            return Collections.emptyMap();
-        }
-
-        Map<ByteSource, File> byteSourceToFile = new HashMap<>();
-        for (final File file : yangFiles) {
-            ByteSource source = new ByteSource() {
-                @Override
-                public InputStream openStream() throws IOException {
-                    return new NamedFileInputStream(file, file.getPath());
-                }
-            };
-            byteSourceToFile.put(source, file);
-        }
-
-        Map<ByteSource, Module> byteSourceToModule;
-        try {
-            byteSourceToModule = parseYangModelSources(byteSourceToFile.keySet(), null);
-        } catch (IOException | YangSyntaxErrorException e) {
-            throw new YangParseException("Failed to parse yang data", e);
-        }
-        Map<File, Module> result = new LinkedHashMap<>();
-        for (Map.Entry<ByteSource, Module> entry : byteSourceToModule.entrySet()) {
-            result.put(byteSourceToFile.get(entry.getKey()), entry.getValue());
-        }
-        return result;
-    }
-
-    @Override
-    public Map<InputStream, Module> parseYangModelsFromStreamsMapped(final Collection<InputStream> yangModelStreams) {
-        if (yangModelStreams == null || yangModelStreams.isEmpty()) {
-            return Collections.emptyMap();
-        }
-
-        Map<ByteSource, InputStream> sourceToStream = new HashMap<>();
-        for (final InputStream stream : yangModelStreams) {
-            ByteSource source = new ByteSource() {
-                @Override
-                public InputStream openStream() throws IOException {
-                    return NamedByteArrayInputStream.create(stream);
-                }
-            };
-            sourceToStream.put(source, stream);
-        }
-
-        Map<ByteSource, Module> sourceToModule;
-        try {
-            sourceToModule = parseYangModelSources(sourceToStream.keySet(), null);
-        } catch (IOException | YangSyntaxErrorException e) {
-            throw new YangParseException("Failed to parse yang data", e);
-        }
-        Map<InputStream, Module> result = new LinkedHashMap<>();
-        for (Map.Entry<ByteSource, Module> entry : sourceToModule.entrySet()) {
-            result.put(sourceToStream.get(entry.getKey()), entry.getValue());
-        }
-        return result;
-    }
-
-    @Override
-    public SchemaContext resolveSchemaContext(final Set<Module> modules) {
-        // after merging parse method with this one, add support for getting
-        // submodule sources.
-        Map<ModuleIdentifier, String> identifiersToSources = new HashMap<>();
-        for (Module module : modules) {
-            ModuleImpl moduleImpl = (ModuleImpl) module;
-            identifiersToSources.put(module, moduleImpl.getSource());
-        }
-        return new SchemaContextImpl(modules, identifiersToSources);
-    }
-
-    public Collection<Module> buildModules(final Collection<ModuleBuilder> builders) {
-        Collection<ModuleBuilder> unsorted = resolveSubmodules(builders);
-        List<ModuleBuilder> sorted = ModuleDependencySort.sort(unsorted);
-        Map<URI, NavigableMap<Date, ModuleBuilder>> modules = resolveModulesWithImports(sorted, null);
-        Map<ModuleBuilder, Module> builderToModule = build(modules);
-        return builderToModule.values();
-    }
-
-    public SchemaContext assembleContext(final Collection<Module> modules) {
-        final Set<Module> sorted = new LinkedHashSet<>(
-                ModuleDependencySort.sort(modules.toArray(new Module[modules.size()])));
-        return resolveSchemaContext(sorted);
-    }
-
-    private Map<ByteSource, Module> parseYangModelSources(final Collection<ByteSource> sources, final SchemaContext context) throws IOException, YangSyntaxErrorException {
-        if (sources == null || sources.isEmpty()) {
-            return Collections.emptyMap();
-        }
-
-        Map<ByteSource, ModuleBuilder> sourceToBuilder = resolveSources(sources, context);
-        // sort and check for duplicates
-        List<ModuleBuilder> sorted = ModuleDependencySort.sort(sourceToBuilder.values());
-        Map<URI, NavigableMap<Date, ModuleBuilder>> modules = resolveModulesWithImports(sorted, null);
-        Map<ModuleBuilder, Module> builderToModule = build(modules);
-        Map<ModuleBuilder, ByteSource> builderToSource = HashBiMap.create(sourceToBuilder).inverse();
-        sorted = ModuleDependencySort.sort(builderToModule.keySet());
-
-        Map<ByteSource, Module> result = new LinkedHashMap<>();
-        for (ModuleBuilder moduleBuilder : sorted) {
-            Module value = checkNotNull(builderToModule.get(moduleBuilder), "Cannot get module for %s", moduleBuilder);
-            result.put(builderToSource.get(moduleBuilder), value);
-        }
-
-        return result;
-    }
-
-    /**
-     * Parse streams and resolve submodules.
-     *
-     * @param streams
-     *            collection of streams to parse
-     * @return map, where key is source stream and value is module builder
-     *         parsed from stream
-     * @throws YangSyntaxErrorException
-     */
-    // TODO: remove ByteSource result after removing YangModelParser
-    private Map<ByteSource, ModuleBuilder> resolveSources(final Collection<ByteSource> streams, final SchemaContext context) throws IOException, YangSyntaxErrorException {
-        Map<ByteSource, ModuleBuilder> builders = parseSourcesToBuilders(streams, context);
-        return resolveSubmodules(builders);
-    }
-
-    private static Map<ByteSource, ModuleBuilder> parseSourcesToBuilders(final Collection<ByteSource> sources,
-            final SchemaContext context) throws IOException, YangSyntaxErrorException {
-        final ParseTreeWalker walker = new ParseTreeWalker();
-        final Map<ByteSource, ParseTree> sourceToTree = parseYangSources(sources);
-        final Map<ByteSource, ModuleBuilder> sourceToBuilder = new LinkedHashMap<>();
-
-        // validate yang
-        new YangModelBasicValidator(walker).validate(sourceToTree.values());
-
-        Map<String, NavigableMap<Date, URI>> namespaceContext = BuilderUtils.createYangNamespaceContext(
-                sourceToTree.values(), Optional.fromNullable(context));
-        YangParserListenerImpl yangModelParser;
-        for (Map.Entry<ByteSource, ParseTree> entry : sourceToTree.entrySet()) {
-            ByteSource source = entry.getKey();
-            String path = null; // TODO refactor to Optional
-            // TODO refactor so that path can be retrieved without opening
-            // stream: NamedInputStream -> NamedByteSource ?
-            try (InputStream stream = source.openStream()) {
-                if (stream instanceof NamedInputStream) {
-                    path = stream.toString();
-                }
-            }
-            yangModelParser = new YangParserListenerImpl(namespaceContext, path);
-            walker.walk(yangModelParser, entry.getValue());
-            ModuleBuilder moduleBuilder = yangModelParser.getModuleBuilder();
-            moduleBuilder.setSource(source);
-            sourceToBuilder.put(source, moduleBuilder);
-        }
-        return sourceToBuilder;
-    }
-
-    private Map<ByteSource, ModuleBuilder> resolveSubmodules(final Map<ByteSource, ModuleBuilder> builders) {
-        Map<ByteSource, ModuleBuilder> modules = new HashMap<>();
-        Map<String, NavigableMap<Date, ModuleBuilder>> submodules = new HashMap<>();
-        for (Map.Entry<ByteSource, ModuleBuilder> entry : builders.entrySet()) {
-            ModuleBuilder builder = entry.getValue();
-            if (builder.isSubmodule()) {
-                String submoduleName = builder.getName();
-                NavigableMap<Date, ModuleBuilder> map = submodules.get(submoduleName);
-                if (map == null) {
-                    map = new TreeMap<>();
-                    map.put(builder.getRevision(), builder);
-                    submodules.put(submoduleName, map);
-                } else {
-                    map.put(builder.getRevision(), builder);
-                }
-            } else {
-                modules.put(entry.getKey(), builder);
-            }
-        }
-
-        for (ModuleBuilder module : modules.values()) {
-            resolveSubmodules(module, submodules);
-        }
-
-        return modules;
-    }
-
-    private Collection<ModuleBuilder> resolveSubmodules(final Collection<ModuleBuilder> builders) {
-        Collection<ModuleBuilder> modules = new HashSet<>();
-        Map<String, NavigableMap<Date, ModuleBuilder>> submodules = new HashMap<>();
-        for (ModuleBuilder builder : builders) {
-            if (builder.isSubmodule()) {
-                String submoduleName = builder.getName();
-                NavigableMap<Date, ModuleBuilder> map = submodules.get(submoduleName);
-                if (map == null) {
-                    map = new TreeMap<>();
-                    map.put(builder.getRevision(), builder);
-                    submodules.put(submoduleName, map);
-                } else {
-                    map.put(builder.getRevision(), builder);
-                }
-            } else {
-                modules.add(builder);
-            }
-        }
-
-        for (ModuleBuilder module : modules) {
-            resolveSubmodules(module, submodules);
-        }
-
-        return modules;
-    }
-
-    /**
-     * Traverse collection of builders, find builders representing submodule and
-     * add this submodule to its parent module.
-     *
-     * @param module
-     *            current module
-     * @param submodules
-     *            collection all loaded submodules
-     * @return collection of module builders with resolved submodules
-     */
-    private void resolveSubmodules(final ModuleBuilder module,
-            final Map<String, NavigableMap<Date, ModuleBuilder>> submodules) {
-        Map<String, Date> includes = module.getIncludedModules();
-        for (Map.Entry<String, Date> entry : includes.entrySet()) {
-            NavigableMap<Date, ModuleBuilder> subs = submodules.get(entry.getKey());
-            if (subs == null) {
-                throw new YangParseException("Failed to find references submodule " + entry.getKey() + " in module "
-                        + module.getName());
-            }
-            Date rev = entry.getValue();
-            ModuleBuilder submodule;
-            if (rev == null) {
-                submodule = subs.lastEntry().getValue();
-            } else {
-                submodule = subs.get(rev);
-                // FIXME an exception should be thrown after issue with
-                // submodule's revisions and namespaces will be resolved
-                if (submodule == null) {
-                    submodule = subs.lastEntry().getValue();
-                }
-            }
-
-            if (!submodule.getIncludedModules().isEmpty()) {
-                resolveSubmodules(submodule, submodules);
-            }
-            addSubmoduleToModule(submodule, module);
-        }
-    }
-
-    private static void addSubmoduleToModule(final ModuleBuilder submodule, final ModuleBuilder module) {
-        module.addSubmodule(submodule);
-        submodule.setParent(module);
-        module.getDirtyNodes().addAll(submodule.getDirtyNodes());
-        module.getImports().putAll(submodule.getImports());
-        module.getAugments().addAll(submodule.getAugments());
-        module.getAugmentBuilders().addAll(submodule.getAugmentBuilders());
-        module.getAllAugments().addAll(submodule.getAllAugments());
-        module.getChildNodeBuilders().addAll(submodule.getChildNodeBuilders());
-        module.getChildNodes().putAll(submodule.getChildNodes());
-        module.getGroupings().addAll(submodule.getGroupings());
-        module.getGroupingBuilders().addAll(submodule.getGroupingBuilders());
-        module.getTypeDefinitions().addAll(submodule.getTypeDefinitions());
-        module.getTypeDefinitionBuilders().addAll(submodule.getTypeDefinitionBuilders());
-        module.getUsesNodes().addAll(submodule.getUsesNodes());
-        module.getUsesNodeBuilders().addAll(submodule.getUsesNodeBuilders());
-        module.getAllGroupings().addAll(submodule.getAllGroupings());
-        module.getAllUsesNodes().addAll(submodule.getAllUsesNodes());
-        module.getRpcs().addAll(submodule.getRpcs());
-        module.getAddedRpcs().addAll(submodule.getAddedRpcs());
-        module.getNotifications().addAll(submodule.getNotifications());
-        module.getAddedNotifications().addAll(submodule.getAddedNotifications());
-        module.getIdentities().addAll(submodule.getIdentities());
-        module.getAddedIdentities().addAll(submodule.getAddedIdentities());
-        module.getFeatures().addAll(submodule.getFeatures());
-        module.getAddedFeatures().addAll(submodule.getAddedFeatures());
-        module.getDeviations().addAll(submodule.getDeviations());
-        module.getDeviationBuilders().addAll(submodule.getDeviationBuilders());
-        module.getExtensions().addAll(submodule.getExtensions());
-        module.getAddedExtensions().addAll(submodule.getAddedExtensions());
-        module.getUnknownNodes().addAll(submodule.getUnknownNodes());
-        module.getAllUnknownNodes().addAll(submodule.getAllUnknownNodes());
-    }
-
-    private List<ModuleBuilder> resolveModuleBuilders(final Collection<ByteSource> yangFileStreams,
-            final SchemaContext context) throws IOException, YangSyntaxErrorException {
-        Map<ByteSource, ModuleBuilder> parsedBuilders = resolveSources(yangFileStreams, context);
-        ModuleBuilder[] builders = new ModuleBuilder[parsedBuilders.size()];
-        parsedBuilders.values().toArray(builders);
-
-        // module dependency graph sorted
-        List<ModuleBuilder> sorted;
-        if (context == null) {
-            sorted = ModuleDependencySort.sort(builders);
-        } else {
-            sorted = ModuleDependencySort.sortWithContext(context, builders);
-        }
-        return sorted;
-    }
-
-    /**
-     * Order modules by namespace and revision.
-     *
-     * @param modules
-     *            topologically sorted modules
-     * @return modules ordered by namespace and revision
-     */
-    private static Map<URI, NavigableMap<Date, ModuleBuilder>> orderModules(final List<ModuleBuilder> modules) {
-        final Map<URI, NavigableMap<Date, ModuleBuilder>> result = new LinkedHashMap<>();
-        for (final ModuleBuilder builder : modules) {
-            if (builder == null) {
-                continue;
-            }
-
-            URI ns = builder.getNamespace();
-            Date rev = builder.getRevision();
-            if (rev == null) {
-                rev = new Date(0);
-            }
-
-            NavigableMap<Date, ModuleBuilder> builderByRevision = result.get(ns);
-            if (builderByRevision == null) {
-                builderByRevision = new TreeMap<>();
-                builderByRevision.put(rev, builder);
-                result.put(ns, builderByRevision);
-            } else {
-                builderByRevision.put(rev, builder);
-            }
-
-        }
-        return result;
-    }
-
-    /**
-     * Find {@code main} dependencies from {@code other} and add them to
-     * {@code filtered}.
-     *
-     * @param main
-     *            main yang module
-     * @param other
-     *            all loaded modules
-     * @param filtered
-     *            collection to fill up
-     */
-    private void filterImports(final ModuleBuilder main, final Collection<ModuleBuilder> other,
-            final Collection<ModuleBuilder> filtered) {
-        Map<String, ModuleImport> imports = main.getImports();
-
-        // if this is submodule, add parent to filtered and pick its imports
-        if (main.isSubmodule()) {
-            NavigableMap<Date, ModuleBuilder> dependencies = new TreeMap<>();
-            for (ModuleBuilder mb : other) {
-                if (mb.getName().equals(main.getBelongsTo())) {
-                    dependencies.put(mb.getRevision(), mb);
-                }
-            }
-            ModuleBuilder parent = dependencies.get(dependencies.firstKey());
-            filtered.add(parent);
-            imports.putAll(parent.getImports());
-        }
-
-        for (ModuleImport mi : imports.values()) {
-            for (ModuleBuilder builder : other) {
-                if (mi.getModuleName().equals(builder.getModuleName())) {
-                    if (mi.getRevision() == null) {
-                        if (!filtered.contains(builder)) {
-                            filtered.add(builder);
-                            filterImports(builder, other, filtered);
-                        }
-                    } else {
-                        if (!filtered.contains(builder) && mi.getRevision().equals(builder.getRevision())) {
-                            filtered.add(builder);
-                            filterImports(builder, other, filtered);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    private static Map<ByteSource, ParseTree> parseYangSources(final Collection<ByteSource> sources) throws IOException, YangSyntaxErrorException {
-        final Map<ByteSource, ParseTree> trees = new HashMap<>();
-        for (ByteSource source : sources) {
-            try (InputStream stream = source.openStream()) {
-                trees.put(source, parseYangSource(stream));
-            }
-        }
-        return trees;
-    }
-
-    public static YangContext parseYangSource(final InputStream stream) throws IOException, YangSyntaxErrorException {
-        final YangLexer lexer = new YangLexer(new ANTLRInputStream(stream));
-        final CommonTokenStream tokens = new CommonTokenStream(lexer);
-        final YangParser parser = new YangParser(tokens);
-        parser.removeErrorListeners();
-
-        final YangErrorListener errorListener = new YangErrorListener();
-        parser.addErrorListener(errorListener);
-
-        final YangContext result = parser.yang();
-        errorListener.validate();
-
-        return result;
-    }
-
-    /**
-     * Mini parser: This parsing context does not validate full YANG module,
-     * only parses header up to the revisions and imports.
-     *
-     * @param yangStream input stream containing a yang module
-     * @return new instance of YangContext
-     * @see org.opendaylight.yangtools.yang.parser.impl.util.YangModelDependencyInfo
-     */
-    public static YangContext parseStreamWithoutErrorListeners(final InputStream yangStream) {
-        YangContext result = null;
-        try {
-            final ANTLRInputStream input = new ANTLRInputStream(yangStream);
-            final YangLexer lexer = new YangLexer(input);
-            final CommonTokenStream tokens = new CommonTokenStream(lexer);
-            final YangParser parser = new YangParser(tokens);
-            parser.removeErrorListeners();
-            result = parser.yang();
-        } catch (IOException e) {
-            LOG.warn("Exception while reading yang file: " + yangStream, e);
-        }
-        return result;
-    }
-
-    /**
-     * Creates builder-to-module map based on given modules. Method first
-     * resolve unresolved type references, instantiate groupings through uses
-     * statements and perform augmentation.
-     *
-     * Node resolving must be performed in following order:
-     * <ol>
-     * <li>
-     * unresolved type references</li>
-     * <li>
-     * uses in groupings</li>
-     * <li>
-     * uses in other nodes</li>
-     * <li>
-     * augments</li>
-     * </ol>
-     *
-     * @param modules
-     *            all loaded modules
-     * @return modules mapped on their builders
-     */
-    private Map<ModuleBuilder, Module> build(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        resolveDirtyNodes(modules);
-        resolveAugmentsTargetPath(modules);
-        resolveUsesTargetGrouping(modules);
-        resolveUsesForGroupings(modules);
-        resolveUsesForNodes(modules);
-        resolveAugments(modules);
-        resolveIdentities(modules);
-        checkChoiceCasesForDuplicityQNames(modules);
-
-        // build
-        final Map<ModuleBuilder, Module> result = new LinkedHashMap<>();
-        for (Map.Entry<URI, NavigableMap<Date, ModuleBuilder>> entry : modules.entrySet()) {
-            for (Map.Entry<Date, ModuleBuilder> childEntry : entry.getValue().entrySet()) {
-                final ModuleBuilder moduleBuilder = childEntry.getValue();
-                final Module module = moduleBuilder.build();
-                result.put(moduleBuilder, module);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Resolve all unresolved type references.
-     *
-     * @param modules
-     *            all loaded modules
-     */
-    private static void resolveDirtyNodes(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        for (Map.Entry<URI, NavigableMap<Date, ModuleBuilder>> entry : modules.entrySet()) {
-            for (Map.Entry<Date, ModuleBuilder> childEntry : entry.getValue().entrySet()) {
-                final ModuleBuilder module = childEntry.getValue();
-                resolveUnknownNodes(modules, module);
-                resolveDirtyNodes(modules, module);
-            }
-        }
-    }
-
-    /**
-     * Search for dirty nodes (node which contains UnknownType) and resolve
-     * unknown types.
-     *
-     * @param modules
-     *            all available modules
-     * @param module
-     *            current module
-     */
-    private static void resolveDirtyNodes(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules, final ModuleBuilder module) {
-        final Set<TypeAwareBuilder> dirtyNodes = module.getDirtyNodes();
-        if (!dirtyNodes.isEmpty()) {
-            for (TypeAwareBuilder nodeToResolve : dirtyNodes) {
-                if (nodeToResolve instanceof UnionTypeBuilder) {
-                    // special handling for union types
-                    resolveTypeUnion((UnionTypeBuilder) nodeToResolve, modules, module);
-                } else if (nodeToResolve.getTypedef() instanceof IdentityrefTypeBuilder) {
-                    // special handling for identityref types
-                    IdentityrefTypeBuilder idref = (IdentityrefTypeBuilder) nodeToResolve.getTypedef();
-                    IdentitySchemaNodeBuilder identity = findBaseIdentity(module, idref.getBaseString(),
-                            idref.getLine());
-                    if (identity == null) {
-                        throw new YangParseException(module.getName(), idref.getLine(), "Failed to find base identity");
-                    }
-                    idref.setBaseIdentity(identity);
-                    nodeToResolve.setType(idref.build());
-                } else {
-                    resolveType(nodeToResolve, modules, module);
-                }
-            }
-        }
-    }
-
-    /**
-     * Traverse through augmentations of modules and fix their child nodes
-     * schema path.
-     *
-     * @param modules
-     *            all loaded modules
-     */
-    private void resolveAugmentsTargetPath(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        // collect augments from all loaded modules
-        final List<AugmentationSchemaBuilder> allAugments = new ArrayList<>();
-        for (Map.Entry<URI, NavigableMap<Date, ModuleBuilder>> entry : modules.entrySet()) {
-            for (Map.Entry<Date, ModuleBuilder> inner : entry.getValue().entrySet()) {
-                allAugments.addAll(inner.getValue().getAllAugments());
-            }
-        }
-
-        for (AugmentationSchemaBuilder augment : allAugments) {
-            setCorrectAugmentTargetPath(augment);
-        }
-    }
-
-    /**
-     * Find augment target and set correct schema path for all its child nodes.
-     *
-     * @param augment
-     *            augment to resolve
-     */
-    private void setCorrectAugmentTargetPath(final AugmentationSchemaBuilder augment) {
-        Builder parent = augment.getParent();
-        final SchemaPath targetNodeSchemaPath;
-
-        if (parent instanceof UsesNodeBuilder) {
-            targetNodeSchemaPath = findUsesAugmentTargetNodePath(((UsesNodeBuilder) parent).getParent(), augment);
-        } else {
-            targetNodeSchemaPath = augment.getTargetPath();
-        }
-
-        for (DataSchemaNodeBuilder childNode : augment.getChildNodeBuilders()) {
-            correctPathForAugmentNodes(childNode, targetNodeSchemaPath);
-        }
-    }
-
-    private static SchemaPath findUsesAugmentTargetNodePath(final DataNodeContainerBuilder usesParent,
-            final AugmentationSchemaBuilder augment) {
-        QName parentQName = usesParent.getQName();
-        final QNameModule qnm;
-        if (parentQName == null) {
-            ModuleBuilder m = BuilderUtils.getParentModule(usesParent);
-            qnm = m.getQNameModule();
-        } else {
-            qnm = parentQName.getModule();
-        }
-
-        SchemaPath path = usesParent.getPath();
-        for (QName qname : augment.getTargetPath().getPathFromRoot()) {
-            path = path.createChild(QName.create(qnm, qname.getLocalName()));
-        }
-
-        return path;
-    }
-
-    /**
-     * Set new schema path to node and all its child nodes based on given parent
-     * path. This method do not change the namespace.
-     *
-     * @param node
-     *            node which schema path should be updated
-     * @param parentPath
-     *            schema path of parent node
-     */
-    private void correctPathForAugmentNodes(final DataSchemaNodeBuilder node, final SchemaPath parentPath) {
-        SchemaPath newPath = parentPath.createChild(node.getQName());
-        node.setPath(newPath);
-        if (node instanceof DataNodeContainerBuilder) {
-            for (DataSchemaNodeBuilder child : ((DataNodeContainerBuilder) node).getChildNodeBuilders()) {
-                correctPathForAugmentNodes(child, node.getPath());
-            }
-        }
-        if (node instanceof ChoiceBuilder) {
-            for (ChoiceCaseBuilder child : ((ChoiceBuilder) node).getCases()) {
-                correctPathForAugmentNodes(child, node.getPath());
-            }
-        }
-    }
-
-    /**
-     * Check augments for mandatory nodes. If the target node is in another
-     * module, then nodes added by the augmentation MUST NOT be mandatory nodes.
-     * If mandatory node is found, throw an exception.
-     *
-     * @param augments
-     *            augments to check
-     */
-    private static void checkAugmentMandatoryNodes(final Collection<AugmentationSchemaBuilder> augments) {
-        for (AugmentationSchemaBuilder augment : augments) {
-            URI augmentTargetNs = augment.getTargetPath().getPathFromRoot().iterator().next().getNamespace();
-            Date augmentTargetRev = augment.getTargetPath().getPathFromRoot().iterator().next().getRevision();
-            ModuleBuilder module = BuilderUtils.getParentModule(augment);
-
-            if (augmentTargetNs.equals(module.getNamespace()) && augmentTargetRev.equals(module.getRevision())) {
-                continue;
-            }
-
-            for (DataSchemaNodeBuilder childNode : augment.getChildNodeBuilders()) {
-                if (childNode.getConstraints().isMandatory()) {
-                    throw new YangParseException(augment.getModuleName(), augment.getLine(),
-                            "Error in augment parsing: cannot augment mandatory node "
-                                    + childNode.getQName().getLocalName());
-                }
-            }
-        }
-    }
-
-    /**
-     * Go through all augment definitions and resolve them.
-     *
-     * @param modules
-     *            all loaded modules topologically sorted (based on dependencies
-     *            between each other)
-     */
-    private static void resolveAugments(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        List<ModuleBuilder> all = new ArrayList<>();
-        for (Map.Entry<URI, NavigableMap<Date, ModuleBuilder>> entry : modules.entrySet()) {
-            for (Map.Entry<Date, ModuleBuilder> inner : entry.getValue().entrySet()) {
-                all.add(inner.getValue());
-            }
-        }
-
-        for (ModuleBuilder mb : all) {
-            if (mb != null) {
-                List<AugmentationSchemaBuilder> augments = mb.getAllAugments();
-                checkAugmentMandatoryNodes(augments);
-                Collections.sort(augments, Comparators.AUGMENT_BUILDER_COMP);
-                for (AugmentationSchemaBuilder augment : augments) {
-                    if (!(augment.isResolved())) {
-                        boolean resolved = resolveAugment(augment, mb, modules);
-                        if (!resolved) {
-                            throw new YangParseException(augment.getModuleName(), augment.getLine(),
-                                    "Error in augment parsing: failed to find augment target: " + augment);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Perform augmentation defined under uses statement.
-     *
-     * @param augment
-     *            augment to resolve
-     * @param module
-     *            current module
-     * @param modules
-     *            all loaded modules
-     * @return true if augment process succeed
-     */
-    private static boolean resolveUsesAugment(final AugmentationSchemaBuilder augment, final ModuleBuilder module,
-            final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        if (augment.isResolved()) {
-            return true;
-        }
-
-        UsesNodeBuilder usesNode = (UsesNodeBuilder) augment.getParent();
-        DataNodeContainerBuilder parentNode = usesNode.getParent();
-        Optional<SchemaNodeBuilder> potentialTargetNode;
-        SchemaPath resolvedTargetPath = findUsesAugmentTargetNodePath(parentNode, augment);
-        if (parentNode instanceof ModuleBuilder && resolvedTargetPath.isAbsolute()) {
-            // Uses is directly used in module body, we lookup
-            // We lookup in data namespace to find correct augmentation target
-            potentialTargetNode = findSchemaNodeInModule(resolvedTargetPath, (ModuleBuilder) parentNode);
-        } else {
-            // Uses is used in local context (be it data namespace or grouping
-            // namespace,
-            // since all nodes via uses are imported to localName, it is safe to
-            // to proceed only with local names.
-            //
-            // Conflicting elements in other namespaces are still not present
-            // since resolveUsesAugment occurs before augmenting from external
-            // modules.
-            potentialTargetNode = Optional.fromNullable(findTargetNode(augment.getTargetPath()
-                    .getPathFromRoot(), parentNode));
-        }
-
-        if (potentialTargetNode.isPresent()) {
-            SchemaNodeBuilder targetNode = potentialTargetNode.get();
-            if (targetNode instanceof AugmentationTargetBuilder) {
-                fillAugmentTarget(augment, targetNode);
-                ((AugmentationTargetBuilder) targetNode).addAugmentation(augment);
-                augment.setResolved(true);
-                return true;
-            } else {
-                LOG.warn(
-                        "Error in module {} at line {}: Unsupported augment target: {}. Augmentation process skipped.",
-                        module.getName(), augment.getLine(), potentialTargetNode);
-                augment.setResolved(true);
-                augment.setUnsupportedTarget(true);
-                return true;
-            }
-        } else {
-            throw new YangParseException(module.getName(), augment.getLine(), String.format(
-                    "Failed to resolve augment in uses. Invalid augment target path: %s", augment.getTargetPath()));
-        }
-
-    }
-
-    /**
-     * Find augment target module and perform augmentation.
-     *
-     * @param augment
-     *            augment to resolve
-     * @param module
-     *            current module
-     * @param modules
-     *            all loaded modules
-     * @return true if augment process succeed
-     */
-    private static boolean resolveAugment(final AugmentationSchemaBuilder augment, final ModuleBuilder module,
-            final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        if (augment.isResolved()) {
-            return true;
-        }
-
-        QName targetModuleName = augment.getTargetPath().getPathFromRoot().iterator().next();
-        ModuleBuilder targetModule = BuilderUtils.findModule(targetModuleName, modules);
-        if (targetModule == null) {
-            throw new YangParseException(module.getModuleName(), augment.getLine(), "Failed to resolve augment "
-                    + augment);
-        }
-
-        return processAugmentation(augment, targetModule);
-    }
-
-    /**
-     * Go through identity statements defined in current module and resolve
-     * their 'base' statement.
-     *
-     * @param modules
-     *            all loaded modules
-     */
-    private static void resolveIdentities(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        for (Map.Entry<URI, NavigableMap<Date, ModuleBuilder>> entry : modules.entrySet()) {
-            for (Map.Entry<Date, ModuleBuilder> inner : entry.getValue().entrySet()) {
-                ModuleBuilder module = inner.getValue();
-                final Set<IdentitySchemaNodeBuilder> identities = module.getAddedIdentities();
-                for (IdentitySchemaNodeBuilder identity : identities) {
-                    resolveIdentity(module, identity);
-                }
-            }
-        }
-    }
-
-    private static void resolveIdentity(final ModuleBuilder module,
-            final IdentitySchemaNodeBuilder identity) {
-        final String baseIdentityName = identity.getBaseIdentityName();
-        if (baseIdentityName != null) {
-            IdentitySchemaNodeBuilder result = null;
-            if (baseIdentityName.contains(":")) {
-                final int line = identity.getLine();
-                String[] splittedBase = baseIdentityName.split(":");
-                if (splittedBase.length > 2) {
-                    throw new YangParseException(module.getName(), line,
-                            "Failed to parse identityref base: "
-                                    + baseIdentityName);
-                }
-                String prefix = splittedBase[0];
-                String name = splittedBase[1];
-
-                if (prefix.equals(module.getPrefix())
-                        && name.equals(identity.getQName().getLocalName())) {
-                    throw new YangParseException(module.getName(),
-                            identity.getLine(),
-                            "Failed to parse base, identity name equals base identity name: "
-                                    + baseIdentityName);
-                }
-
-                ModuleBuilder dependentModule = BuilderUtils.getModuleByPrefix(
-                        module, prefix);
-                result = BuilderUtils.findIdentity(
-                        dependentModule.getAddedIdentities(), name);
-            } else {
-                if (baseIdentityName.equals(identity.getQName().getLocalName())) {
-                    throw new YangParseException(module.getName(),
-                            identity.getLine(),
-                            "Failed to parse base, identity name equals base identity name: "
-                                    + baseIdentityName);
-                }
-                result = BuilderUtils.findIdentity(module.getAddedIdentities(),
-                        baseIdentityName);
-            }
-            identity.setBaseIdentity(result);
-        }
-    }
-
-    /**
-     * Find and add reference of uses target grouping.
-     *
-     * @param modules
-     *            all loaded modules
-     */
-    private static void resolveUsesTargetGrouping(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        final List<UsesNodeBuilder> allUses = new ArrayList<>();
-        for (Map.Entry<URI, NavigableMap<Date, ModuleBuilder>> entry : modules.entrySet()) {
-            for (Map.Entry<Date, ModuleBuilder> inner : entry.getValue().entrySet()) {
-                allUses.addAll(inner.getValue().getAllUsesNodes());
-            }
-        }
-        for (UsesNodeBuilder usesNode : allUses) {
-            ModuleBuilder module = BuilderUtils.getParentModule(usesNode);
-            final GroupingBuilder targetGroupingBuilder = GroupingUtils.getTargetGroupingFromModules(usesNode, modules,
-                    module);
-            usesNode.setGrouping(targetGroupingBuilder);
-        }
-    }
-
-    /**
-     * Resolve uses statements defined in groupings.
-     *
-     * @param modules
-     *            all loaded modules
-     */
-    private static void resolveUsesForGroupings(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        final Set<GroupingBuilder> allGroupings = new HashSet<>();
-        for (Map.Entry<URI, NavigableMap<Date, ModuleBuilder>> entry : modules.entrySet()) {
-            for (Map.Entry<Date, ModuleBuilder> inner : entry.getValue().entrySet()) {
-                ModuleBuilder module = inner.getValue();
-                allGroupings.addAll(module.getAllGroupings());
-            }
-        }
-        final List<GroupingBuilder> sorted = GroupingSort.sort(allGroupings);
-        for (GroupingBuilder gb : sorted) {
-            List<UsesNodeBuilder> usesNodes = new ArrayList<>(GroupingSort.getAllUsesNodes(gb));
-            Collections.sort(usesNodes, new GroupingUtils.UsesComparator());
-            for (UsesNodeBuilder usesNode : usesNodes) {
-                resolveUses(usesNode, modules);
-            }
-        }
-    }
-
-    /**
-     * Resolve uses statements.
-     *
-     * @param modules
-     *            all loaded modules
-     */
-    private static void resolveUsesForNodes(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        for (Map.Entry<URI, NavigableMap<Date, ModuleBuilder>> entry : modules.entrySet()) {
-            for (Map.Entry<Date, ModuleBuilder> inner : entry.getValue().entrySet()) {
-                ModuleBuilder module = inner.getValue();
-                List<UsesNodeBuilder> usesNodes = module.getAllUsesNodes();
-                Collections.sort(usesNodes, new GroupingUtils.UsesComparator());
-                for (UsesNodeBuilder usesNode : usesNodes) {
-                    resolveUses(usesNode, modules);
-                }
-            }
-        }
-    }
-
-    /**
-     * Find target grouping and copy its child nodes to current location with
-     * new namespace.
-     *
-     * @param usesNode
-     *            uses node to resolve
-     * @param modules
-     *            all loaded modules
-     */
-    private static void resolveUses(final UsesNodeBuilder usesNode, final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        if (!usesNode.isResolved()) {
-            DataNodeContainerBuilder parent = usesNode.getParent();
-            ModuleBuilder module = BuilderUtils.getParentModule(parent);
-            GroupingBuilder target = GroupingUtils.getTargetGroupingFromModules(usesNode, modules, module);
-
-            int index = nodeAfterUsesIndex(usesNode);
-            List<DataSchemaNodeBuilder> targetNodes = target.instantiateChildNodes(parent);
-            for (DataSchemaNodeBuilder targetNode : targetNodes) {
-                parent.addChildNode(index++, targetNode);
-            }
-            parent.getTypeDefinitionBuilders().addAll(target.instantiateTypedefs(parent));
-            parent.getGroupingBuilders().addAll(target.instantiateGroupings(parent));
-            parent.getUnknownNodes().addAll(target.instantiateUnknownNodes(parent));
-            usesNode.setResolved(true);
-            for (AugmentationSchemaBuilder augment : usesNode.getAugmentations()) {
-                resolveUsesAugment(augment, module, modules);
-            }
-
-            GroupingUtils.performRefine(usesNode);
-        }
-    }
-
-    private static int nodeAfterUsesIndex(final UsesNodeBuilder usesNode) {
-        DataNodeContainerBuilder parent = usesNode.getParent();
-        int usesLine = usesNode.getLine();
-
-        List<DataSchemaNodeBuilder> childNodes = parent.getChildNodeBuilders();
-        if (childNodes.isEmpty()) {
-            return 0;
-        }
-
-        DataSchemaNodeBuilder nextNodeAfterUses = null;
-        for (DataSchemaNodeBuilder childNode : childNodes) {
-            if (!childNode.isAddedByUses() && !childNode.isAugmenting() && childNode.getLine() > usesLine) {
-                nextNodeAfterUses = childNode;
-                break;
-            }
-        }
-
-        // uses is declared after child nodes
-        if (nextNodeAfterUses == null) {
-            return childNodes.size();
-        }
-
-        return parent.getChildNodeBuilders().indexOf(nextNodeAfterUses);
-    }
-
-    /**
-     * Try to find extension describing this unknown node and assign it to
-     * unknown node builder.
-     *
-     * @param modules
-     *            all loaded modules
-     * @param module
-     *            current module
-     */
-    private static void resolveUnknownNodes(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules, final ModuleBuilder module) {
-        for (UnknownSchemaNodeBuilder usnb : module.getAllUnknownNodes()) {
-            QName nodeType = usnb.getNodeType();
-            String localName = usnb.getNodeType().getLocalName();
-            ModuleBuilder dependentModule = BuilderUtils.findModule(nodeType, modules);
-
-            if (dependentModule == null) {
-                LOG.warn(
-                        "Error in module {} at line {}: Failed to resolve node {}: no such extension definition found.",
-                        module.getName(), usnb.getLine(), usnb);
-                continue;
-            }
-
-            ExtensionBuilder extBuilder = findExtBuilder(localName, dependentModule.getAddedExtensions());
-            if (extBuilder == null) {
-                ExtensionDefinition extDef = findExtDef(localName, dependentModule.getExtensions());
-                if (extDef == null) {
-                    LOG.warn(
-                            "Error in module {} at line {}: Failed to resolve node {}: no such extension definition found.",
-                            module.getName(), usnb.getLine(), usnb);
-                } else {
-                    usnb.setExtensionDefinition(extDef);
-                }
-            } else {
-                usnb.setExtensionBuilder(extBuilder);
-            }
-        }
-    }
-
-    private static ExtensionBuilder findExtBuilder(final String name, final Collection<ExtensionBuilder> extensions) {
-        for (ExtensionBuilder extension : extensions) {
-            if (extension.getQName().getLocalName().equals(name)) {
-                return extension;
-            }
-        }
-        return null;
-    }
-
-    private static ExtensionDefinition findExtDef(final String name, final Collection<ExtensionDefinition> extensions) {
-        for (ExtensionDefinition extension : extensions) {
-            if (extension.getQName().getLocalName().equals(name)) {
-                return extension;
-            }
-        }
-        return null;
-    }
-
-
-    /**
-     * Traverse through modules and check if choice has choice cases with the
-     * same qname.
-     *
-     * @param modules
-     *            all loaded modules
-     */
-    private void checkChoiceCasesForDuplicityQNames(final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        for (Map.Entry<URI, NavigableMap<Date, ModuleBuilder>> entry : modules.entrySet()) {
-            for (Map.Entry<Date, ModuleBuilder> childEntry : entry.getValue().entrySet()) {
-                final ModuleBuilder moduleBuilder = childEntry.getValue();
-                final Module module = moduleBuilder.build();
-                final List<ChoiceSchemaNode> allChoicesFromModule = getChoicesFrom(module);
-
-                for (ChoiceSchemaNode choiceNode : allChoicesFromModule) {
-                    findDuplicityNodesIn(choiceNode, module, moduleBuilder, modules);
-                }
-            }
-        }
-    }
-
-    private static void findDuplicityNodesIn(final ChoiceSchemaNode choiceNode, final Module module, final ModuleBuilder moduleBuilder,
-            final Map<URI, NavigableMap<Date, ModuleBuilder>> modules) {
-        final Set<QName> duplicityTestSet = new HashSet<>();
-
-        for (ChoiceCaseNode choiceCaseNode : choiceNode.getCases()) {
-
-            for (DataSchemaNode childSchemaNode : choiceCaseNode.getChildNodes()) {
-                if (!duplicityTestSet.add(childSchemaNode.getQName())) {
-                    final Optional<SchemaNodeBuilder> schemaNodeBuilder = BuilderUtils.findSchemaNodeInModule(childSchemaNode.getPath(), moduleBuilder);
-                    final String nameOfSchemaNode = childSchemaNode.getQName().getLocalName();
-                    int lineOfSchemaNode = 0;
-
-                    if (schemaNodeBuilder.isPresent()) {
-                        lineOfSchemaNode = schemaNodeBuilder.get().getLine();
-                    }
-                    throw new YangParseException(module.getName(), lineOfSchemaNode,
-                            String.format("Choice has two nodes case with same qnames - %s", nameOfSchemaNode));
-                }
-            }
-        }
-    }
-
-    private List<ChoiceSchemaNode> getChoicesFrom(final Module module) {
-        final List<ChoiceSchemaNode> allChoices = new ArrayList<>();
-
-        for (DataSchemaNode dataSchemaNode : module.getChildNodes()) {
-            findChoicesIn(dataSchemaNode, allChoices);
-        }
-        return allChoices;
-    }
-
-    private void findChoicesIn(final SchemaNode schemaNode, final Collection<ChoiceSchemaNode> choiceNodes) {
-        if (schemaNode instanceof ContainerSchemaNode) {
-            final ContainerSchemaNode contSchemaNode = (ContainerSchemaNode) schemaNode;
-            for (DataSchemaNode dataSchemaNode : contSchemaNode.getChildNodes()) {
-                findChoicesIn(dataSchemaNode, choiceNodes);
-            }
-        } else if (schemaNode instanceof ListSchemaNode) {
-            final ListSchemaNode listSchemaNode = (ListSchemaNode) schemaNode;
-            for (DataSchemaNode dataSchemaNode : listSchemaNode.getChildNodes()) {
-                findChoicesIn(dataSchemaNode, choiceNodes);
-            }
-        } else if (schemaNode instanceof ChoiceSchemaNode) {
-            choiceNodes.add((ChoiceSchemaNode) schemaNode);
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangParserListenerImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/YangParserListenerImpl.java
deleted file mode 100644 (file)
index ec5e1f1..0000000
+++ /dev/null
@@ -1,1204 +0,0 @@
-/*
- * Copyright (c) 2013 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.impl;
-
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.checkMissingBody;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.createListKey;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.getConfig;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.getIdentityrefBase;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.parseConstraints;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.parseDefault;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.parseRefine;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.parseSchemaNodeArgs;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.parseStatus;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.parseTypeWithBody;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.parseUnits;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.parseUserOrdered;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.parseYinValue;
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.stringFromNode;
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.Iterables;
-import java.net.URI;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.Set;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.ParseTreeWalker;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Argument_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Base_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Contact_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Container_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Default_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Description_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Deviate_add_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Deviate_delete_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Deviate_not_supported_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Deviate_replace_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Import_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Key_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Leaf_list_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Leaf_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.List_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_header_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Namespace_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Ordered_by_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Organization_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Prefix_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Presence_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Reference_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_date_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Status_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Type_body_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Units_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.When_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Yang_version_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParserBaseListener;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.util.BaseTypes;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ExtensionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeAwareBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.AnyXmlBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ChoiceBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ChoiceCaseBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ContainerSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.DeviationBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.FeatureBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.IdentitySchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.LeafListSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.LeafSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ListSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.NotificationBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.RefineHolderImpl;
-import org.opendaylight.yangtools.yang.parser.builder.impl.RpcDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.UnionTypeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.UnknownSchemaNodeBuilderImpl;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public final class YangParserListenerImpl extends YangParserBaseListener {
-    private static final Logger LOG = LoggerFactory.getLogger(YangParserListenerImpl.class);
-    private static final Splitter SLASH_SPLITTER = Splitter.on('/').omitEmptyStrings();
-    private static final Splitter COLON_SPLITTER = Splitter.on(':');
-    private static final String AUGMENT_STR = "augment";
-
-    private static final String IMPORT_STR = "import";
-    private static final String UNION_STR = "union";
-    private static final String UNKNOWN_NODE_STR = "unknown-node";
-
-    /**
-     * Date Format is not thread-safe so we cannot make constant from it.
-     */
-    private final DateFormat revisionFormat = new SimpleDateFormat("yyyy-MM-dd");
-    private final SchemaPathStack stack = new SchemaPathStack();
-    private final Map<String, NavigableMap<Date, URI>> namespaceContext;
-    private final String sourcePath;
-    private QName moduleQName = QName.create(null, new Date(0L), "dummy");
-    private ModuleBuilder moduleBuilder;
-    private String moduleName;
-    private int augmentOrder;
-    private String yangModelPrefix;
-
-    public YangParserListenerImpl(final Map<String, NavigableMap<Date, URI>> namespaceContext, final String sourcePath) {
-        this.namespaceContext = namespaceContext;
-        this.sourcePath = sourcePath;
-    }
-
-    /**
-     * Create a new instance.
-     *
-     * FIXME: the resulting type needs to be extracted, such that we can reuse
-     * the "BaseListener" aspect, which need not be exposed to the user. Maybe
-     * factor out a base class into repo.spi?
-     *
-     * @param namespaceContext namespaceContext
-     * @param sourcePath sourcePath
-     * @param walker walker
-     * @param tree tree
-     * @return new instance of YangParserListenerImpl
-     */
-    public static YangParserListenerImpl create(final Map<String, NavigableMap<Date, URI>> namespaceContext,
-            final String sourcePath, final ParseTreeWalker walker, final ParseTree tree) {
-        final YangParserListenerImpl ret = new YangParserListenerImpl(namespaceContext, sourcePath);
-        walker.walk(ret, tree);
-        return ret;
-    }
-
-    @Override
-    public void enterModule_stmt(final YangParser.Module_stmtContext ctx) {
-        moduleName = stringFromNode(ctx);
-        LOG.trace("entering module {}", moduleName);
-        enterLog("module", moduleName, 0);
-        stack.push();
-
-        moduleBuilder = new ModuleBuilder(moduleName, sourcePath);
-
-        String description = null;
-        String reference = null;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Description_stmtContext) {
-                description = stringFromNode(child);
-            } else if (child instanceof Reference_stmtContext) {
-                reference = stringFromNode(child);
-            } else {
-                if (description != null && reference != null) {
-                    break;
-                }
-            }
-        }
-        moduleBuilder.setDescription(description);
-        moduleBuilder.setReference(reference);
-    }
-
-    @Override
-    public void exitModule_stmt(final YangParser.Module_stmtContext ctx) {
-        exitLog("module");
-        stack.pop();
-    }
-
-    @Override
-    public void enterSubmodule_stmt(final YangParser.Submodule_stmtContext ctx) {
-        moduleName = stringFromNode(ctx);
-        LOG.trace("entering submodule {}", moduleName);
-        enterLog("submodule", moduleName, 0);
-        stack.push();
-
-        moduleBuilder = new ModuleBuilder(moduleName, true, sourcePath);
-
-        String description = null;
-        String reference = null;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Description_stmtContext) {
-                description = stringFromNode(child);
-            } else if (child instanceof Reference_stmtContext) {
-                reference = stringFromNode(child);
-            } else {
-                if (description != null && reference != null) {
-                    break;
-                }
-            }
-        }
-        moduleBuilder.setDescription(description);
-        moduleBuilder.setReference(reference);
-    }
-
-    @Override
-    public void exitSubmodule_stmt(final YangParser.Submodule_stmtContext ctx) {
-        exitLog("submodule");
-        stack.pop();
-    }
-
-    @Override
-    public void enterBelongs_to_stmt(final YangParser.Belongs_to_stmtContext ctx) {
-        final String belongsTo = stringFromNode(ctx);
-        final NavigableMap<Date, URI> context = namespaceContext.get(belongsTo);
-        final Map.Entry<Date, URI> entry = context.firstEntry();
-        // TODO
-        // Submodule will contain namespace and revision from module to which it
-        // belongs. If there are multiple modules with same name and different
-        // revisions, it will has revision from the newest one.
-        this.moduleQName = QName.create(entry.getValue(), entry.getKey(), moduleQName.getLocalName());
-        moduleBuilder.setQNameModule(moduleQName.getModule());
-        moduleBuilder.setBelongsTo(belongsTo);
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            final ParseTree treeNode = ctx.getChild(i);
-            if (treeNode instanceof Prefix_stmtContext) {
-                yangModelPrefix = stringFromNode(treeNode);
-                moduleBuilder.setPrefix(yangModelPrefix);
-                setLog("prefix", yangModelPrefix);
-            }
-        }
-    }
-
-    @Override
-    public void enterModule_header_stmts(final Module_header_stmtsContext ctx) {
-        enterLog("module_header", "", ctx.getStart().getLine());
-        String yangVersion = null;
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            final ParseTree treeNode = ctx.getChild(i);
-            if (treeNode instanceof Namespace_stmtContext) {
-                final String namespaceStr = stringFromNode(treeNode);
-                final URI namespace = URI.create(namespaceStr);
-                this.moduleQName = QName.create(namespace, moduleQName.getRevision(), moduleQName.getLocalName());
-                moduleBuilder.setQNameModule(moduleQName.getModule());
-                setLog("namespace", namespaceStr);
-            } else if (treeNode instanceof Prefix_stmtContext) {
-                yangModelPrefix = stringFromNode(treeNode);
-                this.moduleQName = QName.create(moduleQName.getModule(), moduleQName.getLocalName());
-                moduleBuilder.setPrefix(yangModelPrefix);
-                setLog("prefix", yangModelPrefix);
-            } else if (treeNode instanceof Yang_version_stmtContext) {
-                yangVersion = stringFromNode(treeNode);
-                setLog("yang-version", yangVersion);
-            }
-        }
-
-        if (yangVersion == null) {
-            yangVersion = "1";
-        }
-        moduleBuilder.setYangVersion(yangVersion);
-    }
-
-    @Override
-    public void exitModule_header_stmts(final Module_header_stmtsContext ctx) {
-        exitLog("module_header");
-    }
-
-    @Override
-    public void enterMeta_stmts(final YangParser.Meta_stmtsContext ctx) {
-        enterLog("meta_stmt", "", ctx.getStart().getLine());
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Organization_stmtContext) {
-                final String organization = stringFromNode(child);
-                moduleBuilder.setOrganization(organization);
-                setLog("organization", organization);
-            } else if (child instanceof Contact_stmtContext) {
-                final String contact = stringFromNode(child);
-                moduleBuilder.setContact(contact);
-                setLog("contact", contact);
-            } else if (child instanceof Description_stmtContext) {
-                final String description = stringFromNode(child);
-                moduleBuilder.setDescription(description);
-                setLog("description", description);
-            } else if (child instanceof Reference_stmtContext) {
-                final String reference = stringFromNode(child);
-                moduleBuilder.setReference(reference);
-                setLog("reference", reference);
-            }
-        }
-    }
-
-    @Override
-    public void exitMeta_stmts(final YangParser.Meta_stmtsContext ctx) {
-        exitLog("meta_stmt");
-    }
-
-    @Override
-    public void enterRevision_stmts(final Revision_stmtsContext ctx) {
-        enterLog("revisions", "", ctx.getStart().getLine());
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            final ParseTree treeNode = ctx.getChild(i);
-            if (treeNode instanceof Revision_stmtContext) {
-                updateRevisionForRevisionStatement(treeNode);
-            }
-        }
-    }
-
-    @Override
-    public void exitRevision_stmts(final Revision_stmtsContext ctx) {
-        exitLog("revisions");
-    }
-
-    private void updateRevisionForRevisionStatement(final ParseTree treeNode) {
-        final String revisionDateStr = stringFromNode(treeNode);
-        try {
-            final Date revisionDate = revisionFormat.parse(revisionDateStr);
-            if ((revisionDate != null) && (this.moduleQName.getRevision().compareTo(revisionDate) < 0)) {
-                this.moduleQName = QName.create(moduleQName.getNamespace(), revisionDate, moduleQName.getLocalName());
-                moduleBuilder.setQNameModule(moduleQName.getModule());
-                setLog("revision", revisionDate.toString());
-                for (int i = 0; i < treeNode.getChildCount(); ++i) {
-                    final ParseTree child = treeNode.getChild(i);
-                    if (child instanceof Reference_stmtContext) {
-                        moduleBuilder.setReference(stringFromNode(child));
-                    }
-                }
-            }
-        } catch (final ParseException e) {
-            LOG.warn("Failed to parse revision string: {}", revisionDateStr, e);
-        }
-    }
-
-    @Override
-    public void enterImport_stmt(final Import_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String importName = stringFromNode(ctx);
-        enterLog(IMPORT_STR, importName, line);
-
-        String importPrefix = null;
-        Date importRevision = null;
-
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            final ParseTree treeNode = ctx.getChild(i);
-            if (treeNode instanceof Prefix_stmtContext) {
-                importPrefix = stringFromNode(treeNode);
-            } else if (treeNode instanceof Revision_date_stmtContext) {
-                final String importRevisionStr = stringFromNode(treeNode);
-                try {
-                    importRevision = revisionFormat.parse(importRevisionStr);
-                } catch (final ParseException e) {
-                    LOG.warn("Failed to parse import revision-date at line {}: {}", line, importRevisionStr, e);
-                }
-            }
-        }
-        moduleBuilder.addModuleImport(importName, importRevision, importPrefix);
-        LOG.trace("setting import ({}; {}; {})", importName, importRevision, importPrefix);
-    }
-
-    @Override
-    public void exitImport_stmt(final Import_stmtContext ctx) {
-        exitLog(IMPORT_STR);
-    }
-
-    @Override
-    public void enterInclude_stmt(final YangParser.Include_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String includeName = stringFromNode(ctx);
-        enterLog(IMPORT_STR, includeName, line);
-
-        Date includeRevision = null;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree treeNode = ctx.getChild(i);
-            if (treeNode instanceof Revision_date_stmtContext) {
-                final String importRevisionStr = stringFromNode(treeNode);
-                try {
-                    includeRevision = revisionFormat.parse(importRevisionStr);
-                } catch (final ParseException e) {
-                    LOG.warn("Failed to parse import revision-date at line {}: {}", line, importRevisionStr, e);
-                }
-            }
-        }
-        moduleBuilder.addInclude(includeName, includeRevision);
-    }
-
-    @Override
-    public void exitInclude_stmt(final YangParser.Include_stmtContext ctx) {
-        exitLog("include");
-    }
-
-    @Override
-    public void enterAugment_stmt(final YangParser.Augment_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String augmentPath = stringFromNode(ctx);
-        enterLog(AUGMENT_STR, augmentPath, line);
-        stack.push();
-
-        final SchemaPath targetPath = parseXPathString(augmentPath, line);
-        final AugmentationSchemaBuilder builder = moduleBuilder.addAugment(line, augmentPath, targetPath,
-                augmentOrder++);
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Description_stmtContext) {
-                builder.setDescription(stringFromNode(child));
-            } else if (child instanceof Reference_stmtContext) {
-                builder.setReference(stringFromNode(child));
-            } else if (child instanceof Status_stmtContext) {
-                builder.setStatus(parseStatus((Status_stmtContext) child));
-            } else if (child instanceof When_stmtContext) {
-                builder.addWhenCondition(stringFromNode(child));
-            }
-        }
-
-        moduleBuilder.enterNode(builder);
-    }
-
-    @Override
-    public void exitAugment_stmt(final YangParser.Augment_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog(AUGMENT_STR);
-        stack.pop();
-    }
-
-    @Override
-    public void enterExtension_stmt(final YangParser.Extension_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String extName = stringFromNode(ctx);
-        enterLog("extension", extName, line);
-        final QName qname = QName.create(moduleQName, extName);
-        final SchemaPath path = stack.addNodeToPath(qname);
-
-        final ExtensionBuilder builder = moduleBuilder.addExtension(qname, line, path);
-        parseSchemaNodeArgs(ctx, builder);
-
-        String argument = null;
-        boolean yin = false;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Argument_stmtContext) {
-                argument = stringFromNode(child);
-                yin = parseYinValue((Argument_stmtContext) child);
-                break;
-            }
-        }
-        builder.setArgument(argument);
-        builder.setYinElement(yin);
-
-        moduleBuilder.enterNode(builder);
-    }
-
-    @Override
-    public void exitExtension_stmt(final YangParser.Extension_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("extension", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterTypedef_stmt(final YangParser.Typedef_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String typedefName = stringFromNode(ctx);
-        enterLog("typedef", typedefName, line);
-        final QName typedefQName = QName.create(moduleQName, typedefName);
-        final SchemaPath path = stack.addNodeToPath(typedefQName);
-
-        final TypeDefinitionBuilder builder = moduleBuilder.addTypedef(line, typedefQName, path);
-        parseSchemaNodeArgs(ctx, builder);
-        builder.setUnits(parseUnits(ctx));
-        builder.setDefaultValue(parseDefault(ctx));
-
-        moduleBuilder.enterNode(builder);
-    }
-
-    @Override
-    public void exitTypedef_stmt(final YangParser.Typedef_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("typedef", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterType_stmt(final YangParser.Type_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String typeName = stringFromNode(ctx);
-        enterLog("type", typeName, line);
-
-        final QName typeQName = parseQName(typeName, line);
-
-        TypeDefinition<?> type;
-        Type_body_stmtsContext typeBody = null;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            if (ctx.getChild(i) instanceof Type_body_stmtsContext) {
-                typeBody = (Type_body_stmtsContext) ctx.getChild(i);
-                break;
-            }
-        }
-
-        // if this is base yang type...
-        if (BaseTypes.isYangBuildInType(typeName)) {
-            if (typeBody == null) {
-                // check for types which must have body
-                checkMissingBody(typeName, moduleName, line);
-                // if there are no constraints, just grab default base yang type
-                type = BaseTypes.defaultBaseTypeFor(typeName).orNull();
-                stack.addNodeToPath(type.getQName());
-                moduleBuilder.setType(type);
-            } else {
-                QName qname;
-                switch (typeName) {
-                case UNION_STR:
-                    stack.addNodeToPath(BaseTypes.UNION_QNAME);
-                    final UnionTypeBuilder unionBuilder = moduleBuilder.addUnionType(line, moduleQName.getModule());
-                    final Builder parentBuilder = moduleBuilder.getActualNode();
-                    unionBuilder.setParent(parentBuilder);
-                    moduleBuilder.enterNode(unionBuilder);
-                    break;
-                case "identityref":
-                    qname = BaseTypes.IDENTITYREF_QNAME;
-                    final SchemaPath path = stack.addNodeToPath(qname);
-                    moduleBuilder.addIdentityrefType(line, path, getIdentityrefBase(typeBody));
-                    break;
-                default:
-                    type = parseTypeWithBody(typeName, typeBody, stack.currentSchemaPath(), moduleQName,
-                            moduleBuilder.getActualNode());
-                    moduleBuilder.setType(type);
-                    stack.addNodeToPath(type.getQName());
-                }
-            }
-        } else {
-            final TypeAwareBuilder parent = (TypeAwareBuilder) moduleBuilder.getActualNode();
-            if (typeBody == null) {
-                parent.setTypeQName(typeQName);
-                moduleBuilder.markActualNodeDirty();
-            } else {
-                ParserListenerUtils.parseUnknownTypeWithBody(typeBody, parent, typeQName, moduleBuilder, moduleQName,
-                        stack.currentSchemaPath());
-            }
-            stack.addNodeToPath(QName.create(moduleQName.getModule(), typeQName.getLocalName()));
-        }
-    }
-
-    /**
-     * Method transforms string representation of yang element (i.e. leaf name,
-     * container name etc.) into QName. The namespace of QName is assigned from
-     * parent module same as revision date of module. If String qname parameter
-     * contains ":" the string is evaluated as prefix:name of element. In this
-     * case method will look into import map and extract correct ModuleImport.
-     * If such import is not present in import map the method will throw
-     * {@link YangParseException} <br>
-     * If ModuleImport is present but the value of namespace in ModuleImport is
-     * <code>null</code> the method will throw {@link YangParseException}
-     *
-     * @param qnameString
-     *            QName value as String
-     * @param line
-     *            line in Yang model document where QName occur.
-     * @return transformed string qname parameter as QName structure.
-     *
-     * @throws YangParseException
-     */
-    private QName parseQName(final String qnameString, final int line) {
-        final QName qname;
-        if (qnameString.indexOf(':') == -1) {
-            qname = QName.create(moduleQName, qnameString);
-        } else {
-            final Iterator<String> split = COLON_SPLITTER.split(qnameString).iterator();
-            final String prefix = split.next();
-            final String name = split.next();
-            if (prefix.equals(moduleBuilder.getPrefix())) {
-                qname = QName.create(moduleQName, name);
-            } else {
-                final ModuleImport imp = moduleBuilder.getImport(prefix);
-                if (imp == null) {
-                    LOG.debug("Error in module {} at line {}: No import found with prefix {}", moduleName, line, prefix);
-                    throw new YangParseException(moduleName, line, "Error in module " + moduleName
-                            + " No import found with prefix " + prefix + " not found.");
-                }
-                Date revision = imp.getRevision();
-                final NavigableMap<Date, URI> namespaces = namespaceContext.get(imp.getModuleName());
-                if (namespaces == null) {
-                    throw new YangParseException(moduleName, line, String.format("Imported module %s not found",
-                            imp.getModuleName()));
-                }
-                URI namespace;
-                if (revision == null) {
-                    revision = namespaces.lastEntry().getKey();
-                    namespace = namespaces.lastEntry().getValue();
-                } else {
-                    // FIXME: this lookup does not look right, as we will end up
-                    // with
-                    // a qname which does not have a namespace. At any rate we
-                    // should arrive at a QNameModule!
-                    namespace = namespaces.get(revision);
-                }
-
-                final QNameModule mod = QNameModule.create(namespace, revision).intern();
-                qname = QName.create(mod, name);
-            }
-        }
-        return qname;
-    }
-
-    @Override
-    public void exitType_stmt(final YangParser.Type_stmtContext ctx) {
-        final String typeName = stringFromNode(ctx);
-        if (UNION_STR.equals(typeName)) {
-            moduleBuilder.exitNode();
-        }
-        exitLog("type", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterGrouping_stmt(final YangParser.Grouping_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String groupName = stringFromNode(ctx);
-        enterLog("grouping", groupName, line);
-        final QName groupQName = QName.create(moduleQName, groupName);
-        final SchemaPath path = stack.addNodeToPath(groupQName);
-
-        final GroupingBuilder builder = moduleBuilder.addGrouping(ctx.getStart().getLine(), groupQName, path);
-        parseSchemaNodeArgs(ctx, builder);
-
-        moduleBuilder.enterNode(builder);
-    }
-
-    @Override
-    public void exitGrouping_stmt(final YangParser.Grouping_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("grouping", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterContainer_stmt(final Container_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String containerName = stringFromNode(ctx);
-        enterLog("container", containerName, line);
-
-        final QName containerQName = QName.create(moduleQName, containerName);
-        final SchemaPath path = stack.addNodeToPath(containerQName);
-
-        final ContainerSchemaNodeBuilder builder = moduleBuilder.addContainerNode(line, containerQName, path);
-        parseSchemaNodeArgs(ctx, builder);
-        parseConstraints(ctx, builder.getConstraints());
-        builder.setConfiguration(getConfig(ctx, builder, moduleName, line));
-
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            final ParseTree childNode = ctx.getChild(i);
-            if (childNode instanceof Presence_stmtContext) {
-                builder.setPresence(true);
-                break;
-            }
-        }
-
-        moduleBuilder.enterNode(builder);
-    }
-
-    @Override
-    public void exitContainer_stmt(final Container_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("container", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterLeaf_stmt(final Leaf_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String leafName = stringFromNode(ctx);
-        enterLog("leaf", leafName, line);
-
-        final QName leafQName = QName.create(moduleQName, leafName);
-        final SchemaPath path = stack.addNodeToPath(leafQName);
-
-        final LeafSchemaNodeBuilder builder = moduleBuilder.addLeafNode(line, leafQName, path);
-        parseSchemaNodeArgs(ctx, builder);
-        parseConstraints(ctx, builder.getConstraints());
-        builder.setConfiguration(getConfig(ctx, builder, moduleName, line));
-
-        String defaultStr = null;
-        String unitsStr = null;
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Default_stmtContext) {
-                defaultStr = stringFromNode(child);
-            } else if (child instanceof Units_stmtContext) {
-                unitsStr = stringFromNode(child);
-            }
-        }
-        builder.setDefaultStr(defaultStr);
-        builder.setUnits(unitsStr);
-
-        moduleBuilder.enterNode(builder);
-    }
-
-    @Override
-    public void exitLeaf_stmt(final YangParser.Leaf_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("leaf", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterUses_stmt(final YangParser.Uses_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String groupingPathStr = stringFromNode(ctx);
-        final SchemaPath groupingPath = parseXPathString(groupingPathStr, line);
-        enterLog("uses", groupingPathStr, line);
-
-        final UsesNodeBuilder builder = moduleBuilder.addUsesNode(line, groupingPath);
-
-        moduleBuilder.enterNode(builder);
-    }
-
-    @Override
-    public void exitUses_stmt(final YangParser.Uses_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("uses");
-    }
-
-    @Override
-    public void enterUses_augment_stmt(final YangParser.Uses_augment_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String augmentPath = stringFromNode(ctx);
-        enterLog(AUGMENT_STR, augmentPath, line);
-        stack.push();
-
-        final SchemaPath targetPath = parseXPathString(augmentPath, line);
-        final AugmentationSchemaBuilder builder = moduleBuilder.addAugment(line, augmentPath, targetPath,
-                augmentOrder++);
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Description_stmtContext) {
-                builder.setDescription(stringFromNode(child));
-            } else if (child instanceof Reference_stmtContext) {
-                builder.setReference(stringFromNode(child));
-            } else if (child instanceof Status_stmtContext) {
-                builder.setStatus(parseStatus((Status_stmtContext) child));
-            } else if (child instanceof When_stmtContext) {
-                builder.addWhenCondition(stringFromNode(child));
-            }
-        }
-
-        moduleBuilder.enterNode(builder);
-    }
-
-    @Override
-    public void exitUses_augment_stmt(final YangParser.Uses_augment_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog(AUGMENT_STR);
-        stack.pop();
-    }
-
-    @Override
-    public void enterRefine_stmt(final YangParser.Refine_stmtContext ctx) {
-        final String refineString = stringFromNode(ctx);
-        enterLog("refine", refineString, ctx.getStart().getLine());
-
-        final RefineHolderImpl refine = parseRefine(ctx, moduleName);
-        moduleBuilder.addRefine(refine);
-        moduleBuilder.enterNode(refine);
-    }
-
-    @Override
-    public void exitRefine_stmt(final YangParser.Refine_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("refine");
-    }
-
-    @Override
-    public void enterLeaf_list_stmt(final Leaf_list_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String leafListName = stringFromNode(ctx);
-        enterLog("leaf-list", leafListName, line);
-        final QName leafListQName = QName.create(moduleQName, leafListName);
-        final SchemaPath path = stack.addNodeToPath(leafListQName);
-
-        final LeafListSchemaNodeBuilder builder = moduleBuilder.addLeafListNode(line, leafListQName, path);
-        moduleBuilder.enterNode(builder);
-
-        parseSchemaNodeArgs(ctx, builder);
-        parseConstraints(ctx, builder.getConstraints());
-        builder.setConfiguration(getConfig(ctx, builder, moduleName, ctx.getStart().getLine()));
-
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            final ParseTree childNode = ctx.getChild(i);
-            if (childNode instanceof Ordered_by_stmtContext) {
-                final Ordered_by_stmtContext orderedBy = (Ordered_by_stmtContext) childNode;
-                final boolean userOrdered = parseUserOrdered(orderedBy);
-                builder.setUserOrdered(userOrdered);
-                break;
-            }
-        }
-    }
-
-    @Override
-    public void exitLeaf_list_stmt(final YangParser.Leaf_list_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("leaf-list", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterList_stmt(final List_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String listName = stringFromNode(ctx);
-        enterLog("list", listName, line);
-
-        final QName listQName = QName.create(moduleQName, listName);
-        final SchemaPath path = stack.addNodeToPath(listQName);
-
-        final ListSchemaNodeBuilder builder = moduleBuilder.addListNode(line, listQName, path);
-        moduleBuilder.enterNode(builder);
-
-        parseSchemaNodeArgs(ctx, builder);
-        parseConstraints(ctx, builder.getConstraints());
-        builder.setConfiguration(getConfig(ctx, builder, moduleName, line));
-
-        for (int i = 0; i < ctx.getChildCount(); ++i) {
-            final ParseTree childNode = ctx.getChild(i);
-            if (childNode instanceof Ordered_by_stmtContext) {
-                final Ordered_by_stmtContext orderedBy = (Ordered_by_stmtContext) childNode;
-                final boolean userOrdered = parseUserOrdered(orderedBy);
-                builder.setUserOrdered(userOrdered);
-            } else if (childNode instanceof Key_stmtContext) {
-                final Set<String> key = createListKey((Key_stmtContext) childNode);
-                builder.setKeys(key);
-            } else if (childNode instanceof YangParser.Identifier_stmtContext
-                    && UNION_STR.equals(childNode.getChild(0).toString())) {
-                throw new YangParseException(moduleName, line, "Union statement is not allowed inside a list statement");
-            }
-        }
-    }
-
-    @Override
-    public void exitList_stmt(final List_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("list", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterAnyxml_stmt(final YangParser.Anyxml_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String anyXmlName = stringFromNode(ctx);
-        enterLog("anyxml", anyXmlName, line);
-
-        final QName anyXmlQName = QName.create(moduleQName, anyXmlName);
-        final SchemaPath path = stack.addNodeToPath(anyXmlQName);
-
-        final AnyXmlBuilder builder = moduleBuilder.addAnyXml(line, anyXmlQName, path);
-        moduleBuilder.enterNode(builder);
-
-        parseSchemaNodeArgs(ctx, builder);
-        parseConstraints(ctx, builder.getConstraints());
-        builder.setConfiguration(getConfig(ctx, builder, moduleName, line));
-    }
-
-    @Override
-    public void exitAnyxml_stmt(final YangParser.Anyxml_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("anyxml", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterChoice_stmt(final YangParser.Choice_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String choiceName = stringFromNode(ctx);
-        enterLog("choice", choiceName, line);
-
-        final QName choiceQName = QName.create(moduleQName, choiceName);
-        final SchemaPath path = stack.addNodeToPath(choiceQName);
-
-        final ChoiceBuilder builder = moduleBuilder.addChoice(line, choiceQName, path);
-        moduleBuilder.enterNode(builder);
-
-        parseSchemaNodeArgs(ctx, builder);
-        parseConstraints(ctx, builder.getConstraints());
-        builder.setConfiguration(getConfig(ctx, builder, moduleName, line));
-
-        // set 'default' case
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Default_stmtContext) {
-                final String defaultCase = stringFromNode(child);
-                builder.setDefaultCase(defaultCase);
-                break;
-            }
-        }
-    }
-
-    @Override
-    public void exitChoice_stmt(final YangParser.Choice_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("choice", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterCase_stmt(final YangParser.Case_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String caseName = stringFromNode(ctx);
-        enterLog("case", caseName, line);
-
-        final QName caseQName = QName.create(moduleQName, caseName);
-        final SchemaPath path = stack.addNodeToPath(caseQName);
-
-        final ChoiceCaseBuilder builder = moduleBuilder.addCase(line, caseQName, path);
-        moduleBuilder.enterNode(builder);
-
-        parseSchemaNodeArgs(ctx, builder);
-        parseConstraints(ctx, builder.getConstraints());
-    }
-
-    @Override
-    public void exitCase_stmt(final YangParser.Case_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("case", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterNotification_stmt(final YangParser.Notification_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String notificationName = stringFromNode(ctx);
-        enterLog("notification", notificationName, line);
-
-        final QName notificationQName = QName.create(moduleQName, notificationName);
-        final SchemaPath path = stack.addNodeToPath(notificationQName);
-
-        final NotificationBuilder builder = moduleBuilder.addNotification(line, notificationQName, path);
-        moduleBuilder.enterNode(builder);
-
-        parseSchemaNodeArgs(ctx, builder);
-    }
-
-    @Override
-    public void exitNotification_stmt(final YangParser.Notification_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("notification", stack.removeNodeFromPath());
-    }
-
-    // Unknown nodes
-    @Override
-    public void enterIdentifier_stmt(final YangParser.Identifier_stmtContext ctx) {
-        handleUnknownNode(ctx.getStart().getLine(), ctx);
-    }
-
-    @Override
-    public void exitIdentifier_stmt(final YangParser.Identifier_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog(UNKNOWN_NODE_STR, stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterUnknown_statement(final YangParser.Unknown_statementContext ctx) {
-        handleUnknownNode(ctx.getStart().getLine(), ctx);
-    }
-
-    @Override
-    public void exitUnknown_statement(final YangParser.Unknown_statementContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog(UNKNOWN_NODE_STR, stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterRpc_stmt(final YangParser.Rpc_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String rpcName = stringFromNode(ctx);
-        enterLog("rpc", rpcName, line);
-
-        final QName rpcQName = QName.create(moduleQName, rpcName);
-        final SchemaPath path = stack.addNodeToPath(rpcQName);
-
-        final RpcDefinitionBuilder rpcBuilder = moduleBuilder.addRpc(line, rpcQName, path);
-        moduleBuilder.enterNode(rpcBuilder);
-
-        parseSchemaNodeArgs(ctx, rpcBuilder);
-    }
-
-    @Override
-    public void exitRpc_stmt(final YangParser.Rpc_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("rpc", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterInput_stmt(final YangParser.Input_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String input = "input";
-        enterLog(input, input, line);
-
-        final QName rpcQName = QName.create(moduleQName, input);
-        final SchemaPath path = stack.addNodeToPath(rpcQName);
-
-        final ContainerSchemaNodeBuilder builder = moduleBuilder.addRpcInput(line, rpcQName, path);
-        moduleBuilder.enterNode(builder);
-        builder.setConfiguration(true);
-
-        parseSchemaNodeArgs(ctx, builder);
-        parseConstraints(ctx, builder.getConstraints());
-    }
-
-    @Override
-    public void exitInput_stmt(final YangParser.Input_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("input", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterOutput_stmt(final YangParser.Output_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String output = "output";
-        enterLog(output, output, line);
-
-        final QName rpcQName = QName.create(moduleQName, output);
-        final SchemaPath path = stack.addNodeToPath(rpcQName);
-
-        final ContainerSchemaNodeBuilder builder = moduleBuilder.addRpcOutput(path, rpcQName, line);
-        moduleBuilder.enterNode(builder);
-        builder.setConfiguration(true);
-
-        parseSchemaNodeArgs(ctx, builder);
-        parseConstraints(ctx, builder.getConstraints());
-    }
-
-    @Override
-    public void exitOutput_stmt(final YangParser.Output_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("output", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterFeature_stmt(final YangParser.Feature_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String featureName = stringFromNode(ctx);
-        enterLog("feature", featureName, line);
-
-        final QName featureQName = QName.create(moduleQName, featureName);
-        final SchemaPath path = stack.addNodeToPath(featureQName);
-
-        final FeatureBuilder featureBuilder = moduleBuilder.addFeature(line, featureQName, path);
-        moduleBuilder.enterNode(featureBuilder);
-
-        parseSchemaNodeArgs(ctx, featureBuilder);
-    }
-
-    @Override
-    public void exitFeature_stmt(final YangParser.Feature_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("feature", stack.removeNodeFromPath());
-    }
-
-    @Override
-    public void enterDeviation_stmt(final YangParser.Deviation_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String targetPathStr = stringFromNode(ctx);
-        if (!targetPathStr.startsWith("/")) {
-            throw new YangParseException(moduleName, line,
-                    "Deviation argument string must be an absolute schema node identifier.");
-        }
-        enterLog("deviation", targetPathStr, line);
-
-        String reference = null;
-        String deviate = null;
-
-        final SchemaPath targetPath = parseXPathString(targetPathStr, line);
-        final DeviationBuilder builder = moduleBuilder.addDeviation(line, targetPath);
-        moduleBuilder.enterNode(builder);
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Reference_stmtContext) {
-                reference = stringFromNode(child);
-            } else if (child instanceof Deviate_not_supported_stmtContext) {
-                deviate = stringFromNode(child);
-            } else if (child instanceof Deviate_add_stmtContext) {
-                deviate = stringFromNode(child);
-            } else if (child instanceof Deviate_replace_stmtContext) {
-                deviate = stringFromNode(child);
-            } else if (child instanceof Deviate_delete_stmtContext) {
-                deviate = stringFromNode(child);
-            }
-        }
-        builder.setReference(reference);
-        builder.setDeviate(deviate);
-    }
-
-    public SchemaPath parseXPathString(final String xpathString, final int line) {
-        final boolean absolute = !xpathString.isEmpty() && xpathString.charAt(0) == '/';
-
-        final List<QName> path = new ArrayList<>();
-        for (final String pathElement : SLASH_SPLITTER.split(xpathString)) {
-            final Iterator<String> it = COLON_SPLITTER.split(pathElement).iterator();
-            final String s = it.next();
-            if (it.hasNext()) {
-                path.add(parseQName(pathElement, line));
-            } else {
-                path.add(QName.create(moduleQName, s));
-            }
-        }
-        return SchemaPath.create(path, absolute);
-    }
-
-    @Override
-    public void exitDeviation_stmt(final YangParser.Deviation_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("deviation");
-    }
-
-    @Override
-    public void enterIdentity_stmt(final YangParser.Identity_stmtContext ctx) {
-        final int line = ctx.getStart().getLine();
-        final String identityName = stringFromNode(ctx);
-        enterLog("identity", identityName, line);
-
-        final QName identityQName = QName.create(moduleQName, identityName);
-        final SchemaPath path = stack.addNodeToPath(identityQName);
-
-        final IdentitySchemaNodeBuilder builder = moduleBuilder.addIdentity(identityQName, line, path);
-        moduleBuilder.enterNode(builder);
-
-        parseSchemaNodeArgs(ctx, builder);
-
-        for (int i = 0; i < ctx.getChildCount(); i++) {
-            final ParseTree child = ctx.getChild(i);
-            if (child instanceof Base_stmtContext) {
-                final String baseIdentityName = stringFromNode(child);
-                builder.setBaseIdentityName(baseIdentityName);
-            }
-        }
-    }
-
-    @Override
-    public void exitIdentity_stmt(final YangParser.Identity_stmtContext ctx) {
-        moduleBuilder.exitNode();
-        exitLog("identity", stack.removeNodeFromPath());
-    }
-
-    public ModuleBuilder getModuleBuilder() {
-        return moduleBuilder;
-    }
-
-    private static void enterLog(final String p1, final String p2, final int line) {
-        LOG.trace("entering {} {} ({})", p1, p2, line);
-    }
-
-    private static void exitLog(final String p1) {
-        LOG.trace("exiting {}", p1);
-    }
-
-    private static void exitLog(final String p1, final QName p2) {
-        LOG.trace("exiting {} {}", p1, p2.getLocalName());
-    }
-
-    private static void setLog(final String p1, final String p2) {
-        LOG.trace("setting {} {}", p1, p2);
-    }
-
-    private void handleUnknownNode(final int line, final ParseTree ctx) {
-        final String nodeParameter = stringFromNode(ctx);
-        enterLog(UNKNOWN_NODE_STR, nodeParameter, line);
-
-        final String nodeTypeStr = ctx.getChild(0).getText();
-        final QName nodeType = parseQName(nodeTypeStr, line);
-
-        QName qname = null;
-        try {
-            // FIXME: rewrite whole method to handle unknown nodes properly.
-            // This should be bugfix for bug
-            // https://bugs.opendaylight.org/show_bug.cgi?id=1539
-            // After this fix bug
-            // https://bugs.opendaylight.org/show_bug.cgi?id=1538 MUST be fixed
-            // since
-            // they are dependent!!!
-            if (Strings.isNullOrEmpty(nodeParameter)) {
-                qname = nodeType;
-            } else {
-                final Iterable<String> splittedName = COLON_SPLITTER.split(nodeParameter);
-                final Iterator<String> it = splittedName.iterator();
-                if (Iterables.size(splittedName) == 2) {
-                    qname = parseQName(nodeParameter, line);
-                } else {
-                    qname = QName.create(moduleQName, it.next());
-                }
-            }
-        } catch (IllegalArgumentException | YangParseException ex) {
-            qname = nodeType;
-        }
-
-        final SchemaPath path = stack.addNodeToPath(qname);
-
-        final UnknownSchemaNodeBuilderImpl builder = moduleBuilder.addUnknownSchemaNode(line, qname, path);
-        builder.setNodeType(nodeType);
-        builder.setNodeParameter(nodeParameter);
-
-        parseSchemaNodeArgs(ctx, builder);
-        moduleBuilder.enterNode(builder);
-    }
-
-}
index e92fb61edf292edb66cba5f65667080508920740..bb7348c2fafd392441be88fd70546283df4a2bf0 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.yangtools.yang.parser.impl.util;
 
-import static org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils.getArgumentString;
-
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
@@ -20,14 +18,6 @@ import java.util.List;
 import java.util.Objects;
 import java.util.Set;
 import org.antlr.v4.runtime.ParserRuleContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Belongs_to_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Import_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Include_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_date_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_stmtContext;
 import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser;
 import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser.StatementContext;
 import org.opendaylight.yangtools.concepts.SemVer;
@@ -36,7 +26,6 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.ParserListenerUtils;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.SupportedExtensionsMapping;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
@@ -198,18 +187,6 @@ public abstract class YangModelDependencyInfo {
             return parseAST(rootStatement);
         }
 
-        final Optional<Module_stmtContext> moduleCtx = ParserListenerUtils
-                .getFirstContext(tree, Module_stmtContext.class);
-        if (moduleCtx.isPresent()) {
-            return parseModuleContext(moduleCtx.get());
-        }
-
-        final Optional<Submodule_stmtContext> submoduleCtx = ParserListenerUtils
-                .getFirstContext(tree, Submodule_stmtContext.class);
-        if (submoduleCtx.isPresent()) {
-            return parseSubmoduleContext(submoduleCtx.get());
-        }
-
         throw new YangSyntaxErrorException(name, 0, 0, "Unknown YANG text type");
     }
 
@@ -252,18 +229,6 @@ public abstract class YangModelDependencyInfo {
         return parseAST(yangAST);
     }
 
-    private static YangModelDependencyInfo parseModuleContext(
-            final Module_stmtContext module) {
-        final String name = getArgumentString(module);
-        final String latestRevision = getLatestRevision(module.revision_stmts());
-        final ImmutableSet<ModuleImport> imports = parseImports(module
-                .linkage_stmts().import_stmt());
-        final ImmutableSet<ModuleImport> includes = parseIncludes(module
-                .linkage_stmts().include_stmt());
-
-        return new ModuleDependencyInfo(name, latestRevision, imports, includes);
-    }
-
     private static YangModelDependencyInfo parseModuleContext(
             final YangStatementParser.StatementContext module) {
         final String name = Utils.stringFromStringContext(module.argument());
@@ -339,8 +304,7 @@ public abstract class YangModelDependencyInfo {
     }
 
     private static String getRevisionDateString(final StatementContext importStatement) {
-        final List<StatementContext> importSubStatements = importStatement
-                .statement();
+        final List<StatementContext> importSubStatements = importStatement.statement();
         String revisionDateStr = null;
         for (final StatementContext importSubStatement : importSubStatements) {
             if (importSubStatement
@@ -355,17 +319,6 @@ public abstract class YangModelDependencyInfo {
         return revisionDateStr;
     }
 
-    private static ImmutableSet<ModuleImport> parseImports(
-            final List<Import_stmtContext> importStatements) {
-        final ImmutableSet.Builder<ModuleImport> builder = ImmutableSet.builder();
-        for (final Import_stmtContext importStmt : importStatements) {
-            final String moduleName = getArgumentString(importStmt);
-            final Date revision = getRevision(importStmt.revision_date_stmt());
-            builder.add(new ModuleImportImpl(moduleName, revision));
-        }
-        return builder.build();
-    }
-
     public static String getLatestRevision(
             final YangStatementParser.StatementContext module) {
         final List<StatementContext> subStatements = module.statement();
@@ -387,21 +340,6 @@ public abstract class YangModelDependencyInfo {
         return latestRevision;
     }
 
-    public static String getLatestRevision(
-            final Revision_stmtsContext revisionStmts) {
-        final List<Revision_stmtContext> revisions = revisionStmts
-                .getRuleContexts(Revision_stmtContext.class);
-        String latestRevision = null;
-        for (final Revision_stmtContext revisionStmt : revisions) {
-            final String currentRevision = getArgumentString(revisionStmt);
-            if (latestRevision == null
-                    || latestRevision.compareTo(currentRevision) == -1) {
-                latestRevision = currentRevision;
-            }
-        }
-        return latestRevision;
-    }
-
     private static YangModelDependencyInfo parseSubmoduleContext(
             final YangStatementParser.StatementContext submodule) {
         final String name = Utils.stringFromStringContext(submodule.argument());
@@ -430,43 +368,6 @@ public abstract class YangModelDependencyInfo {
         return null;
     }
 
-    private static YangModelDependencyInfo parseSubmoduleContext(
-            final Submodule_stmtContext submodule) {
-        final String name = getArgumentString(submodule);
-        final Belongs_to_stmtContext belongsToStmt = submodule
-                .submodule_header_stmts().belongs_to_stmt(0);
-        final String belongsTo = getArgumentString(belongsToStmt);
-
-        final String latestRevision = getLatestRevision(submodule.revision_stmts());
-        final ImmutableSet<ModuleImport> imports = parseImports(submodule
-                .linkage_stmts().import_stmt());
-        final ImmutableSet<ModuleImport> includes = parseIncludes(submodule
-                .linkage_stmts().include_stmt());
-
-        return new SubmoduleDependencyInfo(name, latestRevision, belongsTo,
-                imports, includes);
-    }
-
-    private static ImmutableSet<ModuleImport> parseIncludes(
-            final List<Include_stmtContext> importStatements) {
-        final ImmutableSet.Builder<ModuleImport> builder = ImmutableSet.builder();
-        for (final Include_stmtContext importStmt : importStatements) {
-            final String moduleName = getArgumentString(importStmt);
-            final Date revision = getRevision(importStmt.revision_date_stmt());
-            builder.add(new ModuleImportImpl(moduleName, revision));
-        }
-        return builder.build();
-    }
-
-    private static Date getRevision(
-            final Revision_date_stmtContext revisionDateStmt) {
-        if (revisionDateStmt == null) {
-            return null;
-        }
-        final String formatedDate = getArgumentString(revisionDateStmt);
-        return QName.parseRevision(formatedDate);
-    }
-
     /**
      *
      * Dependency information for YANG module.
index fc5c51bb5fdba13953b6a549bb65a85b11cc21bb..b1076a2d03712e9e0a1b635a2da7a4b660a137ec 100644 (file)
@@ -11,6 +11,7 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.HashSet;
 import java.util.Objects;
 import java.util.Set;
@@ -27,13 +28,20 @@ import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceStatement;
-import org.opendaylight.yangtools.yang.parser.builder.util.Comparators;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 public final class ChoiceEffectiveStatementImpl extends AbstractEffectiveDataSchemaNode<ChoiceStatement> implements
         ChoiceSchemaNode, DerivableSchemaNode {
+    /**
+     * Comparator based on alphabetical order of local name of SchemaNode's
+     * qname.
+     */
+    private static final Comparator<SchemaNode> SCHEMA_NODE_COMP = (o1, o2) -> {
+        return o1.getQName().compareTo(o2.getQName());
+    };
 
     private final ChoiceSchemaNode original;
     private final String defaultCase;
@@ -52,7 +60,7 @@ public final class ChoiceEffectiveStatementImpl extends AbstractEffectiveDataSch
         // initSubstatementCollectionsAndFields
         Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
         Set<AugmentationSchema> augmentationsInit = new HashSet<>();
-        SortedSet<ChoiceCaseNode> casesInit = new TreeSet<>(Comparators.SCHEMA_NODE_COMP);
+        SortedSet<ChoiceCaseNode> casesInit = new TreeSet<>(SCHEMA_NODE_COMP);
 
         for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
             if (effectiveStatement instanceof AugmentationSchema) {
index b74b9fcf696e8560c7f4329084f5411f207fdd79..6c6afb12c8e9b9473d9cc728b017baa3987ee014 100644 (file)
@@ -7,15 +7,14 @@
  */
 package org.opendaylight.yangtools.yang.parser.util;
 
-import static java.util.Arrays.asList;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Function;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import java.net.URI;
+import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -25,16 +24,14 @@ import java.util.Set;
 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder;
 import org.opendaylight.yangtools.yang.parser.util.TopologicalSort.Node;
 import org.opendaylight.yangtools.yang.parser.util.TopologicalSort.NodeImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Creates a module dependency graph from provided {@link ModuleBuilder}s and
- * provides a {@link #sort(ModuleBuilder...)} method. It is topological sort and
+ * Creates a module dependency graph from provided {@link Module}s and
+ * provides a {@link #sort(Module...)} method. It is topological sort and
  * returns modules in order in which they should be processed (e.g. if A imports
  * B, sort returns {B, A}).
  */
@@ -42,15 +39,11 @@ public final class ModuleDependencySort {
 
     private static final Date DEFAULT_REVISION = SimpleDateFormatUtil.DEFAULT_DATE_REV;
     private static final Logger LOGGER = LoggerFactory.getLogger(ModuleDependencySort.class);
-    private static final Function<Node, Module> TOPOLOGY_FUNCTION = new Function<TopologicalSort.Node, Module>() {
-        @Override
-        public Module apply(final TopologicalSort.Node input) {
-            if (input == null) {
-                return null;
-            }
-            ModuleOrModuleBuilder moduleOrModuleBuilder = ((ModuleNodeImpl) input).getReference();
-            return moduleOrModuleBuilder.getModule();
+    private static final Function<Node, Module> TOPOLOGY_FUNCTION = input -> {
+        if (input == null) {
+            return null;
         }
+        return ((ModuleNodeImpl) input).getReference();
     };
 
     /**
@@ -59,67 +52,6 @@ public final class ModuleDependencySort {
     private ModuleDependencySort() {
     }
 
-
-    /**
-     * Extracts {@link ModuleBuilder} from a {@link ModuleNodeImpl}.
-     */
-    private static final Function<TopologicalSort.Node, ModuleBuilder> NODE_TO_MODULEBUILDER = new Function<TopologicalSort.Node, ModuleBuilder>() {
-        @Override
-        public ModuleBuilder apply(final TopologicalSort.Node input) {
-            // Cast to ModuleBuilder from Node and return
-            if (input == null) {
-                return null;
-            }
-            ModuleOrModuleBuilder moduleOrModuleBuilder = ((ModuleNodeImpl) input).getReference();
-            return moduleOrModuleBuilder.getModuleBuilder();
-        }
-    };
-
-    /**
-     * Topological sort of module builder dependency graph.
-     *
-     * @param builders builders of Module object
-     * @return Sorted list of Module builders. Modules can be further processed
-     *         in returned order.
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    public static List<ModuleBuilder> sort(final ModuleBuilder... builders) {
-        return sort(asList(builders));
-    }
-
-    /**
-     * @deprecated Pre-Beryllium implementation, scheduled for removal.
-     */
-    @Deprecated
-    public static List<ModuleBuilder> sort(final Collection<ModuleBuilder> builders) {
-        List<TopologicalSort.Node> sorted = sortInternal(ModuleOrModuleBuilder.fromAll(
-                Collections.emptySet(),builders));
-        return Lists.transform(sorted, NODE_TO_MODULEBUILDER);
-    }
-
-    public static List<ModuleBuilder> sortWithContext(final SchemaContext context, final ModuleBuilder... builders) {
-        List<ModuleOrModuleBuilder> all = ModuleOrModuleBuilder.fromAll(context.getModules(), asList(builders));
-
-        List<TopologicalSort.Node> sorted = sortInternal(all);
-        // Cast to ModuleBuilder from Node if possible and return
-        return Lists.transform(sorted, new Function<TopologicalSort.Node, ModuleBuilder>() {
-
-            @Override
-            public ModuleBuilder apply(final TopologicalSort.Node input) {
-                if (input == null) {
-                    return null;
-                }
-                ModuleOrModuleBuilder moduleOrModuleBuilder = ((ModuleNodeImpl) input).getReference();
-                if (moduleOrModuleBuilder.isModuleBuilder()) {
-                    return moduleOrModuleBuilder.getModuleBuilder();
-                } else {
-                    return null;
-                }
-            }
-        });
-    }
-
     /**
      * Topological sort of module dependency graph.
      *
@@ -128,13 +60,12 @@ public final class ModuleDependencySort {
      *         returned order.
      */
     public static List<Module> sort(final Module... modules) {
-        List<TopologicalSort.Node> sorted = sortInternal(ModuleOrModuleBuilder.fromAll(asList(modules),
-                Collections.emptyList()));
+        List<TopologicalSort.Node> sorted = sortInternal(Arrays.asList(modules));
         // Cast to Module from Node and return
         return Lists.transform(sorted, TOPOLOGY_FUNCTION);
     }
 
-    private static List<TopologicalSort.Node> sortInternal(final Iterable<ModuleOrModuleBuilder> modules) {
+    private static List<TopologicalSort.Node> sortInternal(final Iterable<Module> modules) {
         Map<String, Map<Date, ModuleNodeImpl>> moduleGraph = createModuleGraph(modules);
 
         Set<TopologicalSort.Node> nodes = Sets.newHashSet();
@@ -148,7 +79,7 @@ public final class ModuleDependencySort {
     }
 
     @VisibleForTesting
-    static Map<String, Map<Date, ModuleNodeImpl>> createModuleGraph(final Iterable<ModuleOrModuleBuilder> builders) {
+    static Map<String, Map<Date, ModuleNodeImpl>> createModuleGraph(final Iterable<Module> builders) {
         Map<String, Map<Date, ModuleNodeImpl>> moduleGraph = Maps.newHashMap();
 
         processModules(moduleGraph, builders);
@@ -161,11 +92,11 @@ public final class ModuleDependencySort {
      * Extract module:revision from module builders
      */
     private static void processDependencies(final Map<String, Map<Date, ModuleNodeImpl>> moduleGraph,
-            final Iterable<ModuleOrModuleBuilder> mmbs) {
-        Map<URI, ModuleOrModuleBuilder> allNS = new HashMap<>();
+            final Iterable<Module> mmbs) {
+        Map<URI, Module> allNS = new HashMap<>();
 
         // Create edges in graph
-        for (ModuleOrModuleBuilder mmb : mmbs) {
+        for (Module module : mmbs) {
             Map<String, Date> imported = Maps.newHashMap();
 
             String fromName;
@@ -173,39 +104,23 @@ public final class ModuleDependencySort {
             Collection<ModuleImport> imports;
             URI ns;
 
-            if (mmb.isModule()) {
-                Module module = mmb.getModule();
-                fromName = module.getName();
-                fromRevision = module.getRevision();
-                imports = module.getImports();
-                ns = module.getNamespace();
-            } else {
-                ModuleBuilder moduleBuilder = mmb.getModuleBuilder();
-                fromName = moduleBuilder.getName();
-                fromRevision = moduleBuilder.getRevision();
-                imports = moduleBuilder.getImports().values();
-                ns = moduleBuilder.getNamespace();
-            }
+            fromName = module.getName();
+            fromRevision = module.getRevision();
+            imports = module.getImports();
+            ns = module.getNamespace();
 
             // check for existence of module with same namespace
             if (allNS.containsKey(ns)) {
-                ModuleOrModuleBuilder mod = allNS.get(ns);
-                String name = null;
-                Date revision = null;
-                if (mod.isModule()) {
-                    name = mod.getModule().getName();
-                    revision = mod.getModule().getRevision();
-                } else if (mod.isModuleBuilder()) {
-                    name = mod.getModuleBuilder().getName();
-                    revision = mod.getModuleBuilder().getRevision();
-                }
+                Module mod = allNS.get(ns);
+                String name = mod.getName();
+                Date revision = mod.getRevision();
                 if (!(fromName.equals(name))) {
                     LOGGER.warn(
                             "Error while sorting module [{}, {}]: module with same namespace ({}) already loaded: [{}, {}]",
                             fromName, fromRevision, ns, name, revision);
                 }
             } else {
-                allNS.put(ns, mmb);
+                allNS.put(ns, module);
             }
 
             // no need to check if other Type of object, check is performed in
@@ -279,22 +194,13 @@ public final class ModuleDependencySort {
      * graph
      */
     private static void processModules(final Map<String, Map<Date, ModuleNodeImpl>> moduleGraph,
-            final Iterable<ModuleOrModuleBuilder> builders) {
+            final Iterable<Module> modules) {
 
         // Process nodes
-        for (ModuleOrModuleBuilder momb : builders) {
-
-            String name;
-            Date rev;
-
-            if (momb.isModule()) {
-                name = momb.getModule().getName();
-                rev = momb.getModule().getRevision();
-            } else {
-                name = momb.getModuleBuilder().getName();
-                rev = momb.getModuleBuilder().getRevision();
-            }
+        for (Module momb : modules) {
 
+            String name = momb.getName();
+            Date rev = momb.getRevision();
             if (rev == null) {
                 rev = DEFAULT_REVISION;
             }
@@ -319,12 +225,12 @@ public final class ModuleDependencySort {
     static class ModuleNodeImpl extends NodeImpl {
         private final String name;
         private final Date revision;
-        private final ModuleOrModuleBuilder originalObject;
+        private final Module originalObject;
 
-        public ModuleNodeImpl(final String name, final Date revision, final ModuleOrModuleBuilder builder) {
+        public ModuleNodeImpl(final String name, final Date revision, final Module module) {
             this.name = name;
             this.revision = revision;
-            this.originalObject = builder;
+            this.originalObject = module;
         }
 
         public String getName() {
@@ -378,7 +284,7 @@ public final class ModuleDependencySort {
             return "Module [name=" + name + ", revision=" + formatRevDate(revision) + "]";
         }
 
-        public ModuleOrModuleBuilder getReference() {
+        public Module getReference() {
             return originalObject;
         }
 
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ModuleOrModuleBuilder.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ModuleOrModuleBuilder.java
deleted file mode 100644 (file)
index 3083dad..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2013 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.util;
-
-import com.google.common.base.Optional;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- *
- * This class needs to be removed and its sole user, {@link ModuleDependencySort}, use Module instances only.
- */
-@Deprecated
-class ModuleOrModuleBuilder {
-    private final Optional<Module> maybeModule;
-    private final Optional<ModuleBuilder> maybeModuleBuilder;
-
-    ModuleOrModuleBuilder(final Module module) {
-        maybeModule = Optional.of(module);
-        maybeModuleBuilder = Optional.absent();
-    }
-
-    ModuleOrModuleBuilder(final ModuleBuilder moduleBuilder) {
-        maybeModule = Optional.absent();
-        maybeModuleBuilder = Optional.of(moduleBuilder);
-    }
-    boolean isModule(){
-        return maybeModule.isPresent();
-    }
-    boolean isModuleBuilder(){
-        return maybeModuleBuilder.isPresent();
-    }
-    Module getModule(){
-        return maybeModule.get();
-    }
-    ModuleBuilder getModuleBuilder(){
-        return maybeModuleBuilder.get();
-    }
-
-    static List<ModuleOrModuleBuilder> fromAll(final Collection<Module> modules, final Collection<ModuleBuilder> moduleBuilders) {
-        List<ModuleOrModuleBuilder> result = new ArrayList<>(modules.size() + moduleBuilders.size());
-        for (Module m: modules){
-            result.add(new ModuleOrModuleBuilder(m));
-        }
-        for (ModuleBuilder mb : moduleBuilders) {
-            result.add(new ModuleOrModuleBuilder(mb));
-        }
-        return result;
-    }
-}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationListTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationListTest.java
deleted file mode 100644 (file)
index 8e6013b..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2016 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.stmt;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Default_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Key_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Leaf_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.List_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Mandatory_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Ordered_by_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Type_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Unique_stmtContext;
-import org.opendaylight.yangtools.yang.parser.impl.YangModelBasicValidationListener;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-public class YangModelValidationListTest {
-
-    private YangModelBasicValidationListener valid;
-
-    @Before
-    public void setUp() {
-        valid = new YangModelBasicValidationListener();
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testKeyValidationDuplicates() {
-
-        List_stmtContext list = YangModelValidationTest.mockStatement(
-                List_stmtContext.class, "list");
-        Key_stmtContext key = YangModelValidationTest.mockStatement(
-                Key_stmtContext.class, "leaf1 leaf2 leaf1 leaf1");
-        YangModelValidationTest.addChild(list, key);
-
-        try {
-            valid.enterKey_stmt(key);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(),
-                    containsString("contains duplicates:[leaf1]"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testUniqueValidationDuplicates() {
-        List_stmtContext list =YangModelValidationTest.mockStatement(
-                List_stmtContext.class, "list");
-        Unique_stmtContext unique = YangModelValidationTest.mockStatement(
-                Unique_stmtContext.class, "leaf1/a leaf2/n leaf1/a leaf1");
-        YangModelValidationTest.addChild(list, unique);
-
-        try {
-            valid.enterUnique_stmt(unique);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(),
-                    containsString("contains duplicates:[leaf1/a]"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testOrderBy() {
-        Ordered_by_argContext ctx = YangModelValidationTest.mockStatement(
-                Ordered_by_argContext.class, "unknown");
-
-        try {
-            valid.enterOrdered_by_arg(ctx);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Ordered-by:unknown, illegal value for Ordered-by statement, only permitted:"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testLeaf() {
-        Leaf_stmtContext ctx = YangModelValidationTest.mockStatement(
-                Leaf_stmtContext.class, "leaf1");
-        Default_stmtContext def = YangModelValidationTest.mockStatement(
-                Default_stmtContext.class, "default");
-        YangModelValidationTest.addChild(ctx, def);
-        Type_stmtContext typ = YangModelValidationTest.mockStatement(
-                Type_stmtContext.class, "type");
-        YangModelValidationTest.addChild(ctx, def);
-        YangModelValidationTest.addChild(ctx, typ);
-
-        Mandatory_stmtContext mand = YangModelValidationTest.mockStatement(
-                Mandatory_stmtContext.class, null);
-        YangModelValidationTest.addChild(ctx, mand);
-
-        try {
-            valid.enterLeaf_stmt(ctx);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Both Mandatory and Default statement present"));
-            throw e;
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationModuleTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationModuleTest.java
deleted file mode 100644 (file)
index 8818e15..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 2016 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.stmt;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_header_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Namespace_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Yang_version_stmtContext;
-import org.opendaylight.yangtools.yang.parser.impl.YangModelBasicValidationListener;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-public class YangModelValidationModuleTest {
-
-    private YangModelBasicValidationListener valid;
-
-    @Before
-    public void setUp() {
-        valid = new YangModelBasicValidationListener();
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testRevisionInvalidDateFormat() {
-        Revision_stmtContext mockedRev = mockModuleWithRevision("badFormat",
-                "module1");
-
-        try {
-            valid.enterRevision_stmt(mockedRev);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Revision:badFormat, invalid date format expected date format is:"));
-            throw e;
-        }
-    }
-
-    @Test
-    public void testRevisionValidDateFormat() {
-        Revision_stmtContext mockedRev = mockModuleWithRevision(
-                YangModelValidationTest.getFormattedDate(), "module1");
-
-        valid.enterRevision_stmt(mockedRev);
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoHeaderStmts() {
-        Revision_stmtContext rev = mockModuleWithRevision("1999-4-5", "module1");
-
-        try {
-            valid.enterModule_stmt((Module_stmtContext) rev.getParent()
-                    .getParent());
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Module-header statement in Module:module1"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testMultipleModulesPerSession() {
-        Module_stmtContext module1 = (Module_stmtContext) mockModuleWithRevision(
-                "1999-09-10", "m1").getParent().getParent();
-        YangModelValidationTest.addChild(module1, YangModelValidationTest
-                .mockStatement(Namespace_stmtContext.class, ""));
-
-        Module_stmtContext module2 = (Module_stmtContext) mockModuleWithRevision(
-                "1999-09-10", "m2").getParent().getParent();
-        YangModelValidationTest.addChild(module1, YangModelValidationTest
-                .mockStatement(Namespace_stmtContext.class, ""));
-        valid.enterModule_stmt(module1);
-
-        try {
-            valid.enterModule_stmt(module2);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(),
-                    containsString("Multiple (sub)modules per file"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoNamespace() {
-        Module_header_stmtsContext header = YangModelValidationTest
-                .mockStatement(Module_header_stmtsContext.class, null);
-        Module_stmtContext mod = YangModelValidationTest.mockStatement(
-                Module_stmtContext.class, "module1");
-        YangModelValidationTest.addChild(mod, header);
-
-        try {
-            valid.enterModule_header_stmts(header);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Namespace statement in Module-header:"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoPrefix() {
-        Module_header_stmtsContext header = YangModelValidationTest
-                .mockStatement(Module_header_stmtsContext.class, null);
-        Namespace_stmtContext nmspc = YangModelValidationTest.mockStatement(
-                Namespace_stmtContext.class, "http://test");
-        Module_stmtContext mod = YangModelValidationTest.mockStatement(
-                Module_stmtContext.class, "module1");
-        YangModelValidationTest.addChild(mod, header);
-        YangModelValidationTest.addChild(header, nmspc);
-
-        try {
-            valid.enterModule_header_stmts(header);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Prefix statement in Module-header:"));
-            throw e;
-        }
-    }
-
-//    @Test(expected = YangValidationException.class)
-//    public void testInvalidYangVersion() {
-//
-//        Yang_version_stmtContext yangVersion = YangModelValidationTest
-//                .mockStatement(Yang_version_stmtContext.class, "55Unsup");
-//
-//        Module_stmtContext mod = YangModelValidationTest.mockStatement(
-//                Module_stmtContext.class, "module1");
-//        YangModelValidationTest.addChild(mod, yangVersion);
-//
-//        try {
-//            valid.enterYang_version_stmt(yangVersion);
-//        } catch (YangValidationException e) {
-//            assertThat(
-//                    e.getMessage(),
-//                    containsString("Unsupported yang version:55Unsup, supported version:"
-//                            + BasicValidations.SUPPORTED_YANG_VERSION));
-//            throw e;
-//        }
-//    }
-
-    @Test
-    public void testValidYangVersion() {
-
-        Yang_version_stmtContext ctx = mock(Yang_version_stmtContext.class);
-        doReturn(1).when(ctx).getChildCount();
-        YangModelValidationTest.mockName(ctx, "1");
-
-        valid.enterYang_version_stmt(ctx);
-    }
-
-    private static Revision_stmtContext mockModuleWithRevision(final String date,
-            final String moduleName) {
-        Revision_stmtContext mockedRev = YangModelValidationTest.mockStatement(
-                Revision_stmtContext.class, date);
-        Revision_stmtsContext revs = YangModelValidationTest.mockStatement(
-                Revision_stmtsContext.class, null);
-        Module_stmtContext mod = YangModelValidationTest.mockStatement(
-                Module_stmtContext.class, moduleName);
-
-        YangModelValidationTest.addChild(revs, mockedRev);
-        YangModelValidationTest.addChild(mod, revs);
-        return mockedRev;
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationSubModuleTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationSubModuleTest.java
deleted file mode 100644 (file)
index 51e592a..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2016 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.stmt;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Belongs_to_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_header_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_stmtContext;
-import org.opendaylight.yangtools.yang.parser.impl.YangModelBasicValidationListener;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-public class YangModelValidationSubModuleTest {
-
-    private YangModelBasicValidationListener valid;
-
-    @Before
-    public void setUp() {
-        valid = new YangModelBasicValidationListener();
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoRevision() {
-
-        Submodule_stmtContext ctx = YangModelValidationTest.mockStatement(
-                Submodule_stmtContext.class, "submodule1");
-
-        try {
-            valid.enterSubmodule_stmt(ctx);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Submodule-header statement in Submodule:submodule"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoBelongsTo() {
-        Submodule_header_stmtsContext header = mock(Submodule_header_stmtsContext.class);
-        mockSubmoduleParent(header, "submodule");
-
-        try {
-            valid.enterSubmodule_header_stmts(header);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Belongs-to statement in Submodule-header:"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testBelongsToNoPrefix() {
-        Belongs_to_stmtContext belongsTo = YangModelValidationTest
-                .mockStatement(Belongs_to_stmtContext.class, "supermodule");
-
-        mockSubmoduleParent(belongsTo, "submodule");
-
-        try {
-            valid.enterBelongs_to_stmt(belongsTo);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Prefix statement in Belongs-to:supermodule"));
-            throw e;
-        }
-    }
-
-    private static Submodule_stmtContext mockSubmoduleParent(final ParseTree child,
-            final String moduleName) {
-        Submodule_stmtContext ctx = YangModelValidationTest.mockStatement(
-                Submodule_stmtContext.class, moduleName);
-        YangModelValidationTest.addChild(ctx, child);
-        return ctx;
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationTest.java
deleted file mode 100644 (file)
index 33b89be..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 2016 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.stmt;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import java.text.SimpleDateFormat;
-import java.util.Collections;
-import java.util.Date;
-import org.antlr.v4.runtime.Token;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Augment_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Import_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Include_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Namespace_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Prefix_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_date_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Status_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.StringContext;
-import org.opendaylight.yangtools.yang.parser.impl.YangModelBasicValidationListener;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-public class YangModelValidationTest {
-
-    private YangModelBasicValidationListener valid;
-
-    @Before
-    public void setUp() {
-
-        valid = new YangModelBasicValidationListener();
-    }
-
-    @Test
-    public void testPrefixes() {
-        Prefix_stmtContext pref = mockStatement(Prefix_stmtContext.class, "unique1");
-        Module_stmtContext module = mockStatement(Module_stmtContext.class, "module1");
-        addChild(module, pref);
-
-        valid.enterPrefix_stmt(pref);
-
-        pref = mockStatement(Prefix_stmtContext.class, "unique1");
-        module = mockStatement(Module_stmtContext.class, "module1");
-        addChild(module, pref);
-
-        try {
-            valid.enterPrefix_stmt(pref);
-        } catch (Exception e) {
-            return;
-        }
-
-        fail("Validation Exception should have occured");
-    }
-
-    @Test
-    public void testNamespace() {
-
-        Namespace_stmtContext namespace = mockStatement(Namespace_stmtContext.class, "http://test.parsing.uri.com");
-        Module_stmtContext module = mockStatement(Module_stmtContext.class, "module1");
-        addChild(module, namespace);
-
-        valid.enterNamespace_stmt(namespace);
-
-        namespace = mockStatement(Namespace_stmtContext.class, "invalid uri");
-        module = mockStatement(Module_stmtContext.class, "module1");
-        addChild(module, namespace);
-
-        try {
-            valid.enterNamespace_stmt(namespace);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(), containsString("Namespace:invalid uri cannot be parsed as URI"));
-            return;
-        }
-
-        fail("Validation Exception should have occured");
-    }
-
-    @Test
-    public void testImports() {
-        Import_stmtContext impor = mockImport("unique1", "p1");
-        Module_stmtContext mod = mockStatement(Module_stmtContext.class, "module1");
-        addChild(mod, impor);
-
-        valid.enterImport_stmt(impor);
-
-        impor = mockImport("unique1", "p2");
-        mod = mockStatement(Module_stmtContext.class, "module1");
-        addChild(mod, impor);
-
-        try {
-            valid.enterImport_stmt(impor);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(), containsString("Import:unique1 not unique"));
-            return;
-        }
-
-        fail("Validation Exception should have occured");
-    }
-
-    @Test
-    public void testIncludes() {
-        Include_stmtContext incl = mockInclude("unique1");
-        Module_stmtContext mod = mockStatement(Module_stmtContext.class, "module1");
-        addChild(mod, incl);
-        valid.enterInclude_stmt(incl);
-
-        incl = mockInclude("unique1");
-        mod = mockStatement(Module_stmtContext.class, "module1");
-        addChild(mod, incl);
-
-        try {
-            valid.enterInclude_stmt(incl);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(), containsString("Include:unique1 not unique in (sub)module"));
-            return;
-        }
-
-        fail("Validation Exception should have occured");
-    }
-
-//    @Test
-//    public void testIdentifierMatching() {
-//        List<String> ids = new ArrayList<String>();
-//        // valid
-//        ids.add("_ok98-.87.-.8...88-asdAD");
-//        ids.add("AA.bcd");
-//        ids.add("a");
-//        // invalid
-//        ids.add("9aa");
-//        ids.add("-");
-//        ids.add(".");
-//
-//        int thrown = 0;
-//        for (String id : ids) {
-//            try {
-//                Module_stmtContext module = mock(Module_stmtContext.class);
-//                Token token = mock(Token.class);
-//                when(module.getStart()).thenReturn(token);
-//                BasicValidat ions.checkIdentifierInternal(module, id);
-//            } catch (YangValidationException e) {
-//                thrown++;
-//            }
-//        }
-//
-//        assertEquals(3, thrown);
-//    }
-
-    @Test(expected = YangValidationException.class)
-    public void testAugument() {
-        Augment_stmtContext augument = mockStatement(Augment_stmtContext.class, "/a:*abc/a:augument1");
-        Module_stmtContext mod1 = mockStatement(Module_stmtContext.class, "mod1");
-        addChild(mod1, augument);
-
-        Token token = mock(Token.class);
-        when(augument.getStart()).thenReturn(token);
-
-        try {
-            valid.enterAugment_stmt(augument);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Schema node id:/a:*abc/a:augument1 not in required format, details:Prefixed id:a:*abc not in required format"));
-            throw e;
-        }
-    }
-
-//    @Test
-//    public void testDeviate() {
-//        Deviation_stmtContext ctx = mockStatement(Deviation_stmtContext.class, "deviations");
-//        Deviate_add_stmtContext add = mockStatement(Deviate_add_stmtContext.class, "add");
-//        Deviate_delete_stmtContext del = mockStatement(Deviate_delete_stmtContext.class, "delete");
-//
-//        addChild(ctx, add);
-//        addChild(ctx, del);
-//
-//        valid.enterDeviation_stmt(ctx);
-//
-//        HashSet<Class<? extends ParseTree>> types = Sets.newHashSet();
-//        types.add(Deviate_add_stmtContext.class);
-//        types.add(Deviate_delete_stmtContext.class);
-//
-//        int count = ValidationUtil.countPresentChildrenOfType(ctx, types);
-//        assertEquals(2, count);
-//    }
-
-    @Test(expected = YangValidationException.class)
-    public void testStatus() throws Exception {
-        Status_argContext status = mockStatement(Status_argContext.class, "unknown");
-        try {
-            valid.enterStatus_arg(status);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(), containsString("illegal value for Status statement, only permitted:"));
-            throw e;
-        }
-    }
-
-    private static Import_stmtContext mockImport(final String name, final String prefixName) {
-        Import_stmtContext impor = mockStatement(Import_stmtContext.class, name);
-
-        Prefix_stmtContext prefix = mockStatement(Prefix_stmtContext.class, prefixName);
-        Revision_date_stmtContext revDate = mockStatement(Revision_date_stmtContext.class, getFormattedDate());
-
-        addChild(impor, prefix);
-        addChild(impor, revDate);
-        return impor;
-    }
-
-    static String getFormattedDate() {
-        return new SimpleDateFormat("yyyy-MM-dd").format(new Date());
-    }
-
-    private static Include_stmtContext mockInclude(final String name) {
-        Include_stmtContext incl = mockStatement(Include_stmtContext.class, name);
-
-        Revision_date_stmtContext revDate = mockStatement(Revision_date_stmtContext.class, getFormattedDate());
-
-        addChild(incl, revDate);
-        return incl;
-    }
-
-    static void mockName(final ParseTree stmt, final String name) {
-        doReturn(1).when(stmt).getChildCount();
-
-        TerminalNode terminalNode = mock(TerminalNode.class);
-        doReturn(name).when(terminalNode).getText();
-
-        StringContext nameCtx = mock(StringContext.class);
-        doReturn(nameCtx).when(stmt).getChild(0);
-        doReturn(terminalNode).when(nameCtx).getChild(0);
-        doReturn(name).when(terminalNode).getText();
-
-        doReturn(Collections.singletonList(terminalNode)).when(nameCtx).STRING();
-    }
-
-    static <T extends ParseTree> T mockStatement(final Class<T> stmtType, final String name) {
-        T stmt = stmtType.cast(mock(stmtType));
-
-        doReturn(0).when(stmt).getChildCount();
-
-        if (name != null) {
-            mockName(stmt, name);
-        }
-        return stmt;
-    }
-
-    static void addChild(final ParseTree parent, final ParseTree child) {
-        int childCount = parent.getChildCount() + 1;
-        doReturn(childCount).when(parent).getChildCount();
-        doReturn(child).when(parent).getChild(childCount - 1);
-        doReturn(parent).when(child).getParent();
-    }
-
-}