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