mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -19,6 +19,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface SweepProcessor<T> {
|
||||
boolean process(int offset, @NotNull T interval, boolean atStart, @NotNull Collection<T> overlappingIntervals);
|
||||
}
|
||||
|
||||
@@ -307,10 +307,6 @@ public class RangeMarkerTree<T extends RangeMarkerEx> extends IntervalTreeImpl<T
|
||||
return norm;
|
||||
}
|
||||
|
||||
public boolean sweep(final int start, final int end, @NotNull SweepProcessor<T> sweepProcessor) {
|
||||
return sweep(processor -> processOverlappingWith(start, end, processor), sweepProcessor);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Generator<T> {
|
||||
boolean generateInStartOffsetOrder(@NotNull Processor<T> processor);
|
||||
|
||||
@@ -95,16 +95,7 @@ public final class LoadTextUtil {
|
||||
prev = c;
|
||||
}
|
||||
|
||||
String detectedLineSeparator = null;
|
||||
if (crlfCount > crCount && crlfCount > lfCount) {
|
||||
detectedLineSeparator = "\r\n";
|
||||
}
|
||||
else if (crCount > lfCount) {
|
||||
detectedLineSeparator = "\r";
|
||||
}
|
||||
else if (lfCount > 0) {
|
||||
detectedLineSeparator = "\n";
|
||||
}
|
||||
String detectedLineSeparator = guessLineSeparator(crCount, lfCount, crlfCount);
|
||||
|
||||
CharSequence result = buffer.length() == dst ? buffer : buffer.subSequence(0, dst);
|
||||
return Pair.create(result, detectedLineSeparator);
|
||||
@@ -151,6 +142,14 @@ public final class LoadTextUtil {
|
||||
prev = c;
|
||||
}
|
||||
|
||||
String detectedLineSeparator = guessLineSeparator(crCount, lfCount, crlfCount);
|
||||
|
||||
ByteArrayCharSequence sequence = new ByteArrayCharSequence(result, 0, dst);
|
||||
return Pair.create(sequence, detectedLineSeparator);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String guessLineSeparator(int crCount, int lfCount, int crlfCount) {
|
||||
String detectedLineSeparator = null;
|
||||
if (crlfCount > crCount && crlfCount > lfCount) {
|
||||
detectedLineSeparator = "\r\n";
|
||||
@@ -161,9 +160,7 @@ public final class LoadTextUtil {
|
||||
else if (lfCount > 0) {
|
||||
detectedLineSeparator = "\n";
|
||||
}
|
||||
|
||||
ByteArrayCharSequence sequence = new ByteArrayCharSequence(result, 0, dst);
|
||||
return Pair.create(sequence, detectedLineSeparator);
|
||||
return detectedLineSeparator;
|
||||
}
|
||||
|
||||
// private fake charsets for files which have one-byte-for-ascii-characters encoding but contain seven bits characters only. used for optimization since we don't have to encode-decode bytes here.
|
||||
|
||||
Reference in New Issue
Block a user