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.Objects;
11 import org.opendaylight.yangtools.yang.common.QNameModule;
12 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
13 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
16 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleQName;
18 public final class ModuleEffectiveStatementImpl extends AbstractEffectiveModule<ModuleStatement> {
19 private final QNameModule qNameModule;
21 public ModuleEffectiveStatementImpl(
22 final StmtContext<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> ctx) {
25 final QNameModule module = ctx.getFromNamespace(ModuleCtxToModuleQName.class, ctx);
26 if (module.getRevision() == null) {
27 qNameModule = QNameModule.cachedReference(
28 QNameModule.create(module.getNamespace(), SimpleDateFormatUtil.DEFAULT_DATE_REV));
35 public QNameModule getQNameModule() {
40 public int hashCode() {
43 result = prime * result + Objects.hashCode(getName());
44 result = prime * result + Objects.hashCode(getYangVersion());
45 result = prime * result + Objects.hashCode(qNameModule);
50 public boolean equals(final Object obj) {
54 if (!(obj instanceof ModuleEffectiveStatementImpl)) {
57 ModuleEffectiveStatementImpl other = (ModuleEffectiveStatementImpl) obj;
58 if (!Objects.equals(getName(), other.getName())) {
61 if (!qNameModule.equals(other.qNameModule)) {
64 if (!Objects.equals(getYangVersion(), other.getYangVersion())) {