private void setBestFractionRule ( int originalIndex , NFRule newRule , boolean rememberRule ) { if ( rememberRule ) { if ( fractionRules == null ) { fractionRules = new LinkedList < NFRule > ( ) ; } fractionRules . add ( newRule ) ; } NFRule bestResult = nonNumericalRules [ originalIndex ] ; if ( bestResult == null ) { nonNumericalRules [ originalIndex ] = newRule ; } else { // We have more than one. Which one is better? DecimalFormatSymbols decimalFormatSymbols = owner . getDecimalFormatSymbols ( ) ; if ( decimalFormatSymbols . getDecimalSeparator ( ) == newRule . getDecimalPoint ( ) ) { nonNumericalRules [ originalIndex ] = newRule ; } // else leave it alone } }
Determine the best fraction rule to use . Rules matching the decimal point from DecimalFormatSymbols become the main set of rules to use .