@@ -54,13 +54,7 @@ public LineBasedAnnotation(final LineBasedAnnotation other) {
5454 this .style = other .style ;
5555 }
5656
57- private static void addRange (final List <Integer > list , final int fromInclusive , final int toInclusive ) {
58- for (int i = fromInclusive ; i <= toInclusive ; ++i ) {
59- list .add (i );
60- }
61- }
62-
63- private static void addRange2 (final List <VariantLineChunk > list , final int fromInclusive , final int toInclusive ) {
57+ private static void addRange (final List <VariantLineChunk > list , final int fromInclusive , final int toInclusive ) {
6458 for (int i = fromInclusive ; i <= toInclusive ; ++i ) {
6559 list .add (new VariantLine (i ));
6660 }
@@ -154,37 +148,6 @@ private Optional<LineBasedAnnotation> deriveForVariant(final Variant variant, in
154148 }
155149 }
156150
157- /**
158- * Computes all lines that should be included in the given variant when evaluating the annotations in this artefact.
159- *
160- * @param isIncluded A predicate to select subtrees. A subtree will be considered if isIncluded returns true for it.
161- * @return All line numbers that should be copied from the SPL file to the variant file. 1-based.
162- */
163- public List <Integer > getAllLinesFor (final Predicate <LineBasedAnnotation > isIncluded ) {
164- final List <Integer > chunksToWrite = new ArrayList <>();
165- final int firstCodeLine = getLineFrom () + style .offset ; // ignore #if
166- final int lastCodeLine = getLineTo () - style .offset ; // ignore #endif
167-
168- int currentLine = firstCodeLine ;
169- for (final LineBasedAnnotation subtree : subtrees ) {
170- if (currentLine < subtree .getLineFrom ()) {
171- addRange (chunksToWrite , currentLine , subtree .getLineFrom () - 1 );
172- }
173-
174- if (isIncluded .test (subtree )) {
175- chunksToWrite .addAll (subtree .getAllLinesFor (isIncluded ));
176- }
177-
178- currentLine = subtree .getLineTo () + 1 ;
179- }
180-
181- if (currentLine <= lastCodeLine ) {
182- addRange (chunksToWrite , currentLine , lastCodeLine );
183- }
184-
185- return chunksToWrite ;
186- }
187-
188151 /**
189152 * Computes all lines that should be included in the given variant when evaluating the annotations in this artefact.
190153 *
@@ -200,7 +163,7 @@ public VariantAnnotation getLinesToCopy(final Predicate<LineBasedAnnotation> isI
200163 int currentLine = firstCodeLine ;
201164 for (final LineBasedAnnotation subtree : subtrees ) {
202165 if (currentLine < subtree .getLineFrom ()) {
203- addRange2 (chunksToWrite , currentLine , subtree .getLineFrom () - 1 );
166+ addRange (chunksToWrite , currentLine , subtree .getLineFrom () - 1 );
204167 }
205168
206169 if (isIncluded .test (subtree )) {
@@ -211,7 +174,7 @@ public VariantAnnotation getLinesToCopy(final Predicate<LineBasedAnnotation> isI
211174 }
212175
213176 if (currentLine <= lastCodeLine ) {
214- addRange2 (chunksToWrite , currentLine , lastCodeLine );
177+ addRange (chunksToWrite , currentLine , lastCodeLine );
215178 }
216179
217180 return new VariantAnnotation (
0 commit comments