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.yangtools.yang.parser.util;
10 import java.util.Collections;
11 import java.util.List;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
15 import org.opendaylight.yangtools.yang.model.api.Status;
16 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
18 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit;
20 final class BitImpl implements BitsTypeDefinition.Bit {
21 private final Long position;
22 private final QName qname;
23 private final SchemaPath schemaPath;
24 private final String description;
25 private final String reference;
26 private final Status status;
27 private List<UnknownSchemaNode> unknownNodes = Collections.emptyList();
29 BitImpl(final Long position, final QName qname, final SchemaPath schemaPath, final String description,
30 final String reference, final Status status, final List<UnknownSchemaNode> unknownNodes) {
31 this.position = position;
33 this.schemaPath = schemaPath;
34 this.description = description;
35 this.reference = reference;
37 if (unknownNodes != null) {
38 this.unknownNodes = unknownNodes;
43 public QName getQName() {
48 public SchemaPath getPath() {
53 public String getDescription() {
58 public String getReference() {
63 public Status getStatus() {
68 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
73 public Long getPosition() {
78 public String getName() {
79 return qname.getLocalName();
83 public int hashCode() {
86 result = prime * result + ((qname == null) ? 0 : qname.hashCode());
87 result = prime * result + ((schemaPath == null) ? 0 : schemaPath.hashCode());
88 result = prime * result + ((position == null) ? 0 : position.hashCode());
89 result = prime * result + ((unknownNodes == null) ? 0 : unknownNodes.hashCode());
94 public boolean equals(Object obj) {
101 if (getClass() != obj.getClass()) {
104 Bit other = (Bit) obj;
106 if (other.getQName() != null) {
109 } else if (!qname.equals(other.getQName())) {
112 if (schemaPath == null) {
113 if (other.getPath() != null) {
116 } else if (!schemaPath.equals(other.getPath())) {
123 public String toString() {
124 return Bit.class.getSimpleName() + "[name=" + qname.getLocalName() + ", position=" + position + "]";