import org.opendaylight.yangtools.yang.parser.spi.source.ImplicitSubstatement;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementWriter.ResumedStatement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Intermediate subclass of StatementContextBase facing the parser stream via implementation of ResumedStatement. This
*/
abstract class AbstractResumedStatement<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
extends StatementContextBase<A, D, E> implements ResumedStatement {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractResumedStatement.class);
+
private final @NonNull StatementSourceReference statementDeclSource;
private final String rawArgument;
return effective.stream();
}
+ @Override
+ final int sweepSubstatements() {
+ // First we need to sweep all statements, which may trigger sweeps all across the place, for example:
+ // - 'effective' member sweeping a 'substatements' member
+ // - 'substatements' member sweeping a 'substatements' member which came before it during iteration
+ // We then iterate once again, counting what remains unswept
+ sweep(substatements);
+ sweep(effective);
+ final int count = countUnswept(substatements) + countUnswept(effective);
+ if (count != 0) {
+ LOG.debug("{} children left to sweep from {}", count, this);
+ }
+ substatements = null;
+ effective = null;
+ return count;
+ }
+
/**
* Lookup substatement by its offset in this statement.
*