package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
import com.google.common.base.Verify;
-import com.google.common.collect.ImmutableList.Builder;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
import java.util.Collection;
@Override
public void onFullDefinitionDeclared(
- final StmtContext.Mutable<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> augmentNode) {
+ final Mutable<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> augmentNode) {
if (!augmentNode.isSupportedByFeatures()) {
return;
}
final boolean skipCheckOfMandatoryNodes = YangVersion.VERSION_1_1.equals(sourceCtx.getRootVersion())
&& isConditionalAugmentStmt(sourceCtx);
- final Collection<StatementContextBase<?, ?, ?>> declared = sourceCtx.declaredSubstatements();
- final Collection<StatementContextBase<?, ?, ?>> effective = sourceCtx.effectiveSubstatements();
- final Collection<StatementContextBase<?, ?, ?>> buffer = new ArrayList<>(declared.size() + effective.size());
+ final Collection<? extends Mutable<?, ?, ?>> declared = sourceCtx.mutableDeclaredSubstatements();
+ final Collection<? extends Mutable<?, ?, ?>> effective = sourceCtx.mutableEffectiveSubstatements();
+ final Collection<Mutable<?, ?, ?>> buffer = new ArrayList<>(declared.size() + effective.size());
- for (final StatementContextBase<?, ?, ?> originalStmtCtx : declared) {
+ for (final Mutable<?, ?, ?> originalStmtCtx : declared) {
if (originalStmtCtx.isSupportedByFeatures()) {
copyStatement(originalStmtCtx, targetCtx, typeOfCopy, buffer, skipCheckOfMandatoryNodes);
}
}
- for (final StatementContextBase<?, ?, ?> originalStmtCtx : effective) {
+ for (final Mutable<?, ?, ?> originalStmtCtx : effective) {
copyStatement(originalStmtCtx, targetCtx, typeOfCopy, buffer, skipCheckOfMandatoryNodes);
}
&& StmtContextUtils.findFirstSubstatement(ctx, WhenStatement.class) != null;
}
- private static void copyStatement(final StatementContextBase<?, ?, ?> original,
- final StatementContextBase<?, ?, ?> target, final CopyType typeOfCopy,
- final Collection<StatementContextBase<?, ?, ?>> buffer, final boolean skipCheckOfMandatoryNodes) {
+ private static void copyStatement(final Mutable<?, ?, ?> original, final StatementContextBase<?, ?, ?> target,
+ final CopyType typeOfCopy, final Collection<Mutable<?, ?, ?>> buffer,
+ final boolean skipCheckOfMandatoryNodes) {
if (needToCopyByAugment(original)) {
validateNodeCanBeCopiedByAugment(original, target, typeOfCopy, skipCheckOfMandatoryNodes);
- final StatementContextBase<?, ?, ?> copy = original.createCopy(target, typeOfCopy);
+ final Mutable<?, ?, ?> copy = original.createCopy(target, typeOfCopy);
buffer.add(copy);
} else if (isReusedByAugment(original)) {
buffer.add(original);
checkForMandatoryNodes(sourceCtx);
}
- final List<StatementContextBase<?, ?, ?>> targetSubStatements = new Builder<StatementContextBase<?, ?, ?>>()
- .addAll(targetCtx.declaredSubstatements()).addAll(targetCtx.effectiveSubstatements()).build();
+ final List<Mutable<?, ?, ?>> targetSubStatements = ImmutableList.<Mutable<?, ?, ?>>builder()
+ .addAll(targetCtx.mutableDeclaredSubstatements()).addAll(targetCtx.mutableEffectiveSubstatements())
+ .build();
- for (final StatementContextBase<?, ?, ?> subStatement : targetSubStatements) {
+ for (final Mutable<?, ?, ?> subStatement : targetSubStatements) {
final boolean sourceIsDataNode = DataDefinitionStatement.class.isAssignableFrom(sourceCtx
.getPublicDefinition().getDeclaredRepresentationClass());
final boolean targetIsDataNode = DataDefinitionStatement.class.isAssignableFrom(subStatement