CompositeAffix(PeriodFieldAffix left, PeriodFieldAffix right) { iLeft = left; iRight = right; // We need to construct all possible combinations of left and right. // We are doing it once in constructor so that getAffixes() is quicker. Set<String> result = new HashSet<String>(); for (String leftText : iLeft.getAffixes()) { for (String rightText : iRight.getAffixes()) { result.add(leftText + rightText); } } iLeftRightCombinations = result.toArray(new String[result.size()]); }
CompositeAffix(PeriodFieldAffix left, PeriodFieldAffix right) { iLeft = left; iRight = right; // We need to construct all possible combinations of left and right. // We are doing it once in constructor so that getAffixes() is quicker. Set<String> result = new HashSet<String>(); for (String leftText : iLeft.getAffixes()) { for (String rightText : iRight.getAffixes()) { result.add(leftText + rightText); } } iLeftRightCombinations = result.toArray(new String[result.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()]); } }
CompositeAffix(PeriodFieldAffix left, PeriodFieldAffix right) { iLeft = left; iRight = right; // We need to construct all possible combinations of left and right. // We are doing it once in constructor so that getAffixes() is quicker. Set<String> result = new HashSet<String>(); for (String leftText : iLeft.getAffixes()) { for (String rightText : iRight.getAffixes()) { result.add(leftText + rightText); } } iLeftRightCombinations = result.toArray(new String[result.size()]); }
CompositeAffix(PeriodFieldAffix left, PeriodFieldAffix right) { iLeft = left; iRight = right; // We need to construct all possible combinations of left and right. // We are doing it once in constructor so that getAffixes() is quicker. Set<String> result = new HashSet<String>(); for (String leftText : iLeft.getAffixes()) { for (String rightText : iRight.getAffixes()) { result.add(leftText + rightText); } } iLeftRightCombinations = result.toArray(new String[result.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()]); } }