A race condition occurs between ARPHandler and HostTracker if the ARP
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / EnumerationType.java
index 696ec4f39e255277bf2c1ca055b972618b640cc0..de7ee3060347df9337479de99db162c554da0bf8 100644 (file)
@@ -18,47 +18,50 @@ 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 = BaseTypes.schemaPath(name);
+    private final SchemaPath path;
     private final String description = "The enumeration built-in type represents values from a set of assigned names.";
     private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.6";
 
-    private final List<EnumPair> defaultEnum;
+    private final EnumPair defaultEnum;
     private final List<EnumPair> enums;
-    private String units = "";
+    private final String units = "";
+    private final EnumTypeDefinition baseType;
 
-    public EnumerationType(final List<EnumPair> enums) {
+    public EnumerationType(final SchemaPath path, final List<EnumPair> enums) {
         super();
+        this.path = path;
         this.enums = Collections.unmodifiableList(enums);
-        defaultEnum = Collections.emptyList();
+        this.defaultEnum = null;
+        this.baseType = this;
     }
 
-    public EnumerationType(final List<EnumPair> defaultEnum,
-            final List<EnumPair> enums, final String units) {
+    public EnumerationType(final SchemaPath path, final EnumPair defaultEnum,
+            final List<EnumPair> enums) {
         super();
-        this.defaultEnum = Collections.unmodifiableList(defaultEnum);
+        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
     public EnumTypeDefinition getBaseType() {
-        return this;
+        return baseType;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()
      */
     @Override
@@ -68,7 +71,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
      */
     @Override
@@ -78,7 +81,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()
      */
     @Override
@@ -88,7 +91,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()
      */
     @Override
@@ -98,7 +101,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
      */
     @Override
@@ -108,7 +111,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()
      */
     @Override
@@ -118,7 +121,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()
      */
     @Override
@@ -128,7 +131,7 @@ public class EnumerationType implements EnumTypeDefinition {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.base.type.api.EnumTypeDefinition#getValues()
      */
     @Override