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
8 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
10 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
11 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.stmt.UsesStatement;
15 import com.google.common.collect.ImmutableList;
16 import com.google.common.collect.ImmutableMap;
17 import com.google.common.collect.ImmutableSet;
18 import java.util.List;
21 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
22 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
23 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
24 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
25 import org.opendaylight.yangtools.yang.model.api.UsesNode;
27 public class UsesEffectiveStatementImpl extends EffectiveStatementBase<QName, UsesStatement>implements UsesNode {
28 private SchemaPath groupingPath;
29 ImmutableSet<AugmentationSchema> augmentations;
30 private boolean addedByUses;
31 ImmutableMap<SchemaPath, SchemaNode> refines;
32 ImmutableList<UnknownSchemaNode> unknownNodes;
34 public UsesEffectiveStatementImpl(StmtContext<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> ctx) {
37 this.groupingPath = null;
41 public SchemaPath getGroupingPath() {
46 public Set<AugmentationSchema> getAugmentations() {
51 public boolean isAugmenting() {
56 public boolean isAddedByUses() {
60 void setAddedByUses(final boolean addedByUses) {
61 this.addedByUses = addedByUses;
65 public Map<SchemaPath, SchemaNode> getRefines() {
69 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
74 public int hashCode() {
77 result = prime * result + ((groupingPath == null) ? 0 : groupingPath.hashCode());
78 result = prime * result + ((augmentations == null) ? 0 : augmentations.hashCode());
83 public boolean equals(final Object obj) {
90 if (getClass() != obj.getClass()) {
93 final UsesEffectiveStatementImpl other = (UsesEffectiveStatementImpl) obj;
94 if (groupingPath == null) {
95 if (other.groupingPath != null) {
98 } else if (!groupingPath.equals(other.groupingPath)) {
101 if (augmentations == null) {
102 if (other.augmentations != null) {
105 } else if (!augmentations.equals(other.augmentations)) {
112 public String toString() {
113 StringBuilder sb = new StringBuilder(UsesEffectiveStatementImpl.class.getSimpleName());
114 sb.append("[groupingPath=");
115 sb.append(groupingPath);
117 return sb.toString();