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;
16 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
17 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
19 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.UsesNode;
22 final class UsesNodeImpl implements UsesNode {
23 private final SchemaPath groupingPath;
24 ImmutableSet<AugmentationSchema> augmentations;
25 private boolean addedByUses;
26 ImmutableMap<SchemaPath, SchemaNode> refines;
27 ImmutableList<UnknownSchemaNode> unknownNodes;
29 UsesNodeImpl(final SchemaPath groupingPath) {
30 this.groupingPath = groupingPath;
34 public SchemaPath getGroupingPath() {
39 public Set<AugmentationSchema> getAugmentations() {
44 public boolean isAugmenting() {
49 public boolean isAddedByUses() {
53 void setAddedByUses(final boolean addedByUses) {
54 this.addedByUses = addedByUses;
58 public Map<SchemaPath, SchemaNode> getRefines() {
62 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
67 public int hashCode() {
70 result = prime * result + ((groupingPath == null) ? 0 : groupingPath.hashCode());
71 result = prime * result + ((augmentations == null) ? 0 : augmentations.hashCode());
76 public boolean equals(final Object obj) {
83 if (getClass() != obj.getClass()) {
86 final UsesNodeImpl other = (UsesNodeImpl) obj;
87 if (groupingPath == null) {
88 if (other.groupingPath != null) {
91 } else if (!groupingPath.equals(other.groupingPath)) {
94 if (augmentations == null) {
95 if (other.augmentations != null) {
98 } else if (!augmentations.equals(other.augmentations)) {
105 public String toString() {
106 StringBuilder sb = new StringBuilder(UsesNodeImpl.class.getSimpleName());
107 sb.append("[groupingPath=");
108 sb.append(groupingPath);
110 return sb.toString();