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.spi.meta.CopyHistory;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
18 abstract class AbstractEffectiveDataSchemaNode<D extends DeclaredStatement<QName>> extends
19 AbstractEffectiveSchemaNode<D> implements DataSchemaNode {
21 // :FIXME should be private and final
23 private final boolean addedByUses;
24 private final boolean configuration;
25 private final ConstraintDefinition constraints;
27 public AbstractEffectiveDataSchemaNode(final StmtContext<QName, D, ?> ctx) {
29 this.constraints = EffectiveConstraintDefinitionImpl.forParent(this);
30 this.configuration = ctx.isConfiguration();
33 final CopyHistory originalHistory = ctx.getCopyHistory();
34 if (originalHistory.contains(CopyType.ADDED_BY_USES_AUGMENTATION)) {
35 this.addedByUses = this.augmenting = true;
37 this.augmenting = originalHistory.contains(CopyType.ADDED_BY_AUGMENTATION);
38 this.addedByUses = originalHistory.contains(CopyType.ADDED_BY_USES);
43 public boolean isAugmenting() {
48 public boolean isAddedByUses() {
53 public boolean isConfiguration() {
58 public ConstraintDefinition getConstraints() {