2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\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
8 package org.opendaylight.controller.model.util;
\r
10 import java.math.BigInteger;
\r
11 import java.util.List;
\r
13 import org.opendaylight.controller.model.api.type.RangeConstraint;
\r
14 import org.opendaylight.controller.model.api.type.UnsignedIntegerTypeDefinition;
\r
15 import org.opendaylight.controller.yang.common.QName;
\r
18 * Implementation of Yang uint64 built-in type. <br>
\r
19 * uint64 represents integer values between 0 and 18446744073709551615,
\r
20 * inclusively. The Java counterpart of Yang uint64 built-in type is
\r
21 * {@link BigInteger}.
\r
24 public class Uint64 extends AbstractUnsignedInteger {
\r
26 private static final QName name = BaseTypes.constructQName("uint32");
\r
27 private BigInteger defaultValue = null;
\r
28 private static final String description =
\r
29 "uint64 represents integer values between 0 and 18446744073709551615, inclusively.";
\r
32 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
\r
35 public Uint64(final BigInteger defaultValue) {
\r
36 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
\r
37 this.defaultValue = defaultValue;
\r
40 public Uint64(final List<RangeConstraint> rangeStatements,
\r
41 final String units, final BigInteger defaultValue) {
\r
42 super(name, description, rangeStatements, units);
\r
43 this.defaultValue = defaultValue;
\r
50 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
\r
53 public UnsignedIntegerTypeDefinition getBaseType() {
\r
61 * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
\r
65 public Object getDefaultValue() {
\r
66 return defaultValue;
\r
70 public int hashCode() {
\r
71 final int prime = 31;
\r
72 int result = super.hashCode();
\r
73 result = prime * result
\r
74 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
\r
79 public boolean equals(Object obj) {
\r
83 if (!super.equals(obj)) {
\r
86 if (getClass() != obj.getClass()) {
\r
89 Uint64 other = (Uint64) obj;
\r
90 if (defaultValue == null) {
\r
91 if (other.defaultValue != null) {
\r
94 } else if (!defaultValue.equals(other.defaultValue)) {
\r
101 public String toString() {
\r
102 StringBuilder builder = new StringBuilder();
\r
103 builder.append("Uint64 [defaultValue=");
\r
104 builder.append(defaultValue);
\r
105 builder.append(", AbstractInteger=");
\r
106 builder.append(super.toString());
\r
107 builder.append("]");
\r
108 return builder.toString();
\r