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;
14 import java.util.Objects;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
19 import org.opendaylight.yangtools.yang.model.api.Status;
20 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
22 final class IdentitySchemaNodeImpl implements IdentitySchemaNode {
23 private final QName qname;
24 private final SchemaPath path;
25 IdentitySchemaNode baseIdentity;
26 private final Set<IdentitySchemaNode> derivedIdentities;
30 ImmutableList<UnknownSchemaNode> unknownNodes;
32 IdentitySchemaNodeImpl(final QName qname, final SchemaPath path,
33 final Set<IdentitySchemaNode> derivedIdentities) {
36 this.derivedIdentities = derivedIdentities;
40 public QName getQName() {
45 public IdentitySchemaNode getBaseIdentity() {
50 public Set<IdentitySchemaNode> getDerivedIdentities() {
51 return Collections.unmodifiableSet(derivedIdentities);
55 public String getDescription() {
60 public String getReference() {
65 public Status getStatus() {
70 public SchemaPath getPath() {
75 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
80 public int hashCode() {
83 result = prime * result + Objects.hashCode(qname);
84 result = prime * result + Objects.hashCode(path);
89 public boolean equals(final Object obj) {
96 if (getClass() != obj.getClass()) {
99 IdentitySchemaNodeImpl other = (IdentitySchemaNodeImpl) obj;
101 if (other.qname != null) {
104 } else if (!qname.equals(other.qname)) {
108 if (other.path != null) {
111 } else if (!path.equals(other.path)) {
118 public String toString() {
119 StringBuilder sb = new StringBuilder(IdentitySchemaNodeImpl.class.getSimpleName());
121 sb.append("base=").append(baseIdentity);
122 sb.append(", qname=").append(qname);
124 return sb.toString();