private boolean nextSegment ( ) { assert ( state == State . ITER_CHECK_FWD ) ; // The input text [start..(iter index)[ passes the FCD check. pos = iter . getIndex ( ) ; // Collect the characters being checked, in case they need to be normalized. if ( s == null ) { s = new StringBuilder ( ) ; } else { s . setLength ( 0 ) ; } int prevCC = 0 ; for ( ; ; ) { // Fetch the next character and its fcd16 value. int c = iter . nextCodePoint ( ) ; if ( c < 0 ) { break ; } int fcd16 = nfcImpl . getFCD16 ( c ) ; int leadCC = fcd16 >> 8 ; if ( leadCC == 0 && s . length ( ) != 0 ) { // FCD boundary before this character. iter . previousCodePoint ( ) ; break ; } s . appendCodePoint ( c ) ; if ( leadCC != 0 && ( prevCC > leadCC || CollationFCD . isFCD16OfTibetanCompositeVowel ( fcd16 ) ) ) { // Fails FCD check. Find the next FCD boundary and normalize. for ( ; ; ) { c = iter . nextCodePoint ( ) ; if ( c < 0 ) { break ; } if ( nfcImpl . getFCD16 ( c ) <= 0xff ) { iter . previousCodePoint ( ) ; break ; } s . appendCodePoint ( c ) ; } normalize ( s ) ; start = pos ; limit = pos + s . length ( ) ; state = State . IN_NORM_ITER_AT_LIMIT ; pos = 0 ; return true ; } prevCC = fcd16 & 0xff ; if ( prevCC == 0 ) { // FCD boundary after the last character. break ; } } limit = pos + s . length ( ) ; assert ( pos != limit ) ; iter . moveIndex ( - s . length ( ) ) ; state = State . ITER_IN_FCD_SEGMENT ; return true ; }
Extends the FCD text segment forward or normalizes around pos .