2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.yangtools.yang.parser.builder.api;
\r
10 import java.util.List;
\r
12 import org.opendaylight.yangtools.yang.common.QName;
\r
13 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
\r
14 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
\r
17 * Basic implementation of SchemaNodeBuilder.
\r
19 public abstract class AbstractSchemaNodeBuilder extends AbstractBuilder implements SchemaNodeBuilder {
\r
20 protected final QName qname;
\r
21 protected SchemaPath schemaPath;
\r
23 protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) {
\r
24 super(moduleName, line);
\r
29 public int hashCode() {
\r
30 final int prime = 31;
\r
31 int result = super.hashCode();
\r
32 result = prime * result + ((parentBuilder == null) ? 0 : parentBuilder.hashCode());
\r
33 result = prime * result + ((schemaPath == null) ? 0 : schemaPath.hashCode());
\r
38 public boolean equals(Object obj) {
\r
45 if (getClass() != obj.getClass()) {
\r
48 if (!super.equals(obj)) {
\r
51 AbstractSchemaNodeBuilder other = (AbstractSchemaNodeBuilder) obj;
\r
52 if (parentBuilder == null) {
\r
53 if (other.parentBuilder != null) {
\r
56 } else if (!parentBuilder.equals(other.parentBuilder)) {
\r
59 if (schemaPath == null) {
\r
60 if (other.schemaPath != null) {
\r
63 } else if (!schemaPath.equals(other.schemaPath)) {
\r
70 public QName getQName() {
\r
74 public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
\r
75 this.unknownNodes.addAll(unknownNodes);
\r