2 * Copyright (c) 2015 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
9 package org.opendaylight.yangtools.yang.parser.builder.impl;
11 import com.google.common.collect.ImmutableList;
12 import java.util.Collections;
13 import java.util.List;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
18 import org.opendaylight.yangtools.yang.model.api.Status;
19 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
21 final class IdentitySchemaNodeImpl implements IdentitySchemaNode {
22 private final QName qname;
23 private final SchemaPath path;
24 IdentitySchemaNode baseIdentity;
25 private final Set<IdentitySchemaNode> derivedIdentities;
29 ImmutableList<UnknownSchemaNode> unknownNodes;
31 IdentitySchemaNodeImpl(final QName qname, final SchemaPath path,
32 final Set<IdentitySchemaNode> derivedIdentities) {
35 this.derivedIdentities = derivedIdentities;
39 public QName getQName() {
44 public IdentitySchemaNode getBaseIdentity() {
49 public Set<IdentitySchemaNode> getDerivedIdentities() {
50 return Collections.unmodifiableSet(derivedIdentities);
54 public String getDescription() {
59 public String getReference() {
64 public Status getStatus() {
69 public SchemaPath getPath() {
74 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
79 public int hashCode() {
82 result = prime * result + ((qname == null) ? 0 : qname.hashCode());
83 result = prime * result + ((path == null) ? 0 : path.hashCode());
88 public boolean equals(final Object obj) {
95 if (getClass() != obj.getClass()) {
98 IdentitySchemaNodeImpl other = (IdentitySchemaNodeImpl) obj;
100 if (other.qname != null) {
103 } else if (!qname.equals(other.qname)) {
107 if (other.path != null) {
110 } else if (!path.equals(other.path)) {
117 public String toString() {
118 StringBuilder sb = new StringBuilder(IdentitySchemaNodeImpl.class.getSimpleName());
120 sb.append("base=").append(baseIdentity);
121 sb.append(", qname=").append(qname);
123 return sb.toString();