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 / Int64.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.util.List;
11
12 import org.opendaylight.controller.yang.common.QName;
13 import org.opendaylight.controller.yang.model.api.type.IntegerTypeDefinition;
14 import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
15
16 /**
17  * Implementation of Yang int64 built-in type. <br>
18  * int64  represents integer values between -9223372036854775808 and 9223372036854775807, inclusively. 
19  * The Java counterpart of Yang int64 built-in type is
20  * {@link Long}.
21  *
22  */
23 public class Int64 extends AbstractSignedInteger {
24
25     private static final QName name = BaseTypes.constructQName("int64");
26     private Long defaultValue = null;
27     private static final String description = 
28             "int64  represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.";
29
30     public Int64() {
31         super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
32     }
33
34     public Int64(final Long defaultValue) {
35         super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
36         this.defaultValue = defaultValue;
37     }
38
39     public Int64(final List<RangeConstraint> rangeStatements,
40             final String units, final Long defaultValue) {
41         super(name, description, rangeStatements, units);
42         this.defaultValue = defaultValue;
43     }
44
45     /*
46      * (non-Javadoc)
47      * 
48      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
49      */
50     @Override
51     public IntegerTypeDefinition getBaseType() {
52         return this;
53     }
54
55     /*
56      * (non-Javadoc)
57      * 
58      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
59      */
60     @Override
61     public Object getDefaultValue() {
62         return defaultValue;
63     }
64
65     @Override
66     public int hashCode() {
67         final int prime = 31;
68         int result = super.hashCode();
69         result = prime * result
70                 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
71         return result;
72     }
73
74     @Override
75     public boolean equals(Object obj) {
76         if (this == obj) {
77             return true;
78         }
79         if (!super.equals(obj)) {
80             return false;
81         }
82         if (getClass() != obj.getClass()) {
83             return false;
84         }
85         Int64 other = (Int64) obj;
86         if (defaultValue == null) {
87             if (other.defaultValue != null) {
88                 return false;
89             }
90         } else if (!defaultValue.equals(other.defaultValue)) {
91             return false;
92         }
93         return true;
94     }
95
96     @Override
97     public String toString() {
98         StringBuilder builder = new StringBuilder();
99         builder.append("Int64 [defaultValue=");
100         builder.append(defaultValue);
101         builder.append(", AbstractInteger=");
102         builder.append(super.toString());
103         builder.append("]");
104         return builder.toString();
105     }
106 }