public ULocale getBestMatch ( LocalePriorityList languageList ) { double bestWeight = 0 ; ULocale bestTableMatch = null ; double penalty = 0 ; OutputDouble matchWeight = new OutputDouble ( ) ; for ( final ULocale language : languageList ) { final ULocale matchLocale = getBestMatchInternal ( language , matchWeight ) ; final double weight = matchWeight . value * languageList . getWeight ( language ) - penalty ; if ( weight > bestWeight ) { bestWeight = weight ; bestTableMatch = matchLocale ; } penalty += 0.07000001 ; } if ( bestWeight < threshold ) { bestTableMatch = defaultLanguage ; } return bestTableMatch ; }
Get the best match for a LanguagePriorityList