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.rfc7950.stmt;
10 import java.util.Optional;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
13 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
14 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.WhenEffectiveStatement;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.CopyHistory;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
20 @Deprecated(forRemoval = true)
21 public abstract class AbstractEffectiveDataSchemaNode<D extends DeclaredStatement<QName>> extends
22 AbstractEffectiveSchemaNode<D> implements DataSchemaNode {
24 private final RevisionAwareXPath whenCondition;
25 private final boolean configuration;
26 private final boolean addedByUses;
27 private final boolean augmenting;
29 protected AbstractEffectiveDataSchemaNode(final StmtContext<QName, D, ?> ctx) {
31 this.configuration = ctx.isConfiguration();
32 whenCondition = findFirstEffectiveSubstatementArgument(WhenEffectiveStatement.class).orElse(null);
35 final CopyHistory originalHistory = ctx.getCopyHistory();
36 if (originalHistory.contains(CopyType.ADDED_BY_USES_AUGMENTATION)) {
37 this.augmenting = true;
38 this.addedByUses = true;
40 this.augmenting = originalHistory.contains(CopyType.ADDED_BY_AUGMENTATION);
41 this.addedByUses = originalHistory.contains(CopyType.ADDED_BY_USES);
47 public final boolean isAugmenting() {
53 public final boolean isAddedByUses() {
58 public final boolean isConfiguration() {
63 public final Optional<RevisionAwareXPath> getWhenCondition() {
64 return Optional.ofNullable(whenCondition);