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 / Uint64.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.yang.model.util;
9
10 import java.math.BigInteger;
11 import java.util.List;
12
13 import org.opendaylight.controller.yang.common.QName;
14 import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
15 import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefinition;
16
17 /**
18  * Implementation of Yang uint64 built-in type. <br>
19  * uint64 represents integer values between 0 and 18446744073709551615,
20  * inclusively. The Java counterpart of Yang uint64 built-in type is
21  * {@link BigInteger}.
22  * 
23  */
24 public class Uint64 extends AbstractUnsignedInteger {
25
26     private static final QName name = BaseTypes.constructQName("uint64");
27     private BigInteger defaultValue = null;
28     private static final String description = 
29             "uint64 represents integer values between 0 and 18446744073709551615, inclusively.";
30
31     public Uint64() {
32         super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
33     }
34
35     public Uint64(final BigInteger defaultValue) {
36         super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
37         this.defaultValue = defaultValue;
38     }
39
40     public Uint64(final List<RangeConstraint> rangeStatements,
41             final String units, final BigInteger defaultValue) {
42         super(name, description, rangeStatements, units);
43         this.defaultValue = defaultValue;
44     }
45
46     /*
47      * (non-Javadoc)
48      * 
49      * @see
50      * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
51      */
52     @Override
53     public UnsignedIntegerTypeDefinition getBaseType() {
54         return this;
55     }
56
57     /*
58      * (non-Javadoc)
59      * 
60      * @see
61      * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
62      * ()
63      */
64     @Override
65     public Object getDefaultValue() {
66         return defaultValue;
67     }
68
69     @Override
70     public int hashCode() {
71         final int prime = 31;
72         int result = super.hashCode();
73         result = prime * result
74                 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
75         return result;
76     }
77
78     @Override
79     public boolean equals(Object obj) {
80         if (this == obj) {
81             return true;
82         }
83         if (!super.equals(obj)) {
84             return false;
85         }
86         if (getClass() != obj.getClass()) {
87             return false;
88         }
89         Uint64 other = (Uint64) obj;
90         if (defaultValue == null) {
91             if (other.defaultValue != null) {
92                 return false;
93             }
94         } else if (!defaultValue.equals(other.defaultValue)) {
95             return false;
96         }
97         return true;
98     }
99
100     @Override
101     public String toString() {
102         StringBuilder builder = new StringBuilder();
103         builder.append("Uint64 [defaultValue=");
104         builder.append(defaultValue);
105         builder.append(", AbstractInteger=");
106         builder.append(super.toString());
107         builder.append("]");
108         return builder.toString();
109     }
110 }