- public static void copyEffectiveStmts(StatementContextBase<?, ?, ?> sourceCtx,
- StatementContextBase<?, ?, ?> targetCtx, QNameModule newQNameModule) throws SourceException {
- Collection<? extends StatementContextBase<?, ?, ?>> effectiveSubstatements = sourceCtx.effectiveSubstatements();
- for (StatementContextBase<?, ?, ?> originalStmtCtx : effectiveSubstatements) {
+ private static void copyEffectiveStmts(final StatementContextBase<?, ?, ?> sourceCtx,
+ final StatementContextBase<?, ?, ?> targetCtx) throws SourceException {
+
+ final List<StatementContextBase<?, ?, ?>> subStatements = new Builder<StatementContextBase<?, ?, ?>>()
+ .addAll(targetCtx.declaredSubstatements()).addAll(targetCtx.effectiveSubstatements()).build();
+ boolean sourceAndTargetInSameModule = Utils.getRootModuleQName(sourceCtx).equals(
+ Utils.getRootModuleQName(targetCtx));
+
+ TypeOfCopy typeOfCopy = sourceCtx.getParentContext().getPublicDefinition().getDeclaredRepresentationClass()
+ .equals(UsesStatement.class) ? TypeOfCopy.ADDED_BY_USES_AUGMENTATION : TypeOfCopy.ADDED_BY_AUGMENTATION;
+
+ for (StatementContextBase<?, ?, ?> originalStmtCtx : sourceCtx.effectiveSubstatements()) {