/* * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective; import java.util.List; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext; import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.TypeOfCopy; abstract class AbstractEffectiveDataSchemaNode> extends AbstractEffectiveSchemaNode implements DataSchemaNode { // :FIXME should be private and final boolean augmenting; private final boolean addedByUses; private final boolean configuration; private final ConstraintDefinition constraints; public AbstractEffectiveDataSchemaNode(final StmtContext ctx) { super(ctx); this.constraints = EffectiveConstraintDefinitionImpl.forParent(this); this.configuration = ctx.isConfiguration(); // initCopyType List copyTypesFromOriginal = ctx.getCopyHistory(); if (copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES_AUGMENTATION)) { this.addedByUses = this.augmenting = true; } else { this.augmenting = copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_AUGMENTATION); this.addedByUses = copyTypesFromOriginal.contains(TypeOfCopy.ADDED_BY_USES); } } @Override public boolean isAugmenting() { return augmenting; } @Override public boolean isAddedByUses() { return addedByUses; } @Override public boolean isConfiguration() { return configuration; } @Override public ConstraintDefinition getConstraints() { return constraints; } }