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.builder.api;
10 import java.util.List;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
14 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
17 * Basic implementation of SchemaNodeBuilder.
19 public abstract class AbstractSchemaNodeBuilder extends AbstractBuilder implements SchemaNodeBuilder {
20 protected final QName qname;
21 protected SchemaPath schemaPath;
23 protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) {
24 super(moduleName, line);
29 public int hashCode() {
31 int result = super.hashCode();
32 result = prime * result + ((parentBuilder == null) ? 0 : parentBuilder.hashCode());
33 result = prime * result + ((schemaPath == null) ? 0 : schemaPath.hashCode());
38 public boolean equals(Object obj) {
45 if (getClass() != obj.getClass()) {
48 if (!super.equals(obj)) {
51 AbstractSchemaNodeBuilder other = (AbstractSchemaNodeBuilder) obj;
52 if (parentBuilder == null) {
53 if (other.parentBuilder != null) {
56 } else if (!parentBuilder.equals(other.parentBuilder)) {
59 if (schemaPath == null) {
60 if (other.schemaPath != null) {
63 } else if (!schemaPath.equals(other.schemaPath)) {
70 public QName getQName() {
74 public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
75 this.unknownNodes.addAll(unknownNodes);