2 * Copyright (c) 2013, 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
8 package org.opendaylight.yangtools.yang.parser.builder.impl;
10 import com.google.common.collect.ImmutableList;
11 import com.google.common.collect.ImmutableMap;
12 import com.google.common.collect.ImmutableSet;
13 import java.util.List;
15 import java.util.Objects;
17 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
18 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
19 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
20 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
21 import org.opendaylight.yangtools.yang.model.api.UsesNode;
23 final class UsesNodeImpl implements UsesNode {
24 private final SchemaPath groupingPath;
25 ImmutableSet<AugmentationSchema> augmentations;
26 private boolean addedByUses;
27 ImmutableMap<SchemaPath, SchemaNode> refines;
28 ImmutableList<UnknownSchemaNode> unknownNodes;
30 UsesNodeImpl(final SchemaPath groupingPath) {
31 this.groupingPath = groupingPath;
35 public SchemaPath getGroupingPath() {
40 public Set<AugmentationSchema> getAugmentations() {
45 public boolean isAugmenting() {
50 public boolean isAddedByUses() {
54 void setAddedByUses(final boolean addedByUses) {
55 this.addedByUses = addedByUses;
59 public Map<SchemaPath, SchemaNode> getRefines() {
63 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
68 public int hashCode() {
71 result = prime * result + Objects.hashCode(groupingPath);
72 result = prime * result + Objects.hashCode(augmentations);
77 public boolean equals(final Object obj) {
84 if (getClass() != obj.getClass()) {
87 final UsesNodeImpl other = (UsesNodeImpl) obj;
88 if (groupingPath == null) {
89 if (other.groupingPath != null) {
92 } else if (!groupingPath.equals(other.groupingPath)) {
95 if (augmentations == null) {
96 if (other.augmentations != null) {
99 } else if (!augmentations.equals(other.augmentations)) {
106 public String toString() {
107 StringBuilder sb = new StringBuilder(UsesNodeImpl.class.getSimpleName());
108 sb.append("[groupingPath=");
109 sb.append(groupingPath);
111 return sb.toString();