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 / Uint32.java
index 75f9b49693e41ad01015156b31836334c02e330f..2a06a603e88c0a559a4d90a0470a282831d83005 100644 (file)
@@ -7,42 +7,25 @@
  */
 package org.opendaylight.controller.yang.model.util;
 
-import java.net.URI;
-import java.util.Date;
-import java.util.List;
-
 import org.opendaylight.controller.yang.common.QName;
-import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
+import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefinition;
 
 /**
  * Implementation of Yang uint32 built-in type. <br>
- * uint32 represents integer values between 0 and 4294967295, inclusively. The
- * Java counterpart of Yang uint32 built-in type is {@link Long}.
+ * uint32 represents integer values between 0 and 4294967295, inclusively.
  *
  */
-public class Uint32 extends AbstractUnsignedInteger {
-
+public final class Uint32 extends AbstractUnsignedInteger {
+    public static final long MAX_VALUE = 4294967295L;
     private static final QName name = BaseTypes.constructQName("uint32");
-    private Long defaultValue = null;
+    private final Long defaultValue = null;
     private static final String description = "uint32 represents integer values between 0 and 4294967295, inclusively.";
+    private final UnsignedIntegerTypeDefinition baseType;
 
-    public Uint32(final List<String> actualPath,
-            final URI namespace, final Date revision) {
-        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
-    }
-
-    public Uint32(final List<String> actualPath,
-            final URI namespace, final Date revision, final Long defaultValue) {
-        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
-        this.defaultValue = defaultValue;
-    }
-
-    public Uint32(final List<String> actualPath,
-            final URI namespace, final Date revision, final List<RangeConstraint> rangeStatements,
-            final String units, final Long defaultValue) {
-        super(actualPath, namespace, revision, name, description, rangeStatements, units);
-        this.defaultValue = defaultValue;
+    public Uint32(final SchemaPath path) {
+        super(path, name, description, MAX_VALUE, "");
+        this.baseType = this;
     }
 
     /*
@@ -53,7 +36,7 @@ public class Uint32 extends AbstractUnsignedInteger {
      */
     @Override
     public UnsignedIntegerTypeDefinition getBaseType() {
-        return this;
+        return baseType;
     }
 
     /*
@@ -72,8 +55,7 @@ public class Uint32 extends AbstractUnsignedInteger {
     public int hashCode() {
         final int prime = 31;
         int result = super.hashCode();
-        result = prime * result
-                + ((defaultValue == null) ? 0 : defaultValue.hashCode());
+        result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode());
         return result;
     }
 
@@ -109,4 +91,5 @@ public class Uint32 extends AbstractUnsignedInteger {
         builder.append("]");
         return builder.toString();
     }
+
 }