Class UnicodeSetStringSpan

java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.UnicodeSetStringSpan

public class UnicodeSetStringSpan extends Object
  • Field Details

  • Constructor Details

    • 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 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

      public int span(CharSequence s, int start, UnicodeSet.SpanCondition spanCondition)
      Spans a string.
      Parameters:
      s - The string to be spanned
      start - The start index that the span begins
      spanCondition - 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 spanned
      start - The start index that the span begins
      spanCondition - The span condition
      outCount - 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 spanned
      spanCondition - The span condition
      Returns:
      The string index which starts the span (i.e. inclusive).