2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.yang.model.util;
10 import java.math.BigInteger;
11 import java.util.List;
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;
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
24 public class Uint64 extends AbstractUnsignedInteger {
26 private static final QName name = BaseTypes.constructQName("uint64");
28 private BigInteger defaultValue = null;
29 private static final String description =
30 "uint64 represents integer values between 0 and 18446744073709551615, inclusively.";
33 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
36 public Uint64(final BigInteger defaultValue) {
37 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
38 this.defaultValue = defaultValue;
41 public Uint64(final List<RangeConstraint> rangeStatements,
42 final String units, final BigInteger defaultValue) {
43 super(name, description, rangeStatements, units);
44 this.defaultValue = defaultValue;
51 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
54 public UnsignedIntegerTypeDefinition getBaseType() {
62 * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
66 public Object getDefaultValue() {
71 public int hashCode() {
73 int result = super.hashCode();
74 result = prime * result
75 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
80 public boolean equals(Object obj) {
84 if (!super.equals(obj)) {
87 if (getClass() != obj.getClass()) {
90 Uint64 other = (Uint64) obj;
91 if (defaultValue == null) {
92 if (other.defaultValue != null) {
95 } else if (!defaultValue.equals(other.defaultValue)) {
102 public String toString() {
103 StringBuilder builder = new StringBuilder();
104 builder.append("Uint64 [defaultValue=");
105 builder.append(defaultValue);
106 builder.append(", AbstractInteger=");
107 builder.append(super.toString());
109 return builder.toString();