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.ChoiceCaseNode;
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.CaseStatement;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19 public final class CaseEffectiveStatementImpl extends AbstractEffectiveSimpleDataNodeContainer<CaseStatement> implements
20 ChoiceCaseNode, DerivableSchemaNode {
22 private final ChoiceCaseNode original;
24 public CaseEffectiveStatementImpl(
25 final StmtContext<QName, CaseStatement, EffectiveStatement<QName, CaseStatement>> ctx) {
27 this.original = ctx.getOriginalCtx() == null ? null : (ChoiceCaseNode) ctx.getOriginalCtx().buildEffective();
31 public Optional<ChoiceCaseNode> getOriginal() {
32 return Optional.fromNullable(original);
36 public boolean isConfiguration() {
41 public int hashCode() {
44 result = prime * result + Objects.hashCode(getQName());
45 result = prime * result + Objects.hashCode(getPath());
50 public boolean equals(final Object obj) {
57 if (getClass() != obj.getClass()) {
60 CaseEffectiveStatementImpl other = (CaseEffectiveStatementImpl) obj;
61 return Objects.equals(getQName(), other.getQName()) && Objects.equals(getPath(), other.getPath());
65 public String toString() {
66 StringBuilder sb = new StringBuilder(CaseEffectiveStatementImpl.class.getSimpleName());
69 sb.append(getQName());