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 com.google.common.base.Optional;
11 import java.util.Objects;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.ContainerStatement;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19 public final class ContainerEffectiveStatementImpl extends AbstractEffectiveContainerSchemaNode<ContainerStatement>
23 private final ContainerSchemaNode original;
25 public ContainerEffectiveStatementImpl(
26 final StmtContext<QName, ContainerStatement, EffectiveStatement<QName, ContainerStatement>> ctx) {
28 this.original = ctx.getOriginalCtx() == null ? null : (ContainerSchemaNode) ctx.getOriginalCtx().buildEffective();
32 public Optional<ContainerSchemaNode> getOriginal() {
33 return Optional.fromNullable(original);
37 public int hashCode() {
40 result = prime * result + Objects.hashCode(getQName());
41 result = prime * result + Objects.hashCode(getPath());
46 public boolean equals(final Object obj) {
53 if (getClass() != obj.getClass()) {
56 ContainerEffectiveStatementImpl other = (ContainerEffectiveStatementImpl) obj;
57 return Objects.equals(getQName(), other.getQName()) && Objects.equals(getPath(), other.getPath());
61 public String toString() {
62 return "container " + getQName().getLocalName();