static void copyFromSourceToTarget(final StatementContextBase<?, ?, ?> sourceCtx,
final StatementContextBase<?, ?, ?> targetCtx) {
final CopyType typeOfCopy = UsesStatement.class.equals(sourceCtx.coerceParentContext().getPublicDefinition()
.getDeclaredRepresentationClass()) ? CopyType.ADDED_BY_USES_AUGMENTATION
: CopyType.ADDED_BY_AUGMENTATION;
final boolean skipCheckOfMandatoryNodes = YangVersion.VERSION_1_1.equals(sourceCtx.getRootVersion())
&& isConditionalAugmentStmt(sourceCtx);
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 Mutable<?, ?, ?> originalStmtCtx : declared) {
if (originalStmtCtx.isSupportedByFeatures()) {
copyStatement(originalStmtCtx, targetCtx, typeOfCopy, buffer, skipCheckOfMandatoryNodes);
}
}
for (final Mutable<?, ?, ?> originalStmtCtx : effective) {
copyStatement(originalStmtCtx, targetCtx, typeOfCopy, buffer, skipCheckOfMandatoryNodes);
}
targetCtx.addEffectiveSubstatements(buffer);
}