Class UnicodeSetStringSpan
java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.UnicodeSetStringSpan
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionUnicodeSetStringSpan(UnicodeSetStringSpan otherStringSpan, ArrayList<String> newParentSetStrings) Constructs a copy of an existing UnicodeSetStringSpan.UnicodeSetStringSpan(UnicodeSet set, ArrayList<String> setStrings, int which) Constructs for all variants of span(), or only for any one variant. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int c) For fast UnicodeSet::contains(c).booleanDo the strings need to be checked in span() etc.?intspan(CharSequence s, int start, UnicodeSet.SpanCondition spanCondition) Spans a string.intspanAndCount(CharSequence s, int start, UnicodeSet.SpanCondition spanCondition, OutputInt outCount) Spans a string and counts the smallest number of set elements on any path across the span.intspanBack(CharSequence s, int length, UnicodeSet.SpanCondition spanCondition) Span a string backwards.
-
Field Details
-
WITH_COUNT
public static final int WITH_COUNT- See Also:
-
FWD
public static final int FWD- See Also:
-
BACK
public static final int BACK- See Also:
-
CONTAINED
public static final int CONTAINED- See Also:
-
NOT_CONTAINED
public static final int NOT_CONTAINED- See Also:
-
ALL
public static final int ALL- See Also:
-
FWD_UTF16_CONTAINED
public static final int FWD_UTF16_CONTAINED- See Also:
-
FWD_UTF16_NOT_CONTAINED
public static final int FWD_UTF16_NOT_CONTAINED- See Also:
-
BACK_UTF16_CONTAINED
public static final int BACK_UTF16_CONTAINED- See Also:
-
BACK_UTF16_NOT_CONTAINED
public static final int BACK_UTF16_NOT_CONTAINED- See Also:
-
-
Constructor Details
-
UnicodeSetStringSpan
Constructs for all variants of span(), or only for any one variant. Initializes as little as possible, for single use. -
UnicodeSetStringSpan
public UnicodeSetStringSpan(UnicodeSetStringSpan otherStringSpan, ArrayList<String> newParentSetStrings) Constructs a copy of an existing UnicodeSetStringSpan. Assumes which==ALL for a frozen set.
-
-
Method Details
-
needsStringSpanUTF16
public boolean needsStringSpanUTF16()Do the strings need to be checked in span() etc.?- Returns:
- true if strings need to be checked (call span() here), false if not (use a BMPSet for best performance).
-
contains
public boolean contains(int c) For fast UnicodeSet::contains(c). -
span
Spans a string.- Parameters:
s- The string to be spannedstart- The start index that the span beginsspanCondition- The span condition- Returns:
- the limit (exclusive end) of the span
-
spanAndCount
public int spanAndCount(CharSequence s, int start, UnicodeSet.SpanCondition spanCondition, OutputInt outCount) Spans a string and counts the smallest number of set elements on any path across the span.For proper counting, we cannot ignore strings that are fully contained in code point spans.
If the set does not have any fully-contained strings, then we could optimize this like span(), but such sets are likely rare, and this is at least still linear.
- Parameters:
s- The string to be spannedstart- The start index that the span beginsspanCondition- The span conditionoutCount- The count- Returns:
- the limit (exclusive end) of the span
-
spanBack
Span a string backwards.- Parameters:
s- The string to be spannedspanCondition- The span condition- Returns:
- The string index which starts the span (i.e. inclusive).
-