YANG construct collision detection framework added

Change-Id: I1458f9e3192641f3f90c444798c31a64536ffa5d
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/CollisionDetector.java b/src/main/java/org/onosproject/yangutils/datamodel/CollisionDetector.java
new file mode 100644
index 0000000..0913d03
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/datamodel/CollisionDetector.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.utils.YangConstructType;
+
+/**
+ * Abstraction of YANG collision function. Abstracted to unify the collision
+ * detection functionality.
+ */
+public interface CollisionDetector {
+    /**
+     * Checks for the colliding child.
+     *
+     * @param identifierName name of identifier for which collision to be
+     *            checked
+     * @param dataType type of the YANG construct for which collision to be
+     *            checked
+     * @throws DataModelException if there is any collision in YANG rules in
+     *             parsed data, corresponding exception should be thrown
+     */
+    void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException;
+
+    /**
+     * Check for the self collision.
+     *
+     * @param identifierName name of identifier for which collision to be
+     *            checked
+     * @param dataType type of the YANG construct for which collision to be
+     *            checked
+     * @throws DataModelException if there is any collision in YANG rules in
+     *             parsed data, corresponding exception should be thrown
+     */
+    void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException;
+}
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
index 378eaf4..30d4978 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
@@ -20,7 +20,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
@@ -85,7 +85,7 @@
     private String targetNode;
 
     /**
-     * description of augment.
+     * Description of augment.
      */
     private String description;
 
@@ -100,7 +100,7 @@
     private List<YangLeafList> listOfLeafList;
 
     /**
-     * reference.
+     * Reference of the YANG augment.
      */
     private String reference;
 
@@ -110,7 +110,7 @@
     private YangStatusType status;
 
     /**
-     * package of the generated java code.
+     * Package of the generated java code.
      */
     private String pkg;
 
@@ -124,7 +124,7 @@
     /**
      * Get the augmented node.
      *
-     * @return the augmented node.
+     * @return the augmented node
      */
     public String getTargetNode() {
         return targetNode;
@@ -133,7 +133,7 @@
     /**
      * Set the augmented node.
      *
-     * @param targetNode the augmented node.
+     * @param targetNode the augmented node
      */
     public void setTargetNode(String targetNode) {
         this.targetNode = targetNode;
@@ -142,7 +142,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -152,7 +152,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -162,7 +162,7 @@
     /**
      * Get the list of leaves.
      *
-     * @return the list of leaves.
+     * @return the list of leaves
      */
     @Override
     public List<YangLeaf> getListOfLeaf() {
@@ -172,7 +172,7 @@
     /**
      * Set the list of leaves.
      *
-     * @param leafsList the list of leaf to set.
+     * @param leafsList the list of leaf to set
      */
     private void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
@@ -181,7 +181,7 @@
     /**
      * Add a leaf.
      *
-     * @param leaf the leaf to be added.
+     * @param leaf the leaf to be added
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
@@ -195,7 +195,7 @@
     /**
      * Get the list of leaf-list.
      *
-     * @return the list of leaf-list.
+     * @return the list of leaf-list
      */
     @Override
     public List<YangLeafList> getListOfLeafList() {
@@ -205,7 +205,7 @@
     /**
      * Set the list of leaf-list.
      *
-     * @param listOfLeafList the list of leaf-list to set.
+     * @param listOfLeafList the list of leaf-list to set
      */
     private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
@@ -214,7 +214,7 @@
     /**
      * Add a leaf-list.
      *
-     * @param leafList the leaf-list to be added.
+     * @param leafList the leaf-list to be added
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
@@ -228,7 +228,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -238,7 +238,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -248,7 +248,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -258,7 +258,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -268,17 +268,17 @@
     /**
      * Returns the type of the data as belongs-to.
      *
-     * @return returns AUGMENT_DATA.
+     * @return returns AUGMENT_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.AUGMENT_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.AUGMENT_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -288,7 +288,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
@@ -298,7 +298,7 @@
     /**
      * Get the target nodes name where the augmentation is being done.
      *
-     * @return target nodes name where the augmentation is being done.
+     * @return target nodes name where the augmentation is being done
      */
     @Override
     public String getName() {
@@ -308,7 +308,7 @@
     /**
      * Set the target nodes name where the augmentation is being done.
      *
-     * @param name target nodes name where the augmentation is being done.
+     * @param name target nodes name where the augmentation is being done
      */
     @Override
     public void setName(String name) {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java b/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
index a4a5cae..b3b718f 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
@@ -17,7 +17,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*-
  *   Reference 6020.
@@ -94,7 +94,7 @@
     /**
      * Get the prefix.
      *
-     * @return the prefix.
+     * @return the prefix
      */
     public String getPrefix() {
         return prefix;
@@ -115,14 +115,14 @@
      * @return ParsedDataType returns BELONGS_TO_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.BELONGS_TO_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.BELONGS_TO_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -132,7 +132,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java b/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
index 77f19c1..47956e6 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
@@ -18,7 +18,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 import java.util.Objects;
 
@@ -83,7 +83,7 @@
     /**
      * Returns bit name.
      *
-     * @return the bit name.
+     * @return the bit name
      */
     public String getBitName() {
         return bitName;
@@ -92,7 +92,7 @@
     /**
      * Set the bit name.
      *
-     * @param bitName the bit name to set.
+     * @param bitName the bit name to set
      */
     public void setBitName(String bitName) {
         this.bitName = bitName;
@@ -101,7 +101,7 @@
     /**
      * Returns description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -111,7 +111,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -121,7 +121,7 @@
     /**
      * Returns textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -131,7 +131,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -141,7 +141,7 @@
     /**
      * Returns status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -151,7 +151,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -170,7 +170,7 @@
     /**
      * Set the bit position.
      *
-     * @param position the position to set.
+     * @param position the position to set
      */
     public void setPosition(int position) {
         this.position = position;
@@ -182,8 +182,8 @@
      * @return ParsedDataType returns BIT_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.BIT_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.BIT_DATA;
     }
 
     @Override
@@ -206,7 +206,7 @@
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -216,7 +216,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java b/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
index 54898a4..dbf0531 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
@@ -21,7 +21,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*
  * Reference RFC 6020.
@@ -70,12 +70,13 @@
     /**
      * Add bit info.
      *
-     * @param bitInfo the bit information to be added.
-     * @throws DataModelException due to violation in data model rules.
+     * @param bitInfo the bit information to be added
+     * @throws DataModelException due to violation in data model rules
      */
     public void addBitInfo(YangBit bitInfo) throws DataModelException {
         if (!getBitSet().add(bitInfo)) {
-            throw new DataModelException("YANG Bit already exists");
+            throw new DataModelException("YANG file error: Duplicate identifier detected, same as bit \""
+                    + bitInfo.getBitName() + "\"");
         }
     }
 
@@ -85,14 +86,14 @@
      * @return ParsedDataType returns BITS_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.BITS_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.BITS_DATA;
     }
 
     /**
      * Returns the bits name.
      *
-     * @return name of the bits.
+     * @return name of the bits
      */
     public String getBitsName() {
         return bitsName;
@@ -101,7 +102,7 @@
     /**
      * Set bits name.
      *
-     * @param bitsName bit name to be set.
+     * @param bitsName bit name to be set
      */
     public void setBitsName(String bitsName) {
         this.bitsName = bitsName;
@@ -110,7 +111,7 @@
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -120,7 +121,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
index dc9f36b..b9da3c2 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
@@ -15,14 +15,16 @@
  */
 package org.onosproject.yangutils.datamodel;
 
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import org.onosproject.yangutils.parser.Parsable;
+import org.onosproject.yangutils.translator.CachedFileHandle;
+import org.onosproject.yangutils.utils.YangConstructType;
+import static org.onosproject.yangutils.utils.YangConstructType.CASE_DATA;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
-import org.onosproject.yangutils.translator.CachedFileHandle;
-
 /*-
  * Reference RFC 6020.
  *
@@ -90,7 +92,7 @@
  * Data model node to maintain information defined in YANG case.
  */
 public class YangCase extends YangNode
-        implements YangLeavesHolder, YangCommonInfo, Parsable {
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector {
 
     /**
      * Case name.
@@ -100,7 +102,7 @@
     // TODO: default field identification for the case
 
     /**
-     * Description of container.
+     * Description of case.
      */
     private String description;
 
@@ -125,7 +127,7 @@
     private YangStatusType status;
 
     /**
-     * package of the generated java code.
+     * Package of the generated java code.
      */
     private String pkg;
 
@@ -139,7 +141,7 @@
     /**
      * Get the case name.
      *
-     * @return case name.
+     * @return case name
      */
     @Override
     public String getName() {
@@ -149,7 +151,7 @@
     /**
      * Set the case name.
      *
-     * @param name case name.
+     * @param name case name
      */
     @Override
     public void setName(String name) {
@@ -159,7 +161,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -169,7 +171,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -179,7 +181,7 @@
     /**
      * Get the list of leaves.
      *
-     * @return the list of leaves.
+     * @return the list of leaves
      */
     @Override
     public List<YangLeaf> getListOfLeaf() {
@@ -189,7 +191,7 @@
     /**
      * Set the list of leaves.
      *
-     * @param leafsList the list of leaf to set.
+     * @param leafsList the list of leaf to set
      */
     private void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
@@ -198,7 +200,7 @@
     /**
      * Add a leaf.
      *
-     * @param leaf the leaf to be added.
+     * @param leaf the leaf to be added
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
@@ -212,7 +214,7 @@
     /**
      * Get the list of leaf-list.
      *
-     * @return the list of leaf-list.
+     * @return the list of leaf-list
      */
     @Override
     public List<YangLeafList> getListOfLeafList() {
@@ -222,7 +224,7 @@
     /**
      * Set the list of leaf-list.
      *
-     * @param listOfLeafList the list of leaf-list to set.
+     * @param listOfLeafList the list of leaf-list to set
      */
     private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
@@ -231,7 +233,7 @@
     /**
      * Add a leaf-list.
      *
-     * @param leafList the leaf-list to be added.
+     * @param leafList the leaf-list to be added
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
@@ -245,7 +247,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -255,7 +257,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -265,7 +267,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -275,7 +277,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -288,14 +290,14 @@
      * @return returns CASE_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.CASE_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.CASE_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -305,7 +307,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
@@ -361,6 +363,30 @@
     @Override
     public void setFileHandle(CachedFileHandle fileHandle) {
         // TODO Auto-generated method stub
+    }
 
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+        if ((this.getParent() == null) || (!(this.getParent() instanceof YangChoice))) {
+            throw new DataModelException("Internal Data Model Tree Error: Invalid/Missing holder in case " +
+                    this.getName());
+        }
+        // Traverse up in tree to ask parent choice start collision detection.
+        ((CollisionDetector) this.getParent()).detectCollidingChild(identifierName, dataType);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+
+        if (dataType == CASE_DATA) {
+            if (this.getName().equals(identifierName)) {
+                throw new DataModelException("YANG File Error: Identifier collision detected in case \"" +
+                        this.getName() + "\"");
+            }
+            return;
+        }
+
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(identifierName, dataType, this);
     }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java b/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
index be47039..440ca57 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
@@ -15,13 +15,11 @@
  */
 package org.onosproject.yangutils.datamodel;
 
-import java.util.LinkedList;
-import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
 import org.onosproject.yangutils.translator.CachedFileHandle;
+import org.onosproject.yangutils.utils.YangConstructType;
+import static org.onosproject.yangutils.utils.YangConstructType.CHOICE_DATA;
 
 /*-
  * Reference RFC 6020.
@@ -61,7 +59,7 @@
 /**
  * Data model node to maintain information defined in YANG choice.
  */
-public class YangChoice extends YangNode implements YangCommonInfo, Parsable {
+public class YangChoice extends YangNode implements YangCommonInfo, Parsable, CollisionDetector {
 
     /**
      * Name of choice.
@@ -69,11 +67,6 @@
     private String name;
 
     /**
-     * List of cases for the current choice.
-     */
-    private List<YangCase> caseList;
-
-    /**
      * If the choice represents config data.
      */
     private boolean isConfig;
@@ -105,7 +98,7 @@
     private String defaultCase;
 
     /**
-     * Description.
+     * Description of choice.
      */
     private String description;
 
@@ -131,7 +124,7 @@
     private String mandatory;
 
     /**
-     * reference of the choice.
+     * Reference of the choice.
      */
     private String reference;
 
@@ -141,13 +134,15 @@
     private YangStatusType status;
 
     /**
-     * Create a Choice node.
+     * Create a choice node.
      */
     public YangChoice() {
         super(YangNodeType.CHOICE_NODE);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     *
      * @see org.onosproject.yangutils.datamodel.YangNode#getName()
      */
     @Override
@@ -155,8 +150,11 @@
         return name;
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
      */
     @Override
     public void setName(String name) {
@@ -164,40 +162,9 @@
     }
 
     /**
-     * Get the list of cases.
-     *
-     * @return the case list
-     */
-    public List<YangCase> getCaseList() {
-        return caseList;
-    }
-
-    /**
-     * Set the list of cases.
-     *
-     * @param caseList list of cases.
-     */
-    private void setCaseList(List<YangCase> caseList) {
-        this.caseList = caseList;
-    }
-
-    /**
-     * Add a case.
-     *
-     * @param newCase new case for the choice
-     */
-    public void addCase(YangCase newCase) {
-        if (getCaseList() == null) {
-            setCaseList(new LinkedList<YangCase>());
-        }
-
-        getCaseList().add(newCase);
-    }
-
-    /**
      * Get config flag.
      *
-     * @return the config flag.
+     * @return the config flag
      */
     public boolean isConfig() {
         return isConfig;
@@ -206,7 +173,7 @@
     /**
      * Set config flag.
      *
-     * @param isCfg the config flag.
+     * @param isCfg the config flag
      */
     public void setConfig(boolean isCfg) {
         isConfig = isCfg;
@@ -215,7 +182,7 @@
     /**
      * Get the default case.
      *
-     * @return the default case.
+     * @return the default case
      */
     public String getDefaultCase() {
         return defaultCase;
@@ -233,7 +200,7 @@
     /**
      * Get the mandatory status.
      *
-     * @return the mandatory status.
+     * @return the mandatory status
      */
     public String getMandatory() {
         return mandatory;
@@ -242,7 +209,7 @@
     /**
      * Set the mandatory status.
      *
-     * @param mandatory the mandatory status.
+     * @param mandatory the mandatory status
      */
     public void setMandatory(String mandatory) {
         this.mandatory = mandatory;
@@ -251,7 +218,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -261,7 +228,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -271,7 +238,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -281,7 +248,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -291,7 +258,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -301,7 +268,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -314,14 +281,14 @@
      * @return returns CHOICE_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.CHOICE_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.CHOICE_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -331,14 +298,16 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     *
      * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
      */
     @Override
@@ -347,8 +316,11 @@
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
      */
     @Override
     public void setPackage(String pkg) {
@@ -356,8 +328,12 @@
 
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry(
+     * )
      */
     @Override
     public void generateJavaCodeEntry() {
@@ -365,8 +341,11 @@
 
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
      */
     @Override
     public void generateJavaCodeExit() {
@@ -385,4 +364,36 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+
+        YangNode node = this.getChild();
+        while ((node != null)) {
+            if (node instanceof CollisionDetector) {
+                ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
+            }
+            node = node.getNextSibling();
+        }
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+
+        if (dataType == CHOICE_DATA) {
+            if (this.getName().equals(identifierName)) {
+                throw new DataModelException("YANG file error: Identifier collision detected in choice \"" +
+                        this.getName() + "\"");
+            }
+            return;
+        }
+
+        YangNode node = this.getChild();
+        while ((node != null)) {
+            if (node instanceof CollisionDetector) {
+                ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
+            }
+            node = node.getNextSibling();
+        }
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java b/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
index 99baf4a..d251479 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
@@ -21,8 +21,9 @@
 import java.util.List;
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 import org.onosproject.yangutils.translator.CachedFileHandle;
 import org.onosproject.yangutils.translator.GeneratedFileType;
 import org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax;
@@ -90,7 +91,7 @@
 /**
  * Data model node to maintain information defined in YANG container.
  */
-public class YangContainer extends YangNode implements YangLeavesHolder, YangCommonInfo, Parsable {
+public class YangContainer extends YangNode implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector {
 
     /**
      * Name of the container.
@@ -153,7 +154,7 @@
     /**
      * Get the YANG name of container.
      *
-     * @return the name of container as defined in YANG file.
+     * @return the name of container as defined in YANG file
      */
     @Override
     public String getName() {
@@ -163,7 +164,7 @@
     /**
      * Set the YANG name of container.
      *
-     * @param name the name of container as defined in YANG file.
+     * @param name the name of container as defined in YANG file
      */
     @Override
     public void setName(String name) {
@@ -182,7 +183,7 @@
     /**
      * Set the config flag.
      *
-     * @param isCfg the config flag.
+     * @param isCfg the config flag
      */
     public void setConfig(boolean isCfg) {
         isConfig = isCfg;
@@ -191,7 +192,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -201,7 +202,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -211,7 +212,7 @@
     /**
      * Get the list of leaves.
      *
-     * @return the list of leaves.
+     * @return the list of leaves
      */
     @Override
     public List<YangLeaf> getListOfLeaf() {
@@ -221,7 +222,7 @@
     /**
      * Set the list of leaves.
      *
-     * @param leafsList the list of leaf to set.
+     * @param leafsList the list of leaf to set
      */
     private void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
@@ -230,7 +231,7 @@
     /**
      * Add a leaf.
      *
-     * @param leaf the leaf to be added.
+     * @param leaf the leaf to be added
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
@@ -244,7 +245,7 @@
     /**
      * Get the list of leaf-list.
      *
-     * @return the list of leaf-list.
+     * @return the list of leaf-list
      */
     @Override
     public List<YangLeafList> getListOfLeafList() {
@@ -254,7 +255,7 @@
     /**
      * Set the list of leaf-list.
      *
-     * @param listOfLeafList the list of leaf-list to set.
+     * @param listOfLeafList the list of leaf-list to set
      */
     private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
@@ -263,7 +264,7 @@
     /**
      * Add a leaf-list.
      *
-     * @param leafList the leaf-list to be added.
+     * @param leafList the leaf-list to be added
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
@@ -277,7 +278,7 @@
     /**
      * Get the presence string if present.
      *
-     * @return the isPressence.
+     * @return the presence
      */
     public String getPresence() {
         return presence;
@@ -295,7 +296,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -305,7 +306,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -315,7 +316,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -325,7 +326,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -355,17 +356,17 @@
     /**
      * Returns the type of the data.
      *
-     * @return returns CONTAINER_DATA.
+     * @return returns CONTAINER_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.CONTAINER_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.CONTAINER_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -375,7 +376,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
@@ -387,15 +388,18 @@
     }
 
     /**
-     * Sets the config's value to all leaf if leaf's config statement is not specified.
+     * Sets the config's value to all leaf if leaf's config statement is not
+     * specified.
      *
-     * @param leaves list of leaf attributes of container.
-     * @param leafLists list of leaf-list attributes of container.
+     * @param leaves list of leaf attributes of container
+     * @param leafLists list of leaf-list attributes of container
      */
     private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) {
 
-        /* If "config" is not specified, the default is the same as the parent
-            schema node's "config" value.*/
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
         if (leaves != null) {
             for (YangLeaf leaf : leaves) {
                 if (leaf.isConfig() == null) {
@@ -404,8 +408,10 @@
             }
         }
 
-        /* If "config" is not specified, the default is the same as the parent
-           schema node's "config" value.*/
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
         if (leafLists != null) {
             for (YangLeafList leafList : leafLists) {
                 if (leafList.isConfig() == null) {
@@ -418,14 +424,16 @@
     /**
      * Validates config statement of container.
      *
-     * @param leaves list of leaf attributes of container.
-     * @param leafLists list of leaf-list attributes of container.
-     * @throws DataModelException a violation of data model rules.
+     * @param leaves list of leaf attributes of container
+     * @param leafLists list of leaf-list attributes of container
+     * @throws DataModelException a violation of data model rules
      */
     private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists) throws DataModelException {
 
-        /* If a node has "config" set to "false", no node underneath it can have
-             "config" set to "true".*/
+        /*
+         * If a node has "config" set to "false", no node underneath it can have
+         * "config" set to "true".
+         */
         if ((!isConfig) && (leaves != null)) {
             for (YangLeaf leaf : leaves) {
                 if (leaf.isConfig()) {
@@ -468,7 +476,7 @@
     /**
      * Generate the java code corresponding to YANG container.
      *
-     * @throws IOException when fails to generate the source files.
+     * @throws IOException when fails to generate the source files
      */
     @Override
     public void generateJavaCodeEntry() throws IOException {
@@ -532,4 +540,18 @@
         }
         return;
     }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(identifierName, dataType, this);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+        if (this.getName().equals(identifierName)) {
+            throw new DataModelException("YANG file error: Duplicate input identifier detected, same as container \""
+                    + this.getName() + "\"");
+        }
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedType.java b/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedType.java
index 31484ba..8c9628c 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedType.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangDerivedType.java
@@ -15,7 +15,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*-
  * The typedef Statement
@@ -60,7 +60,7 @@
     /**
      * Get the effective YANG built-in type of the derived data type.
      *
-     * @return effective YANG built-in type of the derived data type.
+     * @return effective YANG built-in type of the derived data type
      */
     public YangDataTypes getEffectiveYangBuiltInType() {
         return effectiveYangBuiltInType;
@@ -69,7 +69,7 @@
     /**
      * Set the effective YANG built-in type of the derived data type.
      *
-     * @param builtInType effective YANG built-in type of the derived data type.
+     * @param builtInType effective YANG built-in type of the derived data type
      */
     public void setEffectiveYangBuiltInType(YangDataTypes builtInType) {
         effectiveYangBuiltInType = builtInType;
@@ -78,7 +78,7 @@
     /**
      * Get the base type information.
      *
-     * @return base type information.
+     * @return base type information
      */
     public YangType<?> getBaseType() {
         return baseType;
@@ -87,7 +87,7 @@
     /**
      * Get the base type information.
      *
-     * @param baseType base type information.
+     * @param baseType base type information
      */
     public void setBaseType(YangType<?> baseType) {
         this.baseType = baseType;
@@ -97,8 +97,8 @@
      * Get the parsable type.
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.DERIVED;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.DERIVED;
     }
 
     /**
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java b/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
index 76ab0f3..dd79b65 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
@@ -18,7 +18,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 import java.util.Objects;
 
@@ -73,7 +73,7 @@
     private YangStatusType status;
 
     /**
-     * value of ENUM.
+     * Value of ENUM.
      */
     private int value;
 
@@ -87,7 +87,7 @@
     /**
      * Get the named value.
      *
-     * @return the named value.
+     * @return the named value
      */
     public String getNamedValue() {
         return namedValue;
@@ -96,7 +96,7 @@
     /**
      * Set the named value.
      *
-     * @param namedValue the named value to set.
+     * @param namedValue the named value to set
      */
     public void setNamedValue(String namedValue) {
         this.namedValue = namedValue;
@@ -105,7 +105,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -115,7 +115,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -125,7 +125,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -135,7 +135,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -145,7 +145,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -155,7 +155,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -165,7 +165,7 @@
     /**
      * Get the value.
      *
-     * @return the value.
+     * @return the value
      */
     public int getValue() {
         return value;
@@ -174,7 +174,7 @@
     /**
      * Set the value.
      *
-     * @param value the value to set.
+     * @param value the value to set
      */
     public void setValue(int value) {
         this.value = value;
@@ -186,8 +186,8 @@
      * @return ParsedDataType returns ENUM_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.ENUM_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.ENUM_DATA;
     }
 
     @Override
@@ -210,7 +210,7 @@
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -220,7 +220,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java b/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
index b89cc82..25a3bbb 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
@@ -21,7 +21,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*
  * The enumeration built-in type represents values from a set of
@@ -67,8 +67,8 @@
     /**
      * Add ENUM information.
      *
-     * @param enumInfo the ENUM information to be added.
-     * @throws DataModelException due to violation in data model rules.
+     * @param enumInfo the ENUM information to be added
+     * @throws DataModelException due to violation in data model rules
      */
     public void addEnumInfo(YangEnum enumInfo) throws DataModelException {
         if (!getEnumSet().add(enumInfo)) {
@@ -100,14 +100,14 @@
      * @return returns ENUMERATION_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.ENUMERATION_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.ENUMERATION_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -117,7 +117,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java b/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
index 4e3061d..9d87ee4 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
@@ -20,7 +20,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
@@ -110,7 +110,7 @@
     private YangStatusType status;
 
     /**
-     * package of the generated java code.
+     * Package of the generated java code.
      */
     private String pkg;
 
@@ -124,7 +124,7 @@
     /**
      * Get YANG grouping name.
      *
-     * @return YANG grouping name.
+     * @return YANG grouping name
      */
     @Override
     public String getName() {
@@ -134,7 +134,7 @@
     /**
      * Set YANG grouping name.
      *
-     * @param name YANG grouping name.
+     * @param name YANG grouping name
      */
     @Override
     public void setName(String name) {
@@ -144,7 +144,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -154,7 +154,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -164,7 +164,7 @@
     /**
      * Get the list of leaves.
      *
-     * @return the list of leaves.
+     * @return the list of leaves
      */
     @Override
     public List<YangLeaf> getListOfLeaf() {
@@ -174,7 +174,7 @@
     /**
      * Set the list of leaves.
      *
-     * @param leafsList the list of leaf to set.
+     * @param leafsList the list of leaf to set
      */
     private void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
@@ -183,7 +183,7 @@
     /**
      * Add a leaf.
      *
-     * @param leaf the leaf to be added.
+     * @param leaf the leaf to be added
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
@@ -197,7 +197,7 @@
     /**
      * Get the list of leaf-list.
      *
-     * @return the list of leaf-list.
+     * @return the list of leaf-list
      */
     @Override
     public List<YangLeafList> getListOfLeafList() {
@@ -207,7 +207,7 @@
     /**
      * Set the list of leaf-list.
      *
-     * @param listOfLeafList the list of leaf-list to set.
+     * @param listOfLeafList the list of leaf-list to set
      */
     private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
@@ -216,7 +216,7 @@
     /**
      * Add a leaf-list.
      *
-     * @param leafList the leaf-list to be added.
+     * @param leafList the leaf-list to be added
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
@@ -230,7 +230,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -240,7 +240,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -250,7 +250,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -260,7 +260,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -270,17 +270,17 @@
     /**
      * Returns the type of the data.
      *
-     * @return returns GROUPING_DATA.
+     * @return returns GROUPING_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.GROUPING_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.GROUPING_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -290,7 +290,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java b/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
index 83f978e..a6e81f0 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
@@ -17,7 +17,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*
  *  Reference:RFC 6020.
@@ -94,7 +94,7 @@
     /**
      * Get the imported module name.
      *
-     * @return the module name.
+     * @return the module name
      */
     public String getModuleName() {
         return name;
@@ -113,7 +113,7 @@
      * Get the prefix used to identify the entities from the imported module.
      *
      * @return the prefix used to identify the entities from the imported
-     *         module.
+     *         module
      */
     public String getPrefixId() {
         return prefixId;
@@ -122,7 +122,7 @@
     /**
      * Set prefix identifier.
      *
-     * @param prefixId set the prefix identifier of the imported module.
+     * @param prefixId set the prefix identifier of the imported module
      */
     public void setPrefixId(String prefixId) {
         this.prefixId = prefixId;
@@ -131,7 +131,7 @@
     /**
      * Get the revision of the imported module.
      *
-     * @return the revision of the imported module.
+     * @return the revision of the imported module
      */
     public String getRevision() {
         return revision;
@@ -140,7 +140,7 @@
     /**
      * Set the revision of the imported module.
      *
-     * @param rev set the revision of the imported module.
+     * @param rev set the revision of the imported module
      */
     public void setRevision(String rev) {
         revision = rev;
@@ -152,8 +152,8 @@
      * @return returns IMPORT_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.IMPORT_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.IMPORT_DATA;
     }
 
     /**
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java b/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
index a506847..917a0d3 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
@@ -17,7 +17,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*
  * Reference:RFC 6020.
@@ -98,8 +98,8 @@
      * @return returns INCLUDE_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.INCLUDE_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.INCLUDE_DATA;
     }
 
     /**
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java b/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
index 888094e..a2e5ab5 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
@@ -18,7 +18,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*
  * Reference:RFC 6020.
@@ -108,7 +108,7 @@
     /**
      * Get the name of leaf.
      *
-     * @return the leaf name.
+     * @return the leaf name
      */
     public String getLeafName() {
         return name;
@@ -117,7 +117,7 @@
     /**
      * Set the name of leaf.
      *
-     * @param leafName the leaf name to set.
+     * @param leafName the leaf name to set
      */
     public void setLeafName(String leafName) {
         name = leafName;
@@ -126,7 +126,7 @@
     /**
      * Get the config flag.
      *
-     * @return if config flag.
+     * @return if config flag
      */
     public Boolean isConfig() {
         return isConfig;
@@ -135,7 +135,7 @@
     /**
      * Set the config flag.
      *
-     * @param isCfg the flag value to set.
+     * @param isCfg the flag value to set
      */
     public void setConfig(boolean isCfg) {
         isConfig = isCfg;
@@ -144,7 +144,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -154,7 +154,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -164,7 +164,7 @@
     /**
      * Get if the leaf is mandatory.
      *
-     * @return if leaf is mandatory.
+     * @return if leaf is mandatory
      */
     public boolean isMandatory() {
         return isMandatory;
@@ -182,7 +182,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -192,7 +192,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -202,7 +202,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -212,7 +212,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -222,7 +222,7 @@
     /**
      * Get the units.
      *
-     * @return the units.
+     * @return the units
      */
     public String getUnits() {
         return units;
@@ -231,7 +231,7 @@
     /**
      * Set the units.
      *
-     * @param units the units to set.
+     * @param units the units to set
      */
     public void setUnits(String units) {
         this.units = units;
@@ -240,7 +240,7 @@
     /**
      * Get the data type.
      *
-     * @return the data type.
+     * @return the data type
      */
     public YangType<?> getDataType() {
         return dataType;
@@ -249,7 +249,7 @@
     /**
      * Set the data type.
      *
-     * @param dataType the data type to set.
+     * @param dataType the data type to set
      */
     public void setDataType(YangType<?> dataType) {
         this.dataType = dataType;
@@ -258,17 +258,17 @@
     /**
      * Returns the type of the parsed data.
      *
-     * @return returns LEAF_DATA.
+     * @return returns LEAF_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.LEAF_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.LEAF_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -279,7 +279,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java b/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
index 6ce3430..9852a75 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
@@ -18,7 +18,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*
  *  Reference:RFC 6020.
@@ -130,7 +130,7 @@
     /**
      * Get the leaf-list name.
      *
-     * @return the leaf-list name.
+     * @return the leaf-list name
      */
     public String getLeafName() {
         return name;
@@ -139,7 +139,7 @@
     /**
      * Set the leaf-list name.
      *
-     * @param leafListName the leaf-list name to set.
+     * @param leafListName the leaf-list name to set
      */
     public void setLeafName(String leafListName) {
         name = leafListName;
@@ -148,7 +148,7 @@
     /**
      * Get the config flag.
      *
-     * @return the config flag.
+     * @return the config flag
      */
     public Boolean isConfig() {
         return isConfig;
@@ -157,7 +157,7 @@
     /**
      * Set the config flag.
      *
-     * @param isCfg the config flag.
+     * @param isCfg the config flag
      */
     public void setConfig(boolean isCfg) {
         isConfig = isCfg;
@@ -166,7 +166,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -176,7 +176,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -186,7 +186,7 @@
     /**
      * Get the max elements no.
      *
-     * @return the max elements no.
+     * @return the max elements no
      */
     public int getMaxElelements() {
         return maxElelements;
@@ -195,7 +195,7 @@
     /**
      * Set the max elements no.
      *
-     * @param maxElelements max elements no.
+     * @param maxElelements max elements no
      */
     public void setMaxElelements(int maxElelements) {
         this.maxElelements = maxElelements;
@@ -204,7 +204,7 @@
     /**
      * Get the min elements no.
      *
-     * @return the min elements no.
+     * @return the min elements no
      */
     public int getMinElements() {
         return minElements;
@@ -213,7 +213,7 @@
     /**
      * Set the min elements no.
      *
-     * @param minElements the min elements no.
+     * @param minElements the min elements no
      */
     public void setMinElements(int minElements) {
         this.minElements = minElements;
@@ -222,7 +222,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -232,7 +232,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -242,7 +242,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -252,7 +252,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -262,7 +262,7 @@
     /**
      * Get the units.
      *
-     * @return the units.
+     * @return the units
      */
     public String getUnits() {
         return units;
@@ -271,7 +271,7 @@
     /**
      * Set the units.
      *
-     * @param units the units to set.
+     * @param units the units to set
      */
     public void setUnits(String units) {
         this.units = units;
@@ -280,7 +280,7 @@
     /**
      * Get the data type.
      *
-     * @return the data type.
+     * @return the data type
      */
     public YangType<?> getDataType() {
         return dataType;
@@ -289,7 +289,7 @@
     /**
      * Set the data type.
      *
-     * @param dataType the data type to set.
+     * @param dataType the data type to set
      */
     public void setDataType(YangType<?> dataType) {
         this.dataType = dataType;
@@ -298,17 +298,17 @@
     /**
      * Returns the type of the parsed data.
      *
-     * @return returns LEAF_LIST_DATA.
+     * @return returns LEAF_LIST_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.LEAF_LIST_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.LEAF_LIST_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -319,7 +319,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
index d2ee876..c0b569b 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -16,14 +16,15 @@
 
 package org.onosproject.yangutils.datamodel;
 
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import org.onosproject.yangutils.parser.Parsable;
+import org.onosproject.yangutils.translator.CachedFileHandle;
+import org.onosproject.yangutils.utils.YangConstructType;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
-import org.onosproject.yangutils.translator.CachedFileHandle;
-
 /*-
  *  The "list" statement is used to define an interior data node in the
  *  schema tree.  A list node may exist in multiple instances in the data
@@ -67,10 +68,10 @@
  * List data represented in YANG.
  */
 public class YangList extends YangNode
-        implements YangLeavesHolder, YangCommonInfo, Parsable {
+        implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector {
 
     /**
-     * name of the YANG list.
+     * Name of the YANG list.
      */
     private String name;
 
@@ -177,7 +178,7 @@
     /**
      * Get the YANG list name.
      *
-     * @return YANG list name.
+     * @return YANG list name
      */
     @Override
     public String getName() {
@@ -187,7 +188,7 @@
     /**
      * Set the YANG list name.
      *
-     * @param name YANG list name.
+     * @param name YANG list name
      */
     @Override
     public void setName(String name) {
@@ -206,7 +207,7 @@
     /**
      * Set the config flag.
      *
-     * @param isCfg the config flag.
+     * @param isCfg the config flag
      */
     public void setConfig(boolean isCfg) {
         isConfig = isCfg;
@@ -215,7 +216,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -225,7 +226,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -235,7 +236,7 @@
     /**
      * Get the list of key field names.
      *
-     * @return the list of key field names.
+     * @return the list of key field names
      */
     public List<String> getKeyList() {
         return keyList;
@@ -244,7 +245,7 @@
     /**
      * Set the list of key field names.
      *
-     * @param keyList the list of key field names.
+     * @param keyList the list of key field names
      */
     private void setKeyList(List<String> keyList) {
         this.keyList = keyList;
@@ -254,7 +255,7 @@
      * Add a key field name.
      *
      * @param key key field name.
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     public void addKey(String key) throws DataModelException {
         if (getKeyList() == null) {
@@ -272,7 +273,7 @@
     /**
      * Get the list of leaves.
      *
-     * @return the list of leaves.
+     * @return the list of leaves
      */
     @Override
     public List<YangLeaf> getListOfLeaf() {
@@ -282,7 +283,7 @@
     /**
      * Set the list of leaves.
      *
-     * @param leafsList the list of leaf to set.
+     * @param leafsList the list of leaf to set
      */
     private void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
@@ -291,7 +292,7 @@
     /**
      * Add a leaf.
      *
-     * @param leaf the leaf to be added.
+     * @param leaf the leaf to be added
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
@@ -305,7 +306,7 @@
     /**
      * Get the list of leaf-list.
      *
-     * @return the list of leaf-list.
+     * @return the list of leaf-list
      */
     @Override
     public List<YangLeafList> getListOfLeafList() {
@@ -315,7 +316,7 @@
     /**
      * Set the list of leaf-list.
      *
-     * @param listOfLeafList the list of leaf-list to set.
+     * @param listOfLeafList the list of leaf-list to set
      */
     private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
@@ -324,7 +325,7 @@
     /**
      * Add a leaf-list.
      *
-     * @param leafList the leaf-list to be added.
+     * @param leafList the leaf-list to be added
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
@@ -338,7 +339,7 @@
     /**
      * Get the max elements.
      *
-     * @return the max elements.
+     * @return the max elements
      */
     public int getMaxElelements() {
         return maxElelements;
@@ -347,7 +348,7 @@
     /**
      * Set the max elements.
      *
-     * @param maxElelements the max elements.
+     * @param maxElelements the max elements
      */
     public void setMaxElelements(int maxElelements) {
         this.maxElelements = maxElelements;
@@ -356,7 +357,7 @@
     /**
      * Get the minimum elements.
      *
-     * @return the minimum elements.
+     * @return the minimum elements
      */
     public int getMinElements() {
         return minElements;
@@ -365,7 +366,7 @@
     /**
      * Set the minimum elements.
      *
-     * @param minElements the minimum elements.
+     * @param minElements the minimum elements
      */
     public void setMinElements(int minElements) {
         this.minElements = minElements;
@@ -374,7 +375,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -384,7 +385,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -394,7 +395,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -404,7 +405,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -414,17 +415,17 @@
     /**
      * Returns the type of the parsed data.
      *
-     * @return returns LIST_DATA.
+     * @return returns LIST_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.LIST_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.LIST_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -434,7 +435,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
@@ -464,8 +465,8 @@
      * Sets the config's value to all leaf if leaf's config statement is not
      * specified.
      *
-     * @param leaves list of leaf attributes of YANG list.
-     * @param leafLists list of leaf-list attributes of YANG list.
+     * @param leaves list of leaf attributes of YANG list
+     * @param leafLists list of leaf-list attributes of YANG list
      */
     private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) {
 
@@ -497,9 +498,9 @@
     /**
      * Validates config statement of YANG list.
      *
-     * @param leaves list of leaf attributes of YANG list.
-     * @param leafLists list of leaf-list attributes of YANG list.
-     * @throws DataModelException a violation of data model rules.
+     * @param leaves list of leaf attributes of YANG list
+     * @param leafLists list of leaf-list attributes of YANG list
+     * @throws DataModelException a violation of data model rules
      */
     private void validateConfig(List<YangLeaf> leaves, List<YangLeafList> leafLists) throws DataModelException {
 
@@ -529,9 +530,9 @@
     /**
      * Validates key statement of list.
      *
-     * @param leaves list of leaf attributes of list.
-     * @param keys list of key attributes of list.
-     * @throws DataModelException a violation of data model rules.
+     * @param leaves list of leaf attributes of list
+     * @param keys list of key attributes of list
+     * @throws DataModelException a violation of data model rules
      */
     private void validateLeafKey(List<YangLeaf> leaves, List<String> keys) throws DataModelException {
         boolean leafFound = false;
@@ -574,9 +575,9 @@
     /**
      * Validates key statement of list.
      *
-     * @param leafLists list of leaf-list attributes of list.
-     * @param keys list of key attributes of list.
-     * @throws DataModelException a violation of data model rules.
+     * @param leafLists list of leaf-list attributes of list
+     * @param keys list of key attributes of list
+     * @throws DataModelException a violation of data model rules
      */
     private void validateLeafListKey(List<YangLeafList> leafLists, List<String> keys) throws DataModelException {
         boolean leafFound = false;
@@ -668,4 +669,18 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(identifierName, dataType, this);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+        if (this.getName().equals(identifierName)) {
+            throw new DataModelException("YANG file error: Duplicate input identifier detected, same as list \"" +
+                    this.getName() + "\"");
+        }
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
index 5644d82..e56bdab 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -15,20 +15,21 @@
  */
 package org.onosproject.yangutils.datamodel;
 
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
 import org.onosproject.yangutils.translator.CachedFileHandle;
 import org.onosproject.yangutils.translator.CodeGenerator;
 import org.onosproject.yangutils.translator.GeneratedFileType;
 import org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax;
 import org.onosproject.yangutils.utils.UtilConstants;
+import org.onosproject.yangutils.utils.YangConstructType;
 import org.onosproject.yangutils.utils.io.impl.FileSystemUtil;
 
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+
 /*-
  * Reference:RFC 6020.
  * The "module" statement defines the module's name,
@@ -73,7 +74,7 @@
  * Data model node to maintain information defined in YANG module.
  */
 public class YangModule extends YangNode
-        implements YangLeavesHolder, YangDesc, YangReference, Parsable, CodeGenerator {
+        implements YangLeavesHolder, YangDesc, YangReference, Parsable, CodeGenerator, CollisionDetector {
 
     /**
      * Name of the module.
@@ -588,8 +589,8 @@
      * @return returns MODULE_DATA.
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.MODULE_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.MODULE_DATA;
     }
 
     /**
@@ -697,4 +698,15 @@
         module.addToNestedReferenceResoulutionList(node);
         return;
     }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(identifierName, dataType, this);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+        // Not required as module doesn't have any parent.
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java b/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
index 63430c1..1bb9992 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
@@ -17,7 +17,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*-
  * The "must" statement, which is optional, takes as an argument a string that
@@ -59,7 +59,7 @@
     private String description;
 
     /**
-     * reference string.
+     * Reference string.
      */
     private String reference;
 
@@ -72,7 +72,7 @@
     /**
      * Get the constraint.
      *
-     * @return the constraint.
+     * @return the constraint
      */
     public String getConstratint() {
         return constratint;
@@ -90,7 +90,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -100,7 +100,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -110,7 +110,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -120,7 +120,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -133,14 +133,14 @@
      * @return returns MUST_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.MUST_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.MUST_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -150,7 +150,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java b/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
index 2d79a6f..897552d 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
@@ -18,7 +18,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*
  *  Reference:RFC 6020.
@@ -45,7 +45,7 @@
     /**
      * Get the name space URI.
      *
-     * @return the URI.
+     * @return the URI
      */
     public String getUri() {
         return uri;
@@ -63,17 +63,17 @@
     /**
      * Returns the type of the parsed data.
      *
-     * @return returns NAMESPACE_DATA.
+     * @return returns NAMESPACE_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.NAMESPACE_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.NAMESPACE_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -84,7 +84,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java b/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
index 8989262..083416b 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
@@ -17,7 +17,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*
  *  Reference:RFC 6020.
@@ -86,7 +86,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -96,7 +96,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -106,7 +106,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -116,7 +116,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -126,17 +126,17 @@
     /**
      * Returns the type of the parsed data.
      *
-     * @return returns REVISION_DATA.
+     * @return returns REVISION_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.REVISION_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.REVISION_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -147,7 +147,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
index 467217e..f2e9119 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -15,14 +15,15 @@
  */
 package org.onosproject.yangutils.datamodel;
 
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+import org.onosproject.yangutils.parser.Parsable;
+import org.onosproject.yangutils.translator.CachedFileHandle;
+import org.onosproject.yangutils.utils.YangConstructType;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
-import org.onosproject.yangutils.translator.CachedFileHandle;
-
 /*
  *  Reference RFC 6020.
  *
@@ -74,7 +75,7 @@
  * Data model node to maintain information defined in YANG sub-module.
  */
 public class YangSubModule extends YangNode
-        implements YangLeavesHolder, YangDesc, YangReference, Parsable {
+        implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector {
 
     /**
      * Name of sub module.
@@ -186,7 +187,7 @@
     /**
      * Set the module info.
      *
-     * @param belongsTo module info to set.
+     * @param belongsTo module info to set
      */
     public void setBelongsTo(YangBelongsTo belongsTo) {
         this.belongsTo = belongsTo;
@@ -195,7 +196,7 @@
     /**
      * Get the contact.
      *
-     * @return the contact.
+     * @return the contact
      */
     public String getContact() {
         return contact;
@@ -213,7 +214,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -223,7 +224,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -233,7 +234,7 @@
     /**
      * Get the list of imported modules.
      *
-     * @return the list of imported modules.
+     * @return the list of imported modules
      */
     public List<YangImport> getImportList() {
         return importList;
@@ -242,7 +243,7 @@
     /**
      * prevent setting the import list from outside.
      *
-     * @param importList the import list to set.
+     * @param importList the import list to set
      */
     private void setImportList(List<YangImport> importList) {
         this.importList = importList;
@@ -251,7 +252,7 @@
     /**
      * Add the imported module information to the import list.
      *
-     * @param importedModule module being imported.
+     * @param importedModule module being imported
      */
     public void addImportedInfo(YangImport importedModule) {
 
@@ -267,7 +268,7 @@
     /**
      * Get the list of included sub modules.
      *
-     * @return the included list of sub modules.
+     * @return the included list of sub modules
      */
     public List<YangInclude> getIncludeList() {
         return includeList;
@@ -276,7 +277,7 @@
     /**
      * Set the list of included sub modules.
      *
-     * @param includeList the included list to set.
+     * @param includeList the included list to set
      */
     private void setIncludeList(List<YangInclude> includeList) {
         this.includeList = includeList;
@@ -285,7 +286,7 @@
     /**
      * Add the included sub module information to the include list.
      *
-     * @param includeModule submodule being included.
+     * @param includeModule submodule being included
      */
     public void addIncludedInfo(YangInclude includeModule) {
 
@@ -300,7 +301,7 @@
     /**
      * Get the list of leaves.
      *
-     * @return the list of leaves.
+     * @return the list of leaves
      */
     @Override
     public List<YangLeaf> getListOfLeaf() {
@@ -310,7 +311,7 @@
     /**
      * Set the list of leaves.
      *
-     * @param leafsList the list of leaf to set.
+     * @param leafsList the list of leaf to set
      */
     private void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
@@ -319,7 +320,7 @@
     /**
      * Add a leaf.
      *
-     * @param leaf the leaf to be added.
+     * @param leaf the leaf to be added
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
@@ -333,7 +334,7 @@
     /**
      * Get the list of leaf-list.
      *
-     * @return the list of leaf-list.
+     * @return the list of leaf-list
      */
     @Override
     public List<YangLeafList> getListOfLeafList() {
@@ -343,7 +344,7 @@
     /**
      * Set the list of leaf-list.
      *
-     * @param listOfLeafList the list of leaf-list to set.
+     * @param listOfLeafList the list of leaf-list to set
      */
     private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
@@ -352,7 +353,7 @@
     /**
      * Add a leaf-list.
      *
-     * @param leafList the leaf-list to be added.
+     * @param leafList the leaf-list to be added
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
@@ -366,7 +367,7 @@
     /**
      * Get the sub-modules organization.
      *
-     * @return the organization.
+     * @return the organization
      */
     public String getOrganization() {
         return organization;
@@ -375,7 +376,7 @@
     /**
      * Set the sub-modules organization.
      *
-     * @param org the organization to set.
+     * @param org the organization to set
      */
     public void setOrganization(String org) {
         organization = org;
@@ -384,7 +385,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -394,7 +395,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -404,7 +405,7 @@
     /**
      * Get the revision.
      *
-     * @return the revision.
+     * @return the revision
      */
     public YangRevision getRevision() {
         return revision;
@@ -413,7 +414,7 @@
     /**
      * Set the revision.
      *
-     * @param revision the revision to set.
+     * @param revision the revision to set
      */
     public void setRevision(YangRevision revision) {
         this.revision = revision;
@@ -422,7 +423,7 @@
     /**
      * Get the version.
      *
-     * @return the version.
+     * @return the version
      */
     public byte getVersion() {
         return version;
@@ -431,7 +432,7 @@
     /**
      * Set the version.
      *
-     * @param version the version to set.
+     * @param version the version to set
      */
     public void setVersion(byte version) {
         this.version = version;
@@ -440,17 +441,17 @@
     /**
      * Returns the type of the parsed data.
      *
-     * @return returns SUB_MODULE_DATA.
+     * @return returns SUB_MODULE_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.SUB_MODULE_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.SUB_MODULE_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -460,7 +461,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
@@ -515,4 +516,15 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+        // Asks helper to detect colliding child.
+        detectCollidingChildUtil(identifierName, dataType, this);
+    }
+
+    @Override
+    public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+        // Not required as module doesn't have any parent.
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangType.java b/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
index 723319d..85db895 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
@@ -18,7 +18,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 
 /*
  * Reference:RFC 6020.
@@ -77,7 +77,7 @@
     /**
      * Get the name of data type.
      *
-     * @return the name of data type.
+     * @return the name of data type
      */
     public String getDataTypeName() {
         return dataTypeName;
@@ -95,7 +95,7 @@
     /**
      * Get the type of data.
      *
-     * @return the data type.
+     * @return the data type
      */
     public YangDataTypes getDataType() {
         return dataType;
@@ -104,7 +104,7 @@
     /**
      * Set the type of data.
      *
-     * @param dataType data type.
+     * @param dataType data type
      */
     public void setDataType(YangDataTypes dataType) {
         this.dataType = dataType;
@@ -113,7 +113,7 @@
     /**
      * Get the data type meta data.
      *
-     * @return the data type meta data.
+     * @return the data type meta data
      */
     public T getDataTypeExtendedInfo() {
         return dataTypeExtendedInfo;
@@ -131,17 +131,17 @@
     /**
      * Returns the type of the parsed data.
      *
-     * @return returns TYPE_DATA.
+     * @return returns TYPE_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.TYPE_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.TYPE_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -152,7 +152,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java b/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
index f1250a2..a1abd8b 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
@@ -17,7 +17,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
@@ -103,7 +103,7 @@
     /**
      * Get the default value.
      *
-     * @return the default value.
+     * @return the default value
      */
     public String getDefaultValueInString() {
         return defaultValueInString;
@@ -112,7 +112,7 @@
     /**
      * Set the default value.
      *
-     * @param defaultValueInString the default value.
+     * @param defaultValueInString the default value
      */
     public void setDefaultValueInString(String defaultValueInString) {
         this.defaultValueInString = defaultValueInString;
@@ -121,7 +121,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -131,7 +131,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -141,7 +141,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -151,7 +151,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -161,7 +161,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -171,7 +171,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -181,7 +181,7 @@
     /**
      * Get the derived type.
      *
-     * @return the derived type.
+     * @return the derived type
      */
     public YangType<YangDerivedType> getDerivedType() {
         return derivedType;
@@ -190,7 +190,7 @@
     /**
      * Set the derived type.
      *
-     * @param derivedType the derived type.
+     * @param derivedType the derived type
      */
     public void setDerivedType(YangType<YangDerivedType> derivedType) {
         this.derivedType = derivedType;
@@ -220,14 +220,14 @@
      * @return returns TYPEDEF_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.TYPEDEF_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.TYPEDEF_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -237,7 +237,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
@@ -274,7 +274,7 @@
     /**
      * Get the YANG name of the typedef.
      *
-     * @return YANG name of the typedef.
+     * @return YANG name of the typedef
      */
     @Override
     public String getName() {
@@ -287,7 +287,7 @@
     /**
      * Set YANG name of the typedef.
      *
-     * @param name YANG name of the typedef.
+     * @param name YANG name of the typedef
      */
     @Override
     public void setName(String name) {
@@ -330,7 +330,7 @@
     /**
      * Set the mapped java package.
      *
-     * @param pakg mapped java package.
+     * @param pakg mapped java package
      */
     @Override
     public void setPackage(String pakg) {
@@ -341,7 +341,7 @@
     /**
      * Get the file handle of the cached file used during code generation.
      *
-     * @return cached file handle.
+     * @return cached file handle
      */
     @Override
     public CachedFileHandle getFileHandle() {
@@ -352,7 +352,7 @@
     /**
      * Set the file handle to be used used for code generation.
      *
-     * @param fileHandle cached file handle.
+     * @param fileHandle cached file handle
      */
     @Override
     public void setFileHandle(CachedFileHandle fileHandle) {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java b/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
index 5326764..5e6bee4 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
@@ -17,7 +17,7 @@
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.utils.YangConstructType;
 import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
@@ -90,7 +90,7 @@
     /**
      * Get the name.
      *
-     * @return the name.
+     * @return the name
      */
     public String getRefGroupingName() {
         return name;
@@ -108,7 +108,7 @@
     /**
      * Get the referred group.
      *
-     * @return the referred group.
+     * @return the referred group
      */
     public YangGrouping getRefGroup() {
         return refGroup;
@@ -117,7 +117,7 @@
     /**
      * Set the referred group.
      *
-     * @param refGroup the referred group.
+     * @param refGroup the referred group
      */
     public void setRefGroup(YangGrouping refGroup) {
         this.refGroup = refGroup;
@@ -126,7 +126,7 @@
     /**
      * Get the description.
      *
-     * @return the description.
+     * @return the description
      */
     @Override
     public String getDescription() {
@@ -136,7 +136,7 @@
     /**
      * Set the description.
      *
-     * @param description set the description.
+     * @param description set the description
      */
     @Override
     public void setDescription(String description) {
@@ -146,7 +146,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -156,7 +156,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -166,7 +166,7 @@
     /**
      * Get the status.
      *
-     * @return the status.
+     * @return the status
      */
     @Override
     public YangStatusType getStatus() {
@@ -176,7 +176,7 @@
     /**
      * Set the status.
      *
-     * @param status the status to set.
+     * @param status the status to set
      */
     @Override
     public void setStatus(YangStatusType status) {
@@ -186,17 +186,17 @@
     /**
      * Returns the type of the data.
      *
-     * @return returns USES_DATA.
+     * @return returns USES_DATA
      */
     @Override
-    public ParsableDataType getParsableDataType() {
-        return ParsableDataType.USES_DATA;
+    public YangConstructType getYangConstructType() {
+        return YangConstructType.USES_DATA;
     }
 
     /**
      * Validate the data on entering the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnEntry() throws DataModelException {
@@ -206,7 +206,7 @@
     /**
      * Validate the data on exiting the corresponding parse tree node.
      *
-     * @throws DataModelException a violation of data model rules.
+     * @throws DataModelException a violation of data model rules
      */
     @Override
     public void validateDataOnExit() throws DataModelException {
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java b/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
new file mode 100644
index 0000000..8d94dfe
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/datamodel/utils/DataModelUtils.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.datamodel.utils;
+
+import org.onosproject.yangutils.datamodel.CollisionDetector;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangLeavesHolder;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.utils.YangConstructType;
+
+/**
+ * Utilities for data model tree.
+ */
+public final class DataModelUtils {
+
+    /**
+     * Creates a new data model tree utility.
+     */
+    private DataModelUtils() {
+    }
+
+    /**
+     * Detects the colliding identifier name in a given YANG node and its child.
+     *
+     * @param identifierName name for which collision detection is to be
+     *            checked.
+     * @param dataType type of YANG node asking for detecting collision.
+     * @param node instance of calling node.
+     * @throws DataModelException a violation of data model rules.
+     */
+    public static void detectCollidingChildUtil(String identifierName, YangConstructType dataType, YangNode node)
+            throws DataModelException {
+        if (((YangLeavesHolder) node).getListOfLeaf() != null) {
+            for (YangLeaf leaf : ((YangLeavesHolder) node).getListOfLeaf()) {
+                if (leaf.getLeafName().equals(identifierName)) {
+                    throw new DataModelException("YANG file error: Duplicate input identifier detected, same as leaf \""
+                            + leaf.getLeafName() + "\"");
+                }
+            }
+        }
+        if (((YangLeavesHolder) node).getListOfLeafList() != null) {
+            for (YangLeafList leafList : ((YangLeavesHolder) node).getListOfLeafList()) {
+                if (leafList.getLeafName().equals(identifierName)) {
+                    throw new DataModelException("YANG file error: Duplicate input identifier detected, same as leaf " +
+                            "list \"" + leafList.getLeafName() + "\"");
+                }
+            }
+        }
+        node = node.getChild();
+        while ((node != null)) {
+            if (node instanceof CollisionDetector) {
+                ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
+            }
+            node = node.getNextSibling();
+        }
+    }
+}
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/utils/package-info.java b/src/main/java/org/onosproject/yangutils/datamodel/utils/package-info.java
new file mode 100644
index 0000000..c37ed45
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/datamodel/utils/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Utilities for checking data model tree collisions.
+ */
+package org.onosproject.yangutils.datamodel.utils;
\ No newline at end of file