private void nextSegment ( ) { assert ( checkDir > 0 && seq == rawSeq && pos != limit ) ; // The input text [segmentStart..pos[ passes the FCD check. int p = pos ; int prevCC = 0 ; for ( ; ; ) { // Fetch the next character's fcd16 value. int q = p ; int c = Character . codePointAt ( seq , p ) ; p += Character . charCount ( c ) ; int fcd16 = nfcImpl . getFCD16 ( c ) ; int leadCC = fcd16 >> 8 ; if ( leadCC == 0 && q != pos ) { // FCD boundary before the [q, p[ character. limit = segmentLimit = q ; break ; } if ( leadCC != 0 && ( prevCC > leadCC || CollationFCD . isFCD16OfTibetanCompositeVowel ( fcd16 ) ) ) { // Fails FCD check. Find the next FCD boundary and normalize. do { q = p ; if ( p == rawLimit ) { break ; } c = Character . codePointAt ( seq , p ) ; p += Character . charCount ( c ) ; } while ( nfcImpl . getFCD16 ( c ) > 0xff ) ; normalize ( pos , q ) ; pos = start ; break ; } prevCC = fcd16 & 0xff ; if ( p == rawLimit || prevCC == 0 ) { // FCD boundary after the last character. limit = segmentLimit = p ; break ; } } assert ( pos != limit ) ; checkDir = 0 ; }
Extend the FCD text segment forward or normalize around pos . To be called when checkDir > 0 && pos ! = limit . Returns with checkDir == 0 and pos ! = limit .