public void finish(Set<PeriodFieldAffix> periodFieldAffixesToIgnore) { if (iOtherAffixes == null) { // Calculate the shortest affix in this instance. int shortestAffixLength = Integer.MAX_VALUE; String shortestAffix = null; for (String affix : getAffixes()) { if (affix.length() < shortestAffixLength) { shortestAffixLength = affix.length(); shortestAffix = affix; } } // Pick only affixes that are longer than the shortest affix in this instance. // This will reduce the number of parse operations and thus speed up the PeriodFormatter. // also need to pick affixes that differ only in case (but not those that are identical) Set<String> affixesToIgnore = new HashSet<String>(); for (PeriodFieldAffix periodFieldAffixToIgnore : periodFieldAffixesToIgnore) { if (periodFieldAffixToIgnore != null) { for (String affixToIgnore : periodFieldAffixToIgnore.getAffixes()) { if (affixToIgnore.length() > shortestAffixLength || (affixToIgnore.equalsIgnoreCase(shortestAffix) && !affixToIgnore.equals(shortestAffix))) { affixesToIgnore.add(affixToIgnore); } } } } iOtherAffixes = affixesToIgnore.toArray(new String[affixesToIgnore.size()]); } }
public void finish(Set<PeriodFieldAffix> periodFieldAffixesToIgnore) { if (iOtherAffixes == null) { // Calculate the shortest affix in this instance. int shortestAffixLength = Integer.MAX_VALUE; String shortestAffix = null; for (String affix : getAffixes()) { if (affix.length() < shortestAffixLength) { shortestAffixLength = affix.length(); shortestAffix = affix; } } // Pick only affixes that are longer than the shortest affix in this instance. // This will reduce the number of parse operations and thus speed up the PeriodFormatter. // also need to pick affixes that differ only in case (but not those that are identical) Set<String> affixesToIgnore = new HashSet<String>(); for (PeriodFieldAffix periodFieldAffixToIgnore : periodFieldAffixesToIgnore) { if (periodFieldAffixToIgnore != null) { for (String affixToIgnore : periodFieldAffixToIgnore.getAffixes()) { if (affixToIgnore.length() > shortestAffixLength || (affixToIgnore.equalsIgnoreCase(shortestAffix) && !affixToIgnore.equals(shortestAffix))) { affixesToIgnore.add(affixToIgnore); } } } } iOtherAffixes = affixesToIgnore.toArray(new String[affixesToIgnore.size()]); } }
public void finish(Set<PeriodFieldAffix> periodFieldAffixesToIgnore) { if (iOtherAffixes == null) { // Calculate the shortest affix in this instance. int shortestAffixLength = Integer.MAX_VALUE; String shortestAffix = null; for (String affix : getAffixes()) { if (affix.length() < shortestAffixLength) { shortestAffixLength = affix.length(); shortestAffix = affix; } } // Pick only affixes that are longer than the shortest affix in this instance. // This will reduce the number of parse operations and thus speed up the PeriodFormatter. // also need to pick affixes that differ only in case (but not those that are identical) Set<String> affixesToIgnore = new HashSet<String>(); for (PeriodFieldAffix periodFieldAffixToIgnore : periodFieldAffixesToIgnore) { if (periodFieldAffixToIgnore != null) { for (String affixToIgnore : periodFieldAffixToIgnore.getAffixes()) { if (affixToIgnore.length() > shortestAffixLength || (affixToIgnore.equalsIgnoreCase(shortestAffix) && !affixToIgnore.equals(shortestAffix))) { affixesToIgnore.add(affixToIgnore); } } } } iOtherAffixes = affixesToIgnore.toArray(new String[affixesToIgnore.size()]); } }
public void finish(Set<PeriodFieldAffix> periodFieldAffixesToIgnore) { if (iOtherAffixes == null) { // Calculate the shortest affix in this instance. int shortestAffixLength = Integer.MAX_VALUE; String shortestAffix = null; for (String affix : getAffixes()) { if (affix.length() < shortestAffixLength) { shortestAffixLength = affix.length(); shortestAffix = affix; } } // Pick only affixes that are longer than the shortest affix in this instance. // This will reduce the number of parse operations and thus speed up the PeriodFormatter. // also need to pick affixes that differ only in case (but not those that are identical) Set<String> affixesToIgnore = new HashSet<String>(); for (PeriodFieldAffix periodFieldAffixToIgnore : periodFieldAffixesToIgnore) { if (periodFieldAffixToIgnore != null) { for (String affixToIgnore : periodFieldAffixToIgnore.getAffixes()) { if (affixToIgnore.length() > shortestAffixLength || (affixToIgnore.equalsIgnoreCase(shortestAffix) && !affixToIgnore.equals(shortestAffix))) { affixesToIgnore.add(affixToIgnore); } } } } iOtherAffixes = affixesToIgnore.toArray(new String[affixesToIgnore.size()]); } }