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.MustDefinition;
11 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
12 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
14 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
16 public class MustEffectiveStatementImpl extends
17 EffectiveStatementBase<RevisionAwareXPath, MustStatement> implements
20 private RevisionAwareXPath xPath;
21 private String description;
22 private String errorAppTag;
23 private String errorMessage;
24 private String reference;
26 public MustEffectiveStatementImpl(
27 StmtContext<RevisionAwareXPath, MustStatement, ?> ctx) {
32 xPath = ctx.getStatementArgument();
35 private void initFields() {
37 for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
39 if (effectiveStatement instanceof DescriptionEffectiveStatementImpl) {
40 description = ((DescriptionEffectiveStatementImpl) effectiveStatement)
43 if (effectiveStatement instanceof ErrorAppTagEffectiveStatementImpl) {
44 errorAppTag = ((ErrorAppTagEffectiveStatementImpl) effectiveStatement)
47 if (effectiveStatement instanceof ErrorMessageEffectiveStatementImpl) {
48 errorMessage = ((ErrorMessageEffectiveStatementImpl) effectiveStatement)
51 if (effectiveStatement instanceof ReferenceEffectiveStatementImpl) {
52 reference = ((ReferenceEffectiveStatementImpl) effectiveStatement)
59 public RevisionAwareXPath getXpath() {
64 public String getDescription() {
69 public String getErrorAppTag() {
74 public String getErrorMessage() {
79 public String getReference() {
84 public int hashCode() {
87 result = prime * result + ((xPath == null) ? 0 : xPath.hashCode());
88 result = prime * result
89 + ((description == null) ? 0 : description.hashCode());
90 result = prime * result
91 + ((reference == null) ? 0 : reference.hashCode());
96 public boolean equals(final Object obj) {
103 if (getClass() != obj.getClass()) {
106 final MustEffectiveStatementImpl other = (MustEffectiveStatementImpl) obj;
108 if (other.xPath != null) {
111 } else if (!xPath.equals(other.xPath)) {
114 if (description == null) {
115 if (other.description != null) {
118 } else if (!description.equals(other.description)) {
121 if (reference == null) {
122 if (other.reference != null) {
125 } else if (!reference.equals(other.reference)) {
132 public String toString() {
133 return xPath.toString();