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 / Decimal64.java
index a1073c60cf598d768d3cfd488896d81f0bb82ed2..1387da9b1cf5ead763a14d21b8b3d784ecc6ceb5 100644 (file)
@@ -21,16 +21,15 @@ import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
 
 /**
  * The <code>default</code> implementation of Decimal Type Definition interface.
- * 
- * 
+ *
+ *
  * @see DecimalTypeDefinition
  */
-public class Decimal64 implements DecimalTypeDefinition {
-
+public final class Decimal64 implements DecimalTypeDefinition {
     private final QName name = BaseTypes.constructQName("decimal64");
     private final SchemaPath path;
-    private String units = "";
-    private BigDecimal defaultValue = null;
+    private final String units = "";
+    private final BigDecimal defaultValue = null;
 
     private final String description = "The decimal64 type represents a subset of the real numbers, which can "
             + "be represented by decimal numerals. The value space of decimal64 is the set of numbers that can "
@@ -41,6 +40,7 @@ public class Decimal64 implements DecimalTypeDefinition {
 
     private final List<RangeConstraint> rangeStatements;
     private final Integer fractionDigits;
+    private final DecimalTypeDefinition baseType;
 
     /**
      * Default Decimal64 Type Constructor. <br>
@@ -52,108 +52,28 @@ public class Decimal64 implements DecimalTypeDefinition {
      * inclusively as defined interface {@link DecimalTypeDefinition} <br>
      * If the fraction digits are not defined inner the definition boundaries
      * the constructor will throw {@link IllegalArgumentException}
-     * 
+     *
+     * @param path
      * @param fractionDigits
      *            integer between 1 and 18 inclusively
-     * 
+     *
      * @see DecimalTypeDefinition
      * @exception IllegalArgumentException
      */
-    public Decimal64(final Integer fractionDigits) {
-        super();
+    public Decimal64(final SchemaPath path, final Integer fractionDigits) {
         if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {
             throw new IllegalArgumentException(
                     "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");
         }
         this.fractionDigits = fractionDigits;
         rangeStatements = defaultRangeStatements();
-        this.path = BaseTypes.schemaPath(name);
-    }
-
-    /**
-     * Decimal64 Type Constructor. <br>
-     * 
-     * If parameter <code>Range Statements</code> is <code>null</code> or
-     * defined as <code>empty List</code> the constructor automatically assigns
-     * the boundaries as min and max value defined for Decimal64 in <a
-     * href="https://tools.ietf.org/html/rfc6020#section-9.3">[RFC-6020] The
-     * decimal64 Built-In Type</a> <br>
-     * <br>
-     * The fractions digits MUST be defined as integer between 1 and 18
-     * inclusively as defined interface {@link DecimalTypeDefinition} <br>
-     * If the fraction digits are not defined inner the definition boundaries
-     * the constructor will throw {@link IllegalArgumentException}
-     * 
-     * @param rangeStatements
-     *            Range Constraint Statements
-     * @param fractionDigits
-     *            integer between 1 and 18 inclusively
-     * @exception IllegalArgumentException
-     */
-    public Decimal64(final List<RangeConstraint> rangeStatements,
-            Integer fractionDigits) {
-        super();
-        if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {
-            throw new IllegalArgumentException(
-                    "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");
-        }
-        if (rangeStatements == null || rangeStatements.isEmpty()) {
-            this.rangeStatements = defaultRangeStatements();
-        } else {
-            this.rangeStatements = Collections.unmodifiableList(rangeStatements);
-        }
-        this.fractionDigits = fractionDigits;
-        this.path = BaseTypes.schemaPath(name);
-    }
-
-    /**
-     * Decimal64 Type Constructor. <br>
-     * If parameter <code>Range Statements</code> is <code>null</code> or
-     * defined as <code>empty List</code> the constructor automatically assigns
-     * the boundaries as min and max value defined for Decimal64 in <a
-     * href="https://tools.ietf.org/html/rfc6020#section-9.3">[RFC-6020] The
-     * decimal64 Built-In Type</a> <br>
-     * <br>
-     * The fractions digits MUST be defined as integer between 1 and 18
-     * inclusively as defined interface {@link DecimalTypeDefinition} <br>
-     * If the fraction digits are not defined inner the definition boundaries
-     * the constructor will throw {@link IllegalArgumentException}
-     * 
-     * @param units
-     *            units associated with the type
-     * @param defaultValue
-     *            Default Value for type
-     * @param rangeStatements
-     *            Range Constraint Statements
-     * @param fractionDigits
-     *            integer between 1 and 18 inclusively
-     * 
-     * @exception IllegalArgumentException
-     */
-    public Decimal64(final String units, final BigDecimal defaultValue,
-            final List<RangeConstraint> rangeStatements,
-            final Integer fractionDigits) {
-        super();
-        if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {
-            throw new IllegalArgumentException(
-                    "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");
-        }
-
-        if (rangeStatements == null || rangeStatements.isEmpty()) {
-            this.rangeStatements = defaultRangeStatements();
-            
-        } else {
-            this.rangeStatements = Collections.unmodifiableList(rangeStatements);
-        }
-        this.units = units;
-        this.defaultValue = defaultValue;
-        this.fractionDigits = fractionDigits;
-        this.path = BaseTypes.schemaPath(name);
+        this.path = path;
+        this.baseType = this;
     }
 
     /**
      * Returns unmodifiable List with default definition of Range Statements.
-     * 
+     *
      * @return unmodifiable List with default definition of Range Statements.
      */
     private List<RangeConstraint> defaultRangeStatements() {
@@ -170,7 +90,7 @@ public class Decimal64 implements DecimalTypeDefinition {
 
     @Override
     public DecimalTypeDefinition getBaseType() {
-        return this;
+        return baseType;
     }
 
     @Override