Sonar issues clean-up
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / GroupingUtils.java
index 44f91489ab9045b41b0a2d560e135e7d2a6ed99e..f5a996dbe099fb2156004a0108534824ac31b4a8 100644 (file)
@@ -9,6 +9,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
 import java.util.Collection;
 import java.util.HashSet;
+import java.util.Set;
+
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
@@ -24,7 +26,10 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
 
-public class GroupingUtils {
+public final class GroupingUtils {
+
+    private GroupingUtils() {
+    }
 
     /**
      * @param sourceGrpStmtCtx
@@ -90,14 +95,18 @@ public class GroupingUtils {
                 QName sourceQName = (QName) sourceStmtArgument;
                 QNameModule sourceQNameModule = sourceQName.getModule();
 
-                if (targetQNameModule.equals(sourceQNameModule))
+                if (targetQNameModule.equals(sourceQNameModule)) {
                     return null;
-                else
+                }
+                else {
                     return targetQNameModule;
-            } else
+                }
+            } else {
                 return null;
-        } else
+            }
+        } else {
             return null;
+        }
     }
 
     public static boolean needToCreateNewQName(
@@ -107,26 +116,20 @@ public class GroupingUtils {
 
     public static boolean needToCopyByUses(StmtContext<?, ?, ?> stmtContext) {
 
-        HashSet<StatementDefinition> noCopyDefSet = new HashSet<StatementDefinition>();
+        Set<StatementDefinition> noCopyDefSet = new HashSet<StatementDefinition>();
         noCopyDefSet.add(Rfc6020Mapping.USES);
 
         StatementDefinition def = stmtContext.getPublicDefinition();
-        if (noCopyDefSet.contains(def))
-            return false;
-        else
-            return true;
+        return (!noCopyDefSet.contains(def));
     }
 
     public static boolean isReusedByUses(StmtContext<?, ?, ?> stmtContext) {
 
-        HashSet<StatementDefinition> reusedDefSet = new HashSet<StatementDefinition>();
+        Set<StatementDefinition> reusedDefSet = new HashSet<StatementDefinition>();
         reusedDefSet.add(Rfc6020Mapping.TYPEDEF);
 
         StatementDefinition def = stmtContext.getPublicDefinition();
-        if (reusedDefSet.contains(def))
-            return true;
-        else
-            return false;
+        return (reusedDefSet.contains(def));
     }
 
     public static void resolveUsesNode(