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;
12 import java.util.Date;
13 import java.util.List;
15 import org.opendaylight.controller.yang.common.QName;
16 import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
17 import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefinition;
20 * Implementation of Yang uint64 built-in type. <br>
21 * uint64 represents integer values between 0 and 18446744073709551615,
22 * inclusively. The Java counterpart of Yang uint64 built-in type is
26 public class Uint64 extends AbstractUnsignedInteger {
28 private static final QName name = BaseTypes.constructQName("uint64");
30 private BigInteger defaultValue = null;
31 private static final String description =
32 "uint64 represents integer values between 0 and 18446744073709551615, inclusively.";
33 private final UnsignedIntegerTypeDefinition baseType;
36 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
40 public Uint64(final List<String> actualPath,
41 final URI namespace, final Date revision) {
42 super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
43 this.baseType = new Uint64();
46 public Uint64(final List<String> actualPath,
47 final URI namespace, final Date revision, final BigInteger defaultValue) {
48 super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
49 this.baseType = new Uint64();
50 this.defaultValue = defaultValue;
53 public Uint64(final List<String> actualPath,
54 final URI namespace, final Date revision, final List<RangeConstraint> rangeStatements,
55 final String units, final BigInteger defaultValue) {
56 super(actualPath, namespace, revision, name, description, rangeStatements, units);
57 this.baseType = new Uint64();
58 this.defaultValue = defaultValue;
65 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
68 public UnsignedIntegerTypeDefinition getBaseType() {
76 * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
80 public Object getDefaultValue() {
85 public int hashCode() {
87 int result = super.hashCode();
88 result = prime * result
89 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
94 public boolean equals(Object obj) {
98 if (!super.equals(obj)) {
101 if (getClass() != obj.getClass()) {
104 Uint64 other = (Uint64) obj;
105 if (defaultValue == null) {
106 if (other.defaultValue != null) {
109 } else if (!defaultValue.equals(other.defaultValue)) {
116 public String toString() {
117 StringBuilder builder = new StringBuilder();
118 builder.append("Uint64 [defaultValue=");
119 builder.append(defaultValue);
120 builder.append(", AbstractInteger=");
121 builder.append(super.toString());
123 return builder.toString();