Package com.ibm.icu.impl
Class UnicodeSetStringSpan
- java.lang.Object
-
- com.ibm.icu.impl.UnicodeSetStringSpan
-
public class UnicodeSetStringSpan extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intALLstatic intBACKstatic intBACK_UTF16_CONTAINEDstatic intBACK_UTF16_NOT_CONTAINEDstatic intCONTAINEDstatic intFWDstatic intFWD_UTF16_CONTAINEDstatic intFWD_UTF16_NOT_CONTAINEDstatic intNOT_CONTAINEDstatic intWITH_COUNT
-
Constructor Summary
Constructors Constructor Description UnicodeSetStringSpan(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(int c)For fast UnicodeSet::contains(c).booleanneedsStringSpanUTF16()Do 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 Detail
-
WITH_COUNT
public static final int WITH_COUNT
- See Also:
- Constant Field Values
-
FWD
public static final int FWD
- See Also:
- Constant Field Values
-
BACK
public static final int BACK
- See Also:
- Constant Field Values
-
CONTAINED
public static final int CONTAINED
- See Also:
- Constant Field Values
-
NOT_CONTAINED
public static final int NOT_CONTAINED
- See Also:
- Constant Field Values
-
ALL
public static final int ALL
- See Also:
- Constant Field Values
-
FWD_UTF16_CONTAINED
public static final int FWD_UTF16_CONTAINED
- See Also:
- Constant Field Values
-
FWD_UTF16_NOT_CONTAINED
public static final int FWD_UTF16_NOT_CONTAINED
- See Also:
- Constant Field Values
-
BACK_UTF16_CONTAINED
public static final int BACK_UTF16_CONTAINED
- See Also:
- Constant Field Values
-
BACK_UTF16_NOT_CONTAINED
public static final int BACK_UTF16_NOT_CONTAINED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UnicodeSetStringSpan
public UnicodeSetStringSpan(UnicodeSet set, ArrayList<String> setStrings, int which)
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 Detail
-
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
public int span(CharSequence s, int start, UnicodeSet.SpanCondition spanCondition)
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
public int spanBack(CharSequence s, int length, UnicodeSet.SpanCondition spanCondition)
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).
-
-