Fix failing unit test in QueuedNotificationManagerTest
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / SchemaNodeIdentifierBuildNamespace.java
index 67297ebb1085490c71201bc42f93dff45ee0c7a4..d33df59d97d0c981bd3296bb14f7e140873fdc88 100644 (file)
@@ -21,34 +21,34 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
 
-class SchemaNodeIdentifierBuildNamespace extends
+public class SchemaNodeIdentifierBuildNamespace extends
         DerivedNamespaceBehaviour<SchemaNodeIdentifier, StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>, QName, SchemaNodeIdentifierBuildNamespace, ChildSchemaNodes<?, ?>>
         implements IdentifierNamespace<SchemaNodeIdentifier, StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>> {
 
     @SuppressWarnings({"unchecked", "rawtypes"})
-    protected SchemaNodeIdentifierBuildNamespace() {
+    public SchemaNodeIdentifierBuildNamespace() {
         super(SchemaNodeIdentifierBuildNamespace.class, (Class) ChildSchemaNodes.class);
     }
 
     @Override
     public StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> get(
-            SchemaNodeIdentifier key) {
+            final SchemaNodeIdentifier key) {
         throw new UnsupportedOperationException("Direct access to namespace is not supported");
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> getFrom(NamespaceStorageNode storage, SchemaNodeIdentifier key) {
+    public StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> getFrom(final NamespaceStorageNode storage, final SchemaNodeIdentifier key) {
 
         final NamespaceStorageNode lookupStartStorage;
-        if(key.isAbsolute() || storage.getStorageNodeType() == StorageNodeType.ROOT_STATEMENT_LOCAL) {
+        if (key.isAbsolute() || storage.getStorageNodeType() == StorageNodeType.ROOT_STATEMENT_LOCAL) {
             lookupStartStorage = NamespaceBehaviour.findClosestTowardsRoot(storage, StorageNodeType.GLOBAL);
         } else {
             lookupStartStorage = storage;
         }
-        Iterator<QName> iterator = key.getPathFromRoot().iterator();
-        if(!iterator.hasNext()) {
-            if(lookupStartStorage instanceof StmtContext<?, ?, ?>) {
+        final Iterator<QName> iterator = key.getPathFromRoot().iterator();
+        if (!iterator.hasNext()) {
+            if (lookupStartStorage instanceof StmtContext<?, ?, ?>) {
                 return (StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage;
             } else {
                 return null;
@@ -57,12 +57,12 @@ class SchemaNodeIdentifierBuildNamespace extends
         QName nextPath = iterator.next();
         StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> current = (StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage
                 .getFromLocalStorage(ChildSchemaNodes.class, nextPath);
-        if(current == null && lookupStartStorage instanceof StmtContext<?, ?, ?>) {
+        if (current == null && lookupStartStorage instanceof StmtContext<?, ?, ?>) {
             return tryToFindUnknownStatement(nextPath.getLocalName(), (Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage);
         }
         while (current != null && iterator.hasNext()) {
             nextPath = iterator.next();
-            StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> nextNodeCtx = (StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>) current
+            final StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> nextNodeCtx = (StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>) current
                     .getFromNamespace(ChildSchemaNodes.class, nextPath);
             if (nextNodeCtx == null) {
                 return tryToFindUnknownStatement(nextPath.getLocalName(), current);
@@ -74,11 +74,11 @@ class SchemaNodeIdentifierBuildNamespace extends
     }
 
     @SuppressWarnings({"unchecked", "rawtypes"})
-    private Mutable<?, ?, EffectiveStatement<?, ?>> tryToFindUnknownStatement(final String localName,
+    private static Mutable<?, ?, EffectiveStatement<?, ?>> tryToFindUnknownStatement(final String localName,
             final Mutable<?, ?, EffectiveStatement<?, ?>> current) {
-        Collection<StmtContext<?, ?, ?>> unknownSubstatements = (Collection)StmtContextUtils.findAllSubstatements(current,
+        final Collection<StmtContext<?, ?, ?>> unknownSubstatements = (Collection)StmtContextUtils.findAllSubstatements(current,
                 UnknownStatement.class);
-        for (StmtContext<?, ?, ?> unknownSubstatement : unknownSubstatements) {
+        for (final StmtContext<?, ?, ?> unknownSubstatement : unknownSubstatements) {
             if (localName.equals(unknownSubstatement.rawStatementArgument())) {
                 return (Mutable<?, ?, EffectiveStatement<?, ?>>) unknownSubstatement;
             }
@@ -87,7 +87,7 @@ class SchemaNodeIdentifierBuildNamespace extends
     }
 
     @Override
-    public QName getSignificantKey(SchemaNodeIdentifier key) {
+    public QName getSignificantKey(final SchemaNodeIdentifier key) {
         return key.getLastComponent();
     }