mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 23:10:40 +00:00
ICU-22789 Rename boundariesAfter API for Segments interface
This commit is contained in:
parent
0e2b1dbb81
commit
9fbcc8a055
5 changed files with 11 additions and 11 deletions
|
@ -115,8 +115,8 @@ public class LocalizedSegmenter implements Segmenter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IntStream boundariesAfterIndex(int i) {
|
||||
return SegmentsImplUtils.boundariesAfterIndex(this.breakIter, this.source, i);
|
||||
public IntStream boundariesAfter(int i) {
|
||||
return SegmentsImplUtils.boundariesAfter(this.breakIter, this.source, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -88,8 +88,8 @@ public class RuleBasedSegmenter implements Segmenter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IntStream boundariesAfterIndex(int i) {
|
||||
return SegmentsImplUtils.boundariesAfterIndex(this.breakIter, this.source, i);
|
||||
public IntStream boundariesAfter(int i) {
|
||||
return SegmentsImplUtils.boundariesAfter(this.breakIter, this.source, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Iterator;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
public interface Segments {
|
||||
Stream<CharSequence> subSequences();
|
||||
|
@ -32,7 +31,7 @@ public interface Segments {
|
|||
|
||||
IntStream boundaries();
|
||||
|
||||
IntStream boundariesAfterIndex(int i);
|
||||
IntStream boundariesAfter(int i);
|
||||
|
||||
IntStream boundariesBeforeIndex(int i);
|
||||
|
||||
|
|
|
@ -85,10 +85,10 @@ public class SegmentsImplUtils {
|
|||
}
|
||||
|
||||
public static IntStream boundaries(BreakIterator breakIter, CharSequence sourceSequence) {
|
||||
return boundariesAfterIndex(breakIter, sourceSequence, -1);
|
||||
return boundariesAfter(breakIter, sourceSequence, -1);
|
||||
}
|
||||
|
||||
public static IntStream boundariesAfterIndex(BreakIterator breakIter, CharSequence sourceSequence, int i) {
|
||||
public static IntStream boundariesAfter(BreakIterator breakIter, CharSequence sourceSequence, int i) {
|
||||
breakIter.setText(sourceSequence);
|
||||
|
||||
// create a Stream from a Spliterator of an Iterable so that the Stream can be lazy, not eager
|
||||
|
|
|
@ -296,7 +296,7 @@ public class SegmentsTest extends CoreTestFmwk {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBoundariesAfterIndex() {
|
||||
public void testBoundariesAfter() {
|
||||
Segmenter enWordSegmenter =
|
||||
new LocalizedSegmenterBuilder()
|
||||
.setLocale(ULocale.ENGLISH)
|
||||
|
@ -312,6 +312,7 @@ public class SegmentsTest extends CoreTestFmwk {
|
|||
Object[][] casesData = {
|
||||
{"first " + TAKE_LIMIT + " before beginning", -2, new int[]{0, 3, 4, 9, 10}},
|
||||
{"first " + TAKE_LIMIT + " in the middle of the third segment", 5, new int[]{9, 10, 15, 16, 19}},
|
||||
{"first " + TAKE_LIMIT + " on the limit of the third segment", 9, new int[]{10, 15, 16, 19, 20}},
|
||||
{"first " + TAKE_LIMIT + " at the end", source.length(), new int[0]},
|
||||
{"first " + TAKE_LIMIT + " after the end", source.length()+1, new int[0]},
|
||||
};
|
||||
|
@ -321,9 +322,9 @@ public class SegmentsTest extends CoreTestFmwk {
|
|||
int startIdx = (int) caseDatum[1];
|
||||
int[] exp = (int[]) caseDatum[2];
|
||||
|
||||
int[] act = segments.boundariesAfterIndex(startIdx).limit(TAKE_LIMIT).toArray();
|
||||
int[] act = segments.boundariesAfter(startIdx).limit(TAKE_LIMIT).toArray();
|
||||
|
||||
assertThat(act, is(exp));
|
||||
assertThat(desc, act, is(exp));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue