private void resolveNeutralTypes ( int start , int limit , byte level , byte sor , byte eor ) { for ( int i = start ; i < limit ; ++ i ) { byte t = resultTypes [ i ] ; if ( t == WS || t == ON || t == B || t == S ) { // find bounds of run of neutrals int runstart = i ; int runlimit = findRunLimit ( runstart , limit , new byte [ ] { B , S , WS , ON } ) ; // determine effective types at ends of run byte leadingType ; byte trailingType ; if ( runstart == start ) { leadingType = sor ; } else { leadingType = resultTypes [ runstart - 1 ] ; if ( leadingType == L || leadingType == R ) { // found the strong type } else if ( leadingType == AN ) { leadingType = R ; } else if ( leadingType == EN ) { // Since EN's with previous strong L types have been changed // to L in W7, the leadingType must be R. leadingType = R ; } } if ( runlimit == limit ) { trailingType = eor ; } else { trailingType = resultTypes [ runlimit ] ; if ( trailingType == L || trailingType == R ) { // found the strong type } else if ( trailingType == AN ) { trailingType = R ; } else if ( trailingType == EN ) { trailingType = R ; } } byte resolvedType ; if ( leadingType == trailingType ) { // Rule N1. resolvedType = leadingType ; } else { // Rule N2. // Notice the embedding level of the run is used, not // the paragraph embedding level. resolvedType = typeForLevel ( level ) ; } setTypes ( runstart , runlimit , resolvedType ) ; // skip over run of (former) neutrals i = runlimit ; } } }
6 ) resolving neutral types Rules N1 - N2 .