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 org.opendaylight.yangtools.yang.common.QName;
11 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
12 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
13 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
14 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractEffectiveSchemaNode;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.CopyHistory;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19 public abstract class AbstractEffectiveDataSchemaNode<D extends DeclaredStatement<QName>> extends
20 AbstractEffectiveSchemaNode<D> implements DataSchemaNode {
24 private final boolean addedByUses;
25 private final boolean configuration;
26 private final ConstraintDefinition constraints;
28 public AbstractEffectiveDataSchemaNode(final StmtContext<QName, D, ?> ctx) {
30 this.constraints = EffectiveConstraintDefinitionImpl.forParent(this);
31 this.configuration = ctx.isConfiguration();
34 final CopyHistory originalHistory = ctx.getCopyHistory();
35 if (originalHistory.contains(CopyType.ADDED_BY_USES_AUGMENTATION)) {
36 this.addedByUses = this.augmenting = true;
38 this.augmenting = originalHistory.contains(CopyType.ADDED_BY_AUGMENTATION);
39 this.addedByUses = originalHistory.contains(CopyType.ADDED_BY_USES);
44 public boolean isAugmenting() {
49 public boolean isAddedByUses() {
54 public boolean isConfiguration() {
59 public ConstraintDefinition getConstraints() {