Class BMPSet


  • public final class BMPSet
    extends Object
    Helper class for frozen UnicodeSets, implements contains() and span() optimized for BMP code points. Latin-1: Look up bytes. 2-byte characters: Bits organized vertically. 3-byte characters: Use zero/one/mixed data per 64-block in U+0000..U+FFFF, with mixed for illegal ranges. Supplementary characters: Call contains() on the parent set.
    • Field Detail

      • U16_SURROGATE_OFFSET

        public static int U16_SURROGATE_OFFSET
    • Constructor Detail

      • BMPSet

        public BMPSet​(int[] parentList,
                      int parentListLength)
      • BMPSet

        public BMPSet​(BMPSet otherBMPSet,
                      int[] newParentList,
                      int newParentListLength)
    • Method Detail

      • contains

        public boolean contains​(int c)
      • span

        public final int span​(CharSequence s,
                              int start,
                              UnicodeSet.SpanCondition spanCondition,
                              OutputInt outCount)
        Span the initial substring for which each character c has spanCondition==contains(c). It must be spanCondition==0 or 1.
        Parameters:
        start - The start index
        outCount - If not null: Receives the number of code points in the span.
        Returns:
        the limit (exclusive end) of the span NOTE: to reduce the overhead of function call to contains(c), it is manually inlined here. Check for sufficient length for trail unit for each surrogate pair. Handle single surrogates as surrogate code points as usual in ICU.
      • spanBack

        public final int spanBack​(CharSequence s,
                                  int limit,
                                  UnicodeSet.SpanCondition spanCondition)
        Symmetrical with span(). Span the trailing substring for which each character c has spanCondition==contains(c). It must be s.length >= limit and spanCondition==0 or 1.
        Returns:
        The string index which starts the span (i.e. inclusive).