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 java.util.Date;
12 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
13 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.ImportStatement;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
17 public class ImportEffectiveStatementImpl extends EffectiveStatementBase<String, ImportStatement> implements
20 private String moduleName;
21 private Date revision;
22 private String prefix;
24 public ImportEffectiveStatementImpl(StmtContext<String, ImportStatement, ?> ctx) {
27 moduleName = ctx.getStatementArgument();
29 for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
30 if (effectiveStatement instanceof RevisionEffectiveStatementImpl) {
31 revision = ((RevisionEffectiveStatementImpl) effectiveStatement).argument();
33 if (effectiveStatement instanceof PrefixEffectiveStatementImpl) {
34 prefix = ((PrefixEffectiveStatementImpl) effectiveStatement).argument();
40 public String getModuleName() {
45 public Date getRevision() {
50 public String getPrefix() {
55 public int hashCode() {
58 result = prime * result + ((moduleName == null) ? 0 : moduleName.hashCode());
59 result = prime * result + ((revision == null) ? 0 : revision.hashCode());
60 result = prime * result + ((prefix == null) ? 0 : prefix.hashCode());
65 public boolean equals(Object obj) {
72 if (getClass() != obj.getClass()) {
75 ImportEffectiveStatementImpl other = (ImportEffectiveStatementImpl) obj;
76 if (getModuleName() == null) {
77 if (other.getModuleName() != null) {
80 } else if (!getModuleName().equals(other.getModuleName())) {
83 if (getRevision() == null) {
84 if (other.getRevision() != null) {
87 } else if (!getRevision().equals(other.getRevision())) {
90 if (getPrefix() == null) {
91 if (other.getPrefix() != null) {
94 } else if (!getPrefix().equals(other.getPrefix())) {
101 public String toString() {
102 return ImportEffectiveStatementImpl.class.getSimpleName() + "[moduleName=" + moduleName + ", revision="
103 + revision + ", prefix=" + prefix + "]";