Fixed bugs in naming conventions of packages.
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / Decimal64.java
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.model.util;\r
-\r
-import java.math.BigDecimal;\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import org.opendaylight.controller.model.api.type.DecimalTypeDefinition;\r
-import org.opendaylight.controller.model.api.type.RangeConstraint;\r
-import org.opendaylight.controller.yang.common.QName;\r
-import org.opendaylight.controller.yang.model.api.SchemaPath;\r
-import org.opendaylight.controller.yang.model.api.Status;\r
-import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
-\r
-/**\r
- * The <code>default</code> implementation of Decimal Type Definition interface.\r
- * \r
- * \r
- * @see DecimalTypeDefinition\r
- */\r
-public class Decimal64 implements DecimalTypeDefinition {\r
-\r
-    private final QName name = BaseTypes.constructQName("decimal64");\r
-    private final SchemaPath path;\r
-    private String units = "";\r
-    private BigDecimal defaultValue = null;\r
-\r
-    private final String description = "The decimal64 type represents a subset of the real numbers, which can "\r
-            + "be represented by decimal numerals. The value space of decimal64 is the set of numbers that can "\r
-            + "be obtained by multiplying a 64-bit signed integer by a negative power of ten, i.e., expressible as "\r
-            + "'i x 10^-n' where i is an integer64 and n is an integer between 1 and 18, inclusively.";\r
-\r
-    private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.3";\r
-\r
-    private final List<RangeConstraint> rangeStatements;\r
-    private final Integer fractionDigits;\r
-\r
-    /**\r
-     * Default Decimal64 Type Constructor. <br>\r
-     * <br>\r
-     * The initial range statements are set to Decimal64\r
-     * <code>min=-922337203685477580.8</code> and\r
-     * <code>max=922337203685477580.7</code> <br>\r
-     * The fractions digits MUST be defined as integer between 1 and 18\r
-     * inclusively as defined interface {@link DecimalTypeDefinition} <br>\r
-     * If the fraction digits are not defined inner the definition boundaries\r
-     * the constructor will throw {@link IllegalArgumentException}\r
-     * \r
-     * @param fractionDigits\r
-     *            integer between 1 and 18 inclusively\r
-     * \r
-     * @see DecimalTypeDefinition\r
-     * @exception IllegalArgumentException\r
-     */\r
-    public Decimal64(final Integer fractionDigits) {\r
-        super();\r
-        if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {\r
-            throw new IllegalArgumentException(\r
-                    "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");\r
-        }\r
-        this.fractionDigits = fractionDigits;\r
-        rangeStatements = defaultRangeStatements();\r
-        this.path = BaseTypes.schemaPath(name);\r
-    }\r
-\r
-    /**\r
-     * Decimal64 Type Constructor. <br>\r
-     * \r
-     * If parameter <code>Range Statements</code> is <code>null</code> or\r
-     * defined as <code>empty List</code> the constructor automatically assigns\r
-     * the boundaries as min and max value defined for Decimal64 in <a\r
-     * href="https://tools.ietf.org/html/rfc6020#section-9.3">[RFC-6020] The\r
-     * decimal64 Built-In Type</a> <br>\r
-     * <br>\r
-     * The fractions digits MUST be defined as integer between 1 and 18\r
-     * inclusively as defined interface {@link DecimalTypeDefinition} <br>\r
-     * If the fraction digits are not defined inner the definition boundaries\r
-     * the constructor will throw {@link IllegalArgumentException}\r
-     * \r
-     * @param rangeStatements\r
-     *            Range Constraint Statements\r
-     * @param fractionDigits\r
-     *            integer between 1 and 18 inclusively\r
-     * @exception IllegalArgumentException\r
-     */\r
-    public Decimal64(final List<RangeConstraint> rangeStatements,\r
-            Integer fractionDigits) {\r
-        super();\r
-        if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {\r
-            throw new IllegalArgumentException(\r
-                    "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");\r
-        }\r
-        if (rangeStatements == null || rangeStatements.isEmpty()) {\r
-            this.rangeStatements = defaultRangeStatements();\r
-        } else {\r
-            this.rangeStatements = Collections.unmodifiableList(rangeStatements);\r
-        }\r
-        this.fractionDigits = fractionDigits;\r
-        this.path = BaseTypes.schemaPath(name);\r
-    }\r
-\r
-    /**\r
-     * Decimal64 Type Constructor. <br>\r
-     * If parameter <code>Range Statements</code> is <code>null</code> or\r
-     * defined as <code>empty List</code> the constructor automatically assigns\r
-     * the boundaries as min and max value defined for Decimal64 in <a\r
-     * href="https://tools.ietf.org/html/rfc6020#section-9.3">[RFC-6020] The\r
-     * decimal64 Built-In Type</a> <br>\r
-     * <br>\r
-     * The fractions digits MUST be defined as integer between 1 and 18\r
-     * inclusively as defined interface {@link DecimalTypeDefinition} <br>\r
-     * If the fraction digits are not defined inner the definition boundaries\r
-     * the constructor will throw {@link IllegalArgumentException}\r
-     * \r
-     * @param units\r
-     *            units associated with the type\r
-     * @param defaultValue\r
-     *            Default Value for type\r
-     * @param rangeStatements\r
-     *            Range Constraint Statements\r
-     * @param fractionDigits\r
-     *            integer between 1 and 18 inclusively\r
-     * \r
-     * @exception IllegalArgumentException\r
-     */\r
-    public Decimal64(final String units, final BigDecimal defaultValue,\r
-            final List<RangeConstraint> rangeStatements,\r
-            final Integer fractionDigits) {\r
-        super();\r
-        if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {\r
-            throw new IllegalArgumentException(\r
-                    "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");\r
-        }\r
-\r
-        if (rangeStatements == null || rangeStatements.isEmpty()) {\r
-            this.rangeStatements = defaultRangeStatements();\r
-            \r
-        } else {\r
-            this.rangeStatements = Collections.unmodifiableList(rangeStatements);\r
-        }\r
-        this.units = units;\r
-        this.defaultValue = defaultValue;\r
-        this.fractionDigits = fractionDigits;\r
-        this.path = BaseTypes.schemaPath(name);\r
-    }\r
-\r
-    /**\r
-     * Returns unmodifiable List with default definition of Range Statements.\r
-     * \r
-     * @return unmodifiable List with default definition of Range Statements.\r
-     */\r
-    private List<RangeConstraint> defaultRangeStatements() {\r
-        final List<RangeConstraint> rangeStatements = new ArrayList<RangeConstraint>();\r
-        final BigDecimal min = new BigDecimal("-922337203685477580.8");\r
-        final BigDecimal max = new BigDecimal("922337203685477580.7");\r
-        final String rangeDescription = "Integer values between " + min\r
-                + " and " + max + ", inclusively.";\r
-        rangeStatements.add(BaseConstraints.rangeConstraint(min, max,\r
-                rangeDescription,\r
-                "https://tools.ietf.org/html/rfc6020#section-9.2.4"));\r
-        return Collections.unmodifiableList(rangeStatements);\r
-    }\r
-\r
-    @Override\r
-    public DecimalTypeDefinition getBaseType() {\r
-        return this;\r
-    }\r
-\r
-    @Override\r
-    public String getUnits() {\r
-        return units;\r
-    }\r
-\r
-    @Override\r
-    public Object getDefaultValue() {\r
-        return defaultValue;\r
-    }\r
-\r
-    @Override\r
-    public QName getQName() {\r
-        return name;\r
-    }\r
-\r
-    @Override\r
-    public SchemaPath getPath() {\r
-        return path;\r
-    }\r
-\r
-    @Override\r
-    public String getDescription() {\r
-        return description;\r
-    }\r
-\r
-    @Override\r
-    public String getReference() {\r
-        return reference;\r
-    }\r
-\r
-    @Override\r
-    public Status getStatus() {\r
-        return Status.CURRENT;\r
-    }\r
-\r
-    @Override\r
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {\r
-        return Collections.emptyList();\r
-    }\r
-\r
-    @Override\r
-    public List<RangeConstraint> getRangeStatements() {\r
-        return rangeStatements;\r
-    }\r
-\r
-    @Override\r
-    public Integer getFractionDigits() {\r
-        return fractionDigits;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = 1;\r
-        result = prime * result + ((name == null) ? 0 : name.hashCode());\r
-        result = prime * result + ((path == null) ? 0 : path.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (obj == null) {\r
-            return false;\r
-        }\r
-        if (getClass() != obj.getClass()) {\r
-            return false;\r
-        }\r
-        Decimal64 other = (Decimal64) obj;\r
-        if (name == null) {\r
-            if (other.name != null) {\r
-                return false;\r
-            }\r
-        } else if (!name.equals(other.name)) {\r
-            return false;\r
-        }\r
-        if (path == null) {\r
-            if (other.path != null) {\r
-                return false;\r
-            }\r
-        } else if (!path.equals(other.path)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return Decimal64.class.getSimpleName() + "[qname=" + name\r
-                + ", fractionDigits=" + fractionDigits + "]";\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.yang.model.util;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.opendaylight.controller.yang.common.QName;
+import org.opendaylight.controller.yang.model.api.SchemaPath;
+import org.opendaylight.controller.yang.model.api.Status;
+import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.controller.yang.model.api.type.DecimalTypeDefinition;
+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 {
+
+    private final QName name = BaseTypes.constructQName("decimal64");
+    private final SchemaPath path;
+    private String units = "";
+    private 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 "
+            + "be obtained by multiplying a 64-bit signed integer by a negative power of ten, i.e., expressible as "
+            + "'i x 10^-n' where i is an integer64 and n is an integer between 1 and 18, inclusively.";
+
+    private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.3";
+
+    private final List<RangeConstraint> rangeStatements;
+    private final Integer fractionDigits;
+
+    /**
+     * Default Decimal64 Type Constructor. <br>
+     * <br>
+     * The initial range statements are set to Decimal64
+     * <code>min=-922337203685477580.8</code> and
+     * <code>max=922337203685477580.7</code> <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 fractionDigits
+     *            integer between 1 and 18 inclusively
+     * 
+     * @see DecimalTypeDefinition
+     * @exception IllegalArgumentException
+     */
+    public Decimal64(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");
+        }
+        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);
+    }
+
+    /**
+     * Returns unmodifiable List with default definition of Range Statements.
+     * 
+     * @return unmodifiable List with default definition of Range Statements.
+     */
+    private List<RangeConstraint> defaultRangeStatements() {
+        final List<RangeConstraint> rangeStatements = new ArrayList<RangeConstraint>();
+        final BigDecimal min = new BigDecimal("-922337203685477580.8");
+        final BigDecimal max = new BigDecimal("922337203685477580.7");
+        final String rangeDescription = "Integer values between " + min
+                + " and " + max + ", inclusively.";
+        rangeStatements.add(BaseConstraints.rangeConstraint(min, max,
+                rangeDescription,
+                "https://tools.ietf.org/html/rfc6020#section-9.2.4"));
+        return Collections.unmodifiableList(rangeStatements);
+    }
+
+    @Override
+    public DecimalTypeDefinition getBaseType() {
+        return this;
+    }
+
+    @Override
+    public String getUnits() {
+        return units;
+    }
+
+    @Override
+    public Object getDefaultValue() {
+        return defaultValue;
+    }
+
+    @Override
+    public QName getQName() {
+        return name;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    @Override
+    public Status getStatus() {
+        return Status.CURRENT;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public List<RangeConstraint> getRangeStatements() {
+        return rangeStatements;
+    }
+
+    @Override
+    public Integer getFractionDigits() {
+        return fractionDigits;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        Decimal64 other = (Decimal64) obj;
+        if (name == null) {
+            if (other.name != null) {
+                return false;
+            }
+        } else if (!name.equals(other.name)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return Decimal64.class.getSimpleName() + "[qname=" + name
+                + ", fractionDigits=" + fractionDigits + "]";
+    }
+}