Fix minor bug in FRM proactive flow code path
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / Int16.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 org.opendaylight.controller.yang.common.QName;
11 import org.opendaylight.controller.yang.model.api.SchemaPath;
12 import org.opendaylight.controller.yang.model.api.type.IntegerTypeDefinition;
13
14 /**
15  * Implementation of Yang int16 built-in type. <br>
16  * int16 represents integer values between -32768 and 32767, inclusively. The
17  * Java counterpart of Yang int16 built-in type is {@link Short}.
18  *
19  * @see AbstractSignedInteger
20  */
21 public final class Int16 extends AbstractSignedInteger {
22     private static final QName name = BaseTypes.constructQName("int16");
23     private final Short defaultValue = null;
24     private static final String description = "int16  represents integer values between -32768 and 32767, inclusively.";
25     private final IntegerTypeDefinition baseType;
26
27     public Int16(final SchemaPath path) {
28         super(path, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
29         this.baseType = this;
30
31     }
32
33     @Override
34     public IntegerTypeDefinition getBaseType() {
35         return baseType;
36     }
37
38     @Override
39     public Object getDefaultValue() {
40         return defaultValue;
41     }
42
43     @Override
44     public int hashCode() {
45         final int prime = 31;
46         int result = super.hashCode();
47         result = prime * result
48                 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
49         return result;
50     }
51
52     @Override
53     public boolean equals(Object obj) {
54         if (this == obj) {
55             return true;
56         }
57         if (!super.equals(obj)) {
58             return false;
59         }
60         if (getClass() != obj.getClass()) {
61             return false;
62         }
63         Int16 other = (Int16) obj;
64         if (defaultValue == null) {
65             if (other.defaultValue != null) {
66                 return false;
67             }
68         } else if (!defaultValue.equals(other.defaultValue)) {
69             return false;
70         }
71         return true;
72     }
73
74     @Override
75     public String toString() {
76         StringBuilder builder = new StringBuilder();
77         builder.append("Int16 [defaultValue=");
78         builder.append(defaultValue);
79         builder.append(", AbstractInteger=");
80         builder.append(super.toString());
81         builder.append("]");
82         return builder.toString();
83     }
84 }