Added more tests for yang parser. Updated current tests.
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / EnumerationType.java
index c825390f38d98415c8fab8250a27f213816edbbc..de7ee3060347df9337479de99db162c554da0bf8 100644 (file)
@@ -7,9 +7,7 @@
   */
 package org.opendaylight.controller.yang.model.util;
 
-import java.net.URI;
 import java.util.Collections;
-import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -20,11 +18,10 @@ import org.opendaylight.controller.yang.model.api.type.EnumTypeDefinition;
 
 /**
  * The <code>default</code> implementation of Enumertaion Type Definition interface.
- * 
+ *
  * @see EnumTypeDefinition
  */
-public class EnumerationType implements EnumTypeDefinition {
-
+public final class EnumerationType implements EnumTypeDefinition {
     private final QName name = BaseTypes.constructQName("enumeration");
     private final SchemaPath path;
     private final String description = "The enumeration built-in type represents values from a set of assigned names.";
@@ -32,39 +29,29 @@ public class EnumerationType implements EnumTypeDefinition {
 
     private final EnumPair defaultEnum;
     private final List<EnumPair> enums;
-    private String units = "";
+    private final String units = "";
     private final EnumTypeDefinition baseType;
-    
-    private EnumerationType(final List<EnumPair> enums) {
-        this.path = BaseTypes.schemaPath(name);
-        this.enums = Collections.unmodifiableList(enums);
-        this.defaultEnum = null;
-        baseType = this;
-    }
-    
-    public EnumerationType(final List<String> actualPath, final URI namespace,
-            final Date revision, final List<EnumPair> enums) {
+
+    public EnumerationType(final SchemaPath path, final List<EnumPair> enums) {
         super();
-        this.path = BaseTypes.schemaPath(actualPath, namespace, revision);
+        this.path = path;
         this.enums = Collections.unmodifiableList(enums);
         this.defaultEnum = null;
-        baseType = new EnumerationType(enums);
+        this.baseType = this;
     }
 
-    public EnumerationType(final List<String> actualPath, final URI namespace,
-            final Date revision, final EnumTypeDefinition baseType, final EnumPair defaultEnum,
-            final List<EnumPair> enums, final String units) {
+    public EnumerationType(final SchemaPath path, final EnumPair defaultEnum,
+            final List<EnumPair> enums) {
         super();
-        this.path = BaseTypes.schemaPath(actualPath, namespace, revision);
-        this.baseType = baseType;
+        this.path = path;
+        this.baseType = this;
         this.defaultEnum = defaultEnum;
         this.enums = Collections.unmodifiableList(enums);
-        this.units = units;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
      */
     @Override
@@ -74,7 +61,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()
      */
     @Override
@@ -84,7 +71,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
      */
     @Override
@@ -94,7 +81,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()
      */
     @Override
@@ -104,7 +91,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()
      */
     @Override
@@ -114,7 +101,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
      */
     @Override
@@ -124,7 +111,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()
      */
     @Override
@@ -134,7 +121,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()
      */
     @Override
@@ -144,7 +131,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.base.type.api.EnumTypeDefinition#getValues()
      */
     @Override