mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 17:24:01 +00:00
ICU-7603 Migrating Vector to List.
X-SVN-Rev: 27905
This commit is contained in:
parent
cfb6018a50
commit
3b456d2c67
24 changed files with 677 additions and 651 deletions
|
@ -20,8 +20,8 @@ package com.ibm.icu.charset;
|
|||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.impl.IntTrie;
|
||||
import com.ibm.icu.impl.PropsVectors;
|
||||
|
@ -102,7 +102,7 @@ public final class CharsetSelector {
|
|||
// this is the context we will use. Store a table of indices to which
|
||||
// encodings are legit
|
||||
|
||||
Vector<String> result = new Vector<String>();
|
||||
List<String> result = new ArrayList<String>();
|
||||
int columns = (encodings.length + 31) / 32;
|
||||
int numOnes = countOnes(mask, columns);
|
||||
|
||||
|
@ -113,7 +113,7 @@ public final class CharsetSelector {
|
|||
int v = mask[j];
|
||||
for (int i = 0; i < 32 && k < encodings.length; i++, k++) {
|
||||
if ((v & 1) != 0) {
|
||||
result.addElement(encodings[k]);
|
||||
result.add(encodings[k]);
|
||||
}
|
||||
v >>= 1;
|
||||
}
|
||||
|
|
|
@ -8,10 +8,11 @@ package com.ibm.icu.text;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import java.util.List;
|
||||
|
||||
import com.ibm.icu.impl.IntTrieBuilder;
|
||||
import com.ibm.icu.impl.Norm2AllModes;
|
||||
|
@ -783,9 +784,9 @@ final class CollationParsedRuleBuilder {
|
|||
private static class MaxJamoExpansionTable {
|
||||
// package private data members --------------------------------------
|
||||
|
||||
Vector<Integer> m_endExpansionCE_;
|
||||
List<Integer> m_endExpansionCE_;
|
||||
// vector of booleans
|
||||
Vector<Boolean> m_isV_;
|
||||
List<Boolean> m_isV_;
|
||||
byte m_maxLSize_;
|
||||
byte m_maxVSize_;
|
||||
byte m_maxTSize_;
|
||||
|
@ -793,8 +794,8 @@ final class CollationParsedRuleBuilder {
|
|||
// package private constructor ---------------------------------------
|
||||
|
||||
MaxJamoExpansionTable() {
|
||||
m_endExpansionCE_ = new Vector<Integer>();
|
||||
m_isV_ = new Vector<Boolean>();
|
||||
m_endExpansionCE_ = new ArrayList<Integer>();
|
||||
m_isV_ = new ArrayList<Boolean>();
|
||||
m_endExpansionCE_.add(new Integer(0));
|
||||
m_isV_.add(Boolean.FALSE);
|
||||
m_maxLSize_ = 1;
|
||||
|
@ -803,8 +804,8 @@ final class CollationParsedRuleBuilder {
|
|||
}
|
||||
|
||||
MaxJamoExpansionTable(MaxJamoExpansionTable table) {
|
||||
m_endExpansionCE_ = new Vector<Integer>(table.m_endExpansionCE_);
|
||||
m_isV_ = new Vector<Boolean>(table.m_isV_);
|
||||
m_endExpansionCE_ = new ArrayList<Integer>(table.m_endExpansionCE_);
|
||||
m_isV_ = new ArrayList<Boolean>(table.m_isV_);
|
||||
m_maxLSize_ = table.m_maxLSize_;
|
||||
m_maxVSize_ = table.m_maxVSize_;
|
||||
m_maxTSize_ = table.m_maxTSize_;
|
||||
|
@ -815,35 +816,35 @@ final class CollationParsedRuleBuilder {
|
|||
// package private constructor --------------------------------------
|
||||
|
||||
MaxExpansionTable() {
|
||||
m_endExpansionCE_ = new Vector<Integer>();
|
||||
m_expansionCESize_ = new Vector<Byte>();
|
||||
m_endExpansionCE_ = new ArrayList<Integer>();
|
||||
m_expansionCESize_ = new ArrayList<Byte>();
|
||||
m_endExpansionCE_.add(new Integer(0));
|
||||
m_expansionCESize_.add(new Byte((byte) 0));
|
||||
}
|
||||
|
||||
MaxExpansionTable(MaxExpansionTable table) {
|
||||
m_endExpansionCE_ = new Vector<Integer>(table.m_endExpansionCE_);
|
||||
m_expansionCESize_ = new Vector<Byte>(table.m_expansionCESize_);
|
||||
m_endExpansionCE_ = new ArrayList<Integer>(table.m_endExpansionCE_);
|
||||
m_expansionCESize_ = new ArrayList<Byte>(table.m_expansionCESize_);
|
||||
}
|
||||
|
||||
// package private data member --------------------------------------
|
||||
|
||||
Vector<Integer> m_endExpansionCE_;
|
||||
Vector<Byte> m_expansionCESize_;
|
||||
List<Integer> m_endExpansionCE_;
|
||||
List<Byte> m_expansionCESize_;
|
||||
}
|
||||
|
||||
private static class BasicContractionTable {
|
||||
// package private constructors -------------------------------------
|
||||
|
||||
BasicContractionTable() {
|
||||
m_CEs_ = new Vector<Integer>();
|
||||
m_CEs_ = new ArrayList<Integer>();
|
||||
m_codePoints_ = new StringBuilder();
|
||||
}
|
||||
|
||||
// package private data members -------------------------------------
|
||||
|
||||
StringBuilder m_codePoints_;
|
||||
Vector<Integer> m_CEs_;
|
||||
List<Integer> m_CEs_;
|
||||
}
|
||||
|
||||
private static class ContractionTable {
|
||||
|
@ -856,10 +857,10 @@ final class CollationParsedRuleBuilder {
|
|||
*/
|
||||
ContractionTable(IntTrieBuilder mapping) {
|
||||
m_mapping_ = mapping;
|
||||
m_elements_ = new Vector<BasicContractionTable>();
|
||||
m_CEs_ = new Vector<Integer>();
|
||||
m_elements_ = new ArrayList<BasicContractionTable>();
|
||||
m_CEs_ = new ArrayList<Integer>();
|
||||
m_codePoints_ = new StringBuilder();
|
||||
m_offsets_ = new Vector<Integer>();
|
||||
m_offsets_ = new ArrayList<Integer>();
|
||||
m_currentTag_ = CE_NOT_FOUND_TAG_;
|
||||
}
|
||||
|
||||
|
@ -871,10 +872,10 @@ final class CollationParsedRuleBuilder {
|
|||
*/
|
||||
ContractionTable(ContractionTable table) {
|
||||
m_mapping_ = table.m_mapping_;
|
||||
m_elements_ = new Vector<BasicContractionTable>(table.m_elements_);
|
||||
m_elements_ = new ArrayList<BasicContractionTable>(table.m_elements_);
|
||||
m_codePoints_ = new StringBuilder(table.m_codePoints_);
|
||||
m_CEs_ = new Vector<Integer>(table.m_CEs_);
|
||||
m_offsets_ = new Vector<Integer>(table.m_offsets_);
|
||||
m_CEs_ = new ArrayList<Integer>(table.m_CEs_);
|
||||
m_offsets_ = new ArrayList<Integer>(table.m_offsets_);
|
||||
m_currentTag_ = table.m_currentTag_;
|
||||
}
|
||||
|
||||
|
@ -883,11 +884,11 @@ final class CollationParsedRuleBuilder {
|
|||
/**
|
||||
* Vector of BasicContractionTable
|
||||
*/
|
||||
Vector<BasicContractionTable> m_elements_;
|
||||
List<BasicContractionTable> m_elements_;
|
||||
IntTrieBuilder m_mapping_;
|
||||
StringBuilder m_codePoints_;
|
||||
Vector<Integer> m_CEs_;
|
||||
Vector<Integer> m_offsets_;
|
||||
List<Integer> m_CEs_;
|
||||
List<Integer> m_offsets_;
|
||||
int m_currentTag_;
|
||||
}
|
||||
|
||||
|
@ -1021,7 +1022,7 @@ final class CollationParsedRuleBuilder {
|
|||
MaxExpansionTable maxet = new MaxExpansionTable();
|
||||
MaxJamoExpansionTable maxjet = new MaxJamoExpansionTable();
|
||||
m_options_ = parser.m_options_;
|
||||
m_expansions_ = new Vector<Integer>();
|
||||
m_expansions_ = new ArrayList<Integer>();
|
||||
// Do your own mallocs for the structure, array and have linear
|
||||
// Latin 1
|
||||
int trieinitialvalue = RuleBasedCollator.CE_SPECIAL_FLAG_
|
||||
|
@ -1059,7 +1060,7 @@ final class CollationParsedRuleBuilder {
|
|||
BuildTable(BuildTable table) {
|
||||
m_collator_ = table.m_collator_;
|
||||
m_mapping_ = new IntTrieBuilder(table.m_mapping_);
|
||||
m_expansions_ = new Vector<Integer>(table.m_expansions_);
|
||||
m_expansions_ = new ArrayList<Integer>(table.m_expansions_);
|
||||
m_contractions_ = new ContractionTable(table.m_contractions_);
|
||||
m_contractions_.m_mapping_ = m_mapping_;
|
||||
m_options_ = table.m_options_;
|
||||
|
@ -1078,7 +1079,7 @@ final class CollationParsedRuleBuilder {
|
|||
|
||||
RuleBasedCollator m_collator_;
|
||||
IntTrieBuilder m_mapping_;
|
||||
Vector<Integer> m_expansions_;
|
||||
List<Integer> m_expansions_;
|
||||
ContractionTable m_contractions_;
|
||||
// UCATableHeader image;
|
||||
CollationRuleParser.OptionSet m_options_;
|
||||
|
@ -1988,7 +1989,7 @@ final class CollationParsedRuleBuilder {
|
|||
* @return ce
|
||||
*/
|
||||
private int addAnElement(BuildTable t, Elements element) {
|
||||
Vector<Integer> expansions = t.m_expansions_;
|
||||
List<Integer> expansions = t.m_expansions_;
|
||||
element.m_mapCE_ = 0;
|
||||
|
||||
if (element.m_CELength_ == 1) {
|
||||
|
@ -2170,7 +2171,7 @@ final class CollationParsedRuleBuilder {
|
|||
* of the expansion
|
||||
* @return the current position of the new element
|
||||
*/
|
||||
private static final int addExpansion(Vector<Integer> expansions, int value) {
|
||||
private static final int addExpansion(List<Integer> expansions, int value) {
|
||||
expansions.add(new Integer(value));
|
||||
return expansions.size() - 1;
|
||||
}
|
||||
|
@ -2227,10 +2228,8 @@ final class CollationParsedRuleBuilder {
|
|||
} else {
|
||||
// we'll need to squeeze the value into the array. initial
|
||||
// implementation. shifting the subarray down by 1
|
||||
maxexpansion.m_endExpansionCE_.insertElementAt(new Integer(
|
||||
endexpansion), start + 1);
|
||||
maxexpansion.m_expansionCESize_.insertElementAt(new Byte(
|
||||
expansionsize), start + 1);
|
||||
maxexpansion.m_endExpansionCE_.add(start + 1, new Integer(endexpansion));
|
||||
maxexpansion.m_expansionCESize_.add(start + 1, new Byte(expansionsize));
|
||||
}
|
||||
return maxexpansion.m_endExpansionCE_.size();
|
||||
}
|
||||
|
@ -2783,7 +2782,7 @@ final class CollationParsedRuleBuilder {
|
|||
offset++;
|
||||
}
|
||||
|
||||
tbl.m_CEs_.insertElementAt(new Integer(value), offset);
|
||||
tbl.m_CEs_.add(offset, new Integer(value));
|
||||
tbl.m_codePoints_.insert(offset, codePoint);
|
||||
|
||||
return constructSpecialCE(table.m_currentTag_, element);
|
||||
|
@ -3540,7 +3539,7 @@ final class CollationParsedRuleBuilder {
|
|||
*/
|
||||
private void assembleTable(BuildTable t, RuleBasedCollator collator) {
|
||||
IntTrieBuilder mapping = t.m_mapping_;
|
||||
Vector<Integer> expansions = t.m_expansions_;
|
||||
List<Integer> expansions = t.m_expansions_;
|
||||
ContractionTable contractions = t.m_contractions_;
|
||||
MaxExpansionTable maxexpansion = t.m_maxExpansions_;
|
||||
|
||||
|
@ -3662,7 +3661,7 @@ final class CollationParsedRuleBuilder {
|
|||
table.m_codePoints_.delete(0, table.m_codePoints_.length());
|
||||
// Now stuff the things in
|
||||
StringBuilder cpPointer = table.m_codePoints_;
|
||||
Vector<Integer> CEPointer = table.m_CEs_;
|
||||
List<Integer> CEPointer = table.m_CEs_;
|
||||
for (int i = 0; i < tsize; i++) {
|
||||
BasicContractionTable bct = table.m_elements_.get(i);
|
||||
int size = bct.m_CEs_.size();
|
||||
|
@ -4070,7 +4069,7 @@ final class CollationParsedRuleBuilder {
|
|||
}
|
||||
|
||||
private void setMapCE(BuildTable t, Elements element) {
|
||||
Vector<Integer> expansions = t.m_expansions_;
|
||||
List<Integer> expansions = t.m_expansions_;
|
||||
element.m_mapCE_ = 0;
|
||||
|
||||
if (element.m_CELength_ == 2 // a two CE expansion
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.Map;
|
|||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.ibm.icu.impl.URLHandler.URLVisitor;
|
||||
|
@ -1396,14 +1395,18 @@ public class ICUResourceBundle extends UResourceBundle {
|
|||
{
|
||||
return getKeys();
|
||||
}
|
||||
Vector<String> v = new Vector<String>();
|
||||
List<String> v = new ArrayList<String>();
|
||||
int size = getSize();
|
||||
for(int index = 0; index < size; index++)
|
||||
{
|
||||
String curKey = getKey(index);
|
||||
v.add(curKey);
|
||||
}
|
||||
return v.elements();
|
||||
|
||||
//TODO we should use Iterator or List as the return type
|
||||
// instead of Enumeration
|
||||
|
||||
return Collections.enumeration(v);
|
||||
}
|
||||
|
||||
// This is the worker function for the public getKeys().
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
package com.ibm.icu.impl;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.PropertyResourceBundle;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.UResourceBundle;
|
||||
|
@ -26,7 +28,7 @@ public class ResourceBundleWrapper extends UResourceBundle {
|
|||
private ResourceBundle bundle = null;
|
||||
private String localeID = null;
|
||||
private String baseName = null;
|
||||
private Vector<String> keys = null;
|
||||
private List<String> keys = null;
|
||||
// private int loadingStatus = -1;
|
||||
|
||||
private ResourceBundleWrapper(ResourceBundle bundle){
|
||||
|
@ -59,12 +61,12 @@ public class ResourceBundleWrapper extends UResourceBundle {
|
|||
}
|
||||
|
||||
public Enumeration<String> getKeys(){
|
||||
return keys.elements();
|
||||
return Collections.enumeration(keys);
|
||||
}
|
||||
|
||||
private void initKeysVector(){
|
||||
ResourceBundleWrapper current = this;
|
||||
keys = new Vector<String>();
|
||||
keys = new ArrayList<String>();
|
||||
while(current!=null){
|
||||
Enumeration<String> e = current.bundle.getKeys();
|
||||
while(e.hasMoreElements()){
|
||||
|
|
|
@ -10,8 +10,9 @@ package com.ibm.icu.text;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.CharacterIterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.impl.Assert;
|
||||
|
||||
|
@ -403,7 +404,7 @@ public class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
|
|||
// positions.)
|
||||
Stack<Integer> currentBreakPositions = new Stack<Integer>();
|
||||
Stack<Integer> possibleBreakPositions = new Stack<Integer>();
|
||||
Vector<Integer> wrongBreakPositions = new Vector<Integer>();
|
||||
List<Integer> wrongBreakPositions = new ArrayList<Integer>();
|
||||
|
||||
// the dictionary is implemented as a trie, which is treated as a state
|
||||
// machine. -1 represents the end of a legal word. Every word in the
|
||||
|
@ -515,7 +516,7 @@ public class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
|
|||
while (!currentBreakPositions.isEmpty() && temp.intValue() <
|
||||
currentBreakPositions.peek().intValue()) {
|
||||
temp2 = currentBreakPositions.pop();
|
||||
wrongBreakPositions.addElement(temp2);
|
||||
wrongBreakPositions.add(temp2);
|
||||
}
|
||||
currentBreakPositions.push(temp);
|
||||
text.setIndex(currentBreakPositions.peek().intValue());
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
package com.ibm.icu.text;
|
||||
|
||||
import java.text.ParsePosition;
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
|
@ -133,17 +134,17 @@ final class NFRuleSet {
|
|||
// the descriptions of the rules (one rule per element). The rules
|
||||
// are separated by semicolons (there's no escape facility: ALL
|
||||
// semicolons are rule delimiters)
|
||||
Vector<String> ruleDescriptions = new Vector<String>();
|
||||
List<String> ruleDescriptions = new ArrayList<String>();
|
||||
|
||||
int oldP = 0;
|
||||
int p = description.indexOf(';');
|
||||
while (oldP != -1) {
|
||||
if (p != -1) {
|
||||
ruleDescriptions.addElement(description.substring(oldP, p));
|
||||
ruleDescriptions.add(description.substring(oldP, p));
|
||||
oldP = p + 1;
|
||||
} else {
|
||||
if (oldP < description.length()) {
|
||||
ruleDescriptions.addElement(description.substring(oldP));
|
||||
ruleDescriptions.add(description.substring(oldP));
|
||||
}
|
||||
oldP = p;
|
||||
}
|
||||
|
@ -153,7 +154,7 @@ final class NFRuleSet {
|
|||
// now go back through and build a vector of the rules themselves
|
||||
// (the number of elements in the description list isn't necessarily
|
||||
// the number of rules-- some descriptions may expend into two rules)
|
||||
Vector<NFRule> tempRules = new Vector<NFRule>();
|
||||
List<NFRule> tempRules = new ArrayList<NFRule>();
|
||||
|
||||
// we keep track of the rule before the one we're currently working
|
||||
// on solely to support >>> substitutions
|
||||
|
@ -162,18 +163,18 @@ final class NFRuleSet {
|
|||
// makeRules (a factory method on NFRule) will return either
|
||||
// a single rule or an array of rules. Either way, add them
|
||||
// to our rule vector
|
||||
Object temp = NFRule.makeRules(ruleDescriptions.elementAt(i),
|
||||
Object temp = NFRule.makeRules(ruleDescriptions.get(i),
|
||||
this, predecessor, owner);
|
||||
|
||||
if (temp instanceof NFRule) {
|
||||
tempRules.addElement((NFRule)temp);
|
||||
tempRules.add((NFRule)temp);
|
||||
predecessor = (NFRule)temp;
|
||||
}
|
||||
else if (temp instanceof NFRule[]) {
|
||||
NFRule[] rulesToAdd = (NFRule[])temp;
|
||||
|
||||
for (int j = 0; j < rulesToAdd.length; j++) {
|
||||
tempRules.addElement(rulesToAdd[j]);
|
||||
tempRules.add(rulesToAdd[j]);
|
||||
predecessor = rulesToAdd[j];
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +193,7 @@ final class NFRuleSet {
|
|||
// we _didn't_ delete aything from the vector)
|
||||
int i = 0;
|
||||
while (i < tempRules.size()) {
|
||||
NFRule rule = tempRules.elementAt(i);
|
||||
NFRule rule = tempRules.get(i);
|
||||
|
||||
switch ((int)rule.getBaseValue()) {
|
||||
// if the rule's base value is 0, fill in a default
|
||||
|
@ -212,28 +213,28 @@ final class NFRuleSet {
|
|||
// data member and delete it from the list
|
||||
case NFRule.NEGATIVE_NUMBER_RULE:
|
||||
negativeNumberRule = rule;
|
||||
tempRules.removeElementAt(i);
|
||||
tempRules.remove(i);
|
||||
break;
|
||||
|
||||
// if it's the improper fraction rule, copy it into the
|
||||
// correct element of fractionRules
|
||||
case NFRule.IMPROPER_FRACTION_RULE:
|
||||
fractionRules[0] = rule;
|
||||
tempRules.removeElementAt(i);
|
||||
tempRules.remove(i);
|
||||
break;
|
||||
|
||||
// if it's the proper fraction rule, copy it into the
|
||||
// correct element of fractionRules
|
||||
case NFRule.PROPER_FRACTION_RULE:
|
||||
fractionRules[1] = rule;
|
||||
tempRules.removeElementAt(i);
|
||||
tempRules.remove(i);
|
||||
break;
|
||||
|
||||
// if it's the master rule, copy it into the
|
||||
// correct element of fractionRules
|
||||
case NFRule.MASTER_RULE:
|
||||
fractionRules[2] = rule;
|
||||
tempRules.removeElementAt(i);
|
||||
tempRules.remove(i);
|
||||
break;
|
||||
|
||||
// if it's a regular rule that already knows its base value,
|
||||
|
@ -256,7 +257,7 @@ final class NFRuleSet {
|
|||
// finally, we can copy the rules from the vector into a
|
||||
// fixed-length array
|
||||
rules = new NFRule[tempRules.size()];
|
||||
tempRules.copyInto((Object[])rules);
|
||||
tempRules.toArray(rules);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.impl.ICUCache;
|
||||
import com.ibm.icu.impl.ICUDebug;
|
||||
|
@ -52,8 +51,8 @@ public class Currency extends MeasureUnit implements Serializable {
|
|||
private static final boolean DEBUG = ICUDebug.enabled("currency");
|
||||
|
||||
// Cache to save currency name trie
|
||||
private static ICUCache<ULocale, Vector<TextTrieMap<CurrencyStringInfo>>> CURRENCY_NAME_CACHE =
|
||||
new SimpleCache<ULocale, Vector<TextTrieMap<CurrencyStringInfo>>>();
|
||||
private static ICUCache<ULocale, List<TextTrieMap<CurrencyStringInfo>>> CURRENCY_NAME_CACHE =
|
||||
new SimpleCache<ULocale, List<TextTrieMap<CurrencyStringInfo>>>();
|
||||
|
||||
/**
|
||||
* ISO 4217 3-letter code.
|
||||
|
@ -544,15 +543,15 @@ public class Currency extends MeasureUnit implements Serializable {
|
|||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static String parse(ULocale locale, String text, int type, ParsePosition pos) {
|
||||
Vector<TextTrieMap<CurrencyStringInfo>> currencyTrieVec = CURRENCY_NAME_CACHE.get(locale);
|
||||
List<TextTrieMap<CurrencyStringInfo>> currencyTrieVec = CURRENCY_NAME_CACHE.get(locale);
|
||||
if (currencyTrieVec == null) {
|
||||
TextTrieMap<CurrencyStringInfo> currencyNameTrie =
|
||||
new TextTrieMap<CurrencyStringInfo>(true);
|
||||
TextTrieMap<CurrencyStringInfo> currencySymbolTrie =
|
||||
new TextTrieMap<CurrencyStringInfo>(false);
|
||||
currencyTrieVec = new Vector<TextTrieMap<CurrencyStringInfo>>();
|
||||
currencyTrieVec.addElement(currencySymbolTrie);
|
||||
currencyTrieVec.addElement(currencyNameTrie);
|
||||
currencyTrieVec = new ArrayList<TextTrieMap<CurrencyStringInfo>>();
|
||||
currencyTrieVec.add(currencySymbolTrie);
|
||||
currencyTrieVec.add(currencyNameTrie);
|
||||
setupCurrencyTrieVec(locale, currencyTrieVec);
|
||||
CURRENCY_NAME_CACHE.put(locale, currencyTrieVec);
|
||||
}
|
||||
|
@ -561,7 +560,7 @@ public class Currency extends MeasureUnit implements Serializable {
|
|||
String isoResult = null;
|
||||
|
||||
// look for the names
|
||||
TextTrieMap<CurrencyStringInfo> currencyNameTrie = currencyTrieVec.elementAt(1);
|
||||
TextTrieMap<CurrencyStringInfo> currencyNameTrie = currencyTrieVec.get(1);
|
||||
CurrencyNameResultHandler handler = new CurrencyNameResultHandler();
|
||||
currencyNameTrie.find(text, pos.getIndex(), handler);
|
||||
List<CurrencyStringInfo> list = handler.getMatchedCurrencyNames();
|
||||
|
@ -577,7 +576,7 @@ public class Currency extends MeasureUnit implements Serializable {
|
|||
}
|
||||
|
||||
if (type != Currency.LONG_NAME) { // not long name only
|
||||
TextTrieMap<CurrencyStringInfo> currencySymbolTrie = currencyTrieVec.elementAt(0);
|
||||
TextTrieMap<CurrencyStringInfo> currencySymbolTrie = currencyTrieVec.get(0);
|
||||
handler = new CurrencyNameResultHandler();
|
||||
currencySymbolTrie.find(text, pos.getIndex(), handler);
|
||||
list = handler.getMatchedCurrencyNames();
|
||||
|
@ -599,10 +598,10 @@ public class Currency extends MeasureUnit implements Serializable {
|
|||
}
|
||||
|
||||
private static void setupCurrencyTrieVec(ULocale locale,
|
||||
Vector<TextTrieMap<CurrencyStringInfo>> trieVec) {
|
||||
List<TextTrieMap<CurrencyStringInfo>> trieVec) {
|
||||
|
||||
TextTrieMap<CurrencyStringInfo> symTrie = trieVec.elementAt(0);
|
||||
TextTrieMap<CurrencyStringInfo> trie = trieVec.elementAt(1);
|
||||
TextTrieMap<CurrencyStringInfo> symTrie = trieVec.get(0);
|
||||
TextTrieMap<CurrencyStringInfo> trie = trieVec.get(1);
|
||||
|
||||
CurrencyDisplayNames names = CurrencyDisplayNames.getInstance(locale);
|
||||
for (Map.Entry<String, String> e : names.symbolMap().entrySet()) {
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
|
||||
package com.ibm.icu.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <b>Note:</b> The Holiday framework is a technology preview.
|
||||
|
@ -49,7 +50,7 @@ public class RangeDateRule implements DateRule {
|
|||
public void add(Date start, DateRule rule) {
|
||||
// TODO: Insert in the right place
|
||||
// System.out.println("Add: " + start.toString());
|
||||
ranges.addElement(new Range(start, rule));
|
||||
ranges.add(new Range(start, rule));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -136,7 +137,7 @@ public class RangeDateRule implements DateRule {
|
|||
int lastIndex = ranges.size();
|
||||
|
||||
for (int i = 0; i < ranges.size(); i++) {
|
||||
Range r = ranges.elementAt(i);
|
||||
Range r = ranges.get(i);
|
||||
if (start.before(r.start)) {
|
||||
break;
|
||||
}
|
||||
|
@ -146,11 +147,11 @@ public class RangeDateRule implements DateRule {
|
|||
}
|
||||
|
||||
private Range rangeAt(int index) {
|
||||
return (index < ranges.size()) ? ranges.elementAt(index)
|
||||
return (index < ranges.size()) ? ranges.get(index)
|
||||
: null;
|
||||
}
|
||||
|
||||
Vector<Range> ranges = new Vector<Range>(2,2);
|
||||
List<Range> ranges = new ArrayList<Range>(2);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -8,13 +8,15 @@
|
|||
*****************************************************************
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.lang.UScript;
|
||||
/**
|
||||
|
@ -195,7 +197,7 @@ class AnyTransliterator extends Transliterator {
|
|||
|
||||
if (t != null) {
|
||||
if (!isWide(targetScript)) {
|
||||
Vector<Transliterator> v = new Vector<Transliterator>();
|
||||
List<Transliterator> v = new ArrayList<Transliterator>();
|
||||
v.add(widthFix);
|
||||
v.add(t);
|
||||
t = new CompoundTransliterator(v);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package com.ibm.icu.text;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.List;
|
||||
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.impl.UtilityExtensions;
|
||||
|
@ -100,11 +100,11 @@ class CompoundTransliterator extends Transliterator {
|
|||
* transliterators. The caller is responsible for fixing up the
|
||||
* ID.
|
||||
*/
|
||||
CompoundTransliterator(Vector<Transliterator> list) {
|
||||
CompoundTransliterator(List<Transliterator> list) {
|
||||
this(list, 0);
|
||||
}
|
||||
|
||||
CompoundTransliterator(Vector<Transliterator> list, int numAnonymousRBTs) {
|
||||
CompoundTransliterator(List<Transliterator> list, int numAnonymousRBTs) {
|
||||
super("", null);
|
||||
trans = null;
|
||||
init(list, FORWARD, false);
|
||||
|
@ -175,7 +175,7 @@ class CompoundTransliterator extends Transliterator {
|
|||
* entries by calling getID() of component entries. Some constructors
|
||||
* do not require this because they apply a facade ID anyway.
|
||||
*/
|
||||
private void init(Vector<Transliterator> list,
|
||||
private void init(List<Transliterator> list,
|
||||
int direction,
|
||||
boolean fixReverseID) {
|
||||
// assert(trans == 0);
|
||||
|
@ -189,7 +189,7 @@ class CompoundTransliterator extends Transliterator {
|
|||
int i;
|
||||
for (i=0; i<count; ++i) {
|
||||
int j = (direction == FORWARD) ? i : count - 1 - i;
|
||||
trans[i] = list.elementAt(j);
|
||||
trans[i] = list.get(j);
|
||||
}
|
||||
|
||||
// If the direction is UTRANS_REVERSE then we may need to fix the
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
package com.ibm.icu.text;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ibm.icu.impl.UtilityExtensions;
|
||||
|
||||
|
@ -28,7 +29,7 @@ class TransliterationRuleSet {
|
|||
/**
|
||||
* Vector of rules, in the order added.
|
||||
*/
|
||||
private Vector<TransliterationRule> ruleVector;
|
||||
private List<TransliterationRule> ruleVector;
|
||||
|
||||
/**
|
||||
* Length of the longest preceding context
|
||||
|
@ -54,7 +55,7 @@ class TransliterationRuleSet {
|
|||
* Construct a new empty rule set.
|
||||
*/
|
||||
public TransliterationRuleSet() {
|
||||
ruleVector = new Vector<TransliterationRule>();
|
||||
ruleVector = new ArrayList<TransliterationRule>();
|
||||
maxContextLength = 0;
|
||||
}
|
||||
|
||||
|
@ -72,7 +73,7 @@ class TransliterationRuleSet {
|
|||
* @param rule the rule to add
|
||||
*/
|
||||
public void addRule(TransliterationRule rule) {
|
||||
ruleVector.addElement(rule);
|
||||
ruleVector.add(rule);
|
||||
int len;
|
||||
if ((len = rule.getAnteContextLength()) > maxContextLength) {
|
||||
maxContextLength = len;
|
||||
|
@ -105,13 +106,13 @@ class TransliterationRuleSet {
|
|||
*/
|
||||
int n = ruleVector.size();
|
||||
index = new int[257]; // [sic]
|
||||
Vector<TransliterationRule> v = new Vector<TransliterationRule>(2*n); // heuristic; adjust as needed
|
||||
List<TransliterationRule> v = new ArrayList<TransliterationRule>(2*n); // heuristic; adjust as needed
|
||||
|
||||
/* Precompute the index values. This saves a LOT of time.
|
||||
*/
|
||||
int[] indexValue = new int[n];
|
||||
for (int j=0; j<n; ++j) {
|
||||
TransliterationRule r = ruleVector.elementAt(j);
|
||||
TransliterationRule r = ruleVector.get(j);
|
||||
indexValue[j] = r.getIndexValue();
|
||||
}
|
||||
for (int x=0; x<256; ++x) {
|
||||
|
@ -119,16 +120,16 @@ class TransliterationRuleSet {
|
|||
for (int j=0; j<n; ++j) {
|
||||
if (indexValue[j] >= 0) {
|
||||
if (indexValue[j] == x) {
|
||||
v.addElement(ruleVector.elementAt(j));
|
||||
v.add(ruleVector.get(j));
|
||||
}
|
||||
} else {
|
||||
// If the indexValue is < 0, then the first key character is
|
||||
// a set, and we must use the more time-consuming
|
||||
// matchesIndexValue check. In practice this happens
|
||||
// rarely, so we seldom tread this code path.
|
||||
TransliterationRule r = ruleVector.elementAt(j);
|
||||
TransliterationRule r = ruleVector.get(j);
|
||||
if (r.matchesIndexValue(x)) {
|
||||
v.addElement(r);
|
||||
v.add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +139,7 @@ class TransliterationRuleSet {
|
|||
/* Freeze things into an array.
|
||||
*/
|
||||
rules = new TransliterationRule[v.size()];
|
||||
v.copyInto(rules);
|
||||
v.toArray(rules);
|
||||
|
||||
StringBuilder errors = null;
|
||||
|
||||
|
@ -231,7 +232,7 @@ class TransliterationRuleSet {
|
|||
if (i != 0) {
|
||||
ruleSource.append('\n');
|
||||
}
|
||||
TransliterationRule r = ruleVector.elementAt(i);
|
||||
TransliterationRule r = ruleVector.get(i);
|
||||
ruleSource.append(r.toRule(escapeUnprintable));
|
||||
}
|
||||
return ruleSource.toString();
|
||||
|
@ -245,7 +246,7 @@ class TransliterationRuleSet {
|
|||
UnicodeSet set = new UnicodeSet();
|
||||
int count = ruleVector.size();
|
||||
for (int i=0; i<count; ++i) {
|
||||
TransliterationRule r = ruleVector.elementAt(i);
|
||||
TransliterationRule r = ruleVector.get(i);
|
||||
if (getTarget) {
|
||||
r.addTargetSetTo(set);
|
||||
} else {
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
package com.ibm.icu.text;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.impl.ICUResourceBundle;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
|
@ -1342,13 +1343,13 @@ public abstract class Transliterator implements StringTransform {
|
|||
public static Transliterator getInstance(String ID,
|
||||
int dir) {
|
||||
StringBuffer canonID = new StringBuffer();
|
||||
Vector<SingleID> list = new Vector<SingleID>();
|
||||
List<SingleID> list = new ArrayList<SingleID>();
|
||||
UnicodeSet[] globalFilter = new UnicodeSet[1];
|
||||
if (!TransliteratorIDParser.parseCompoundID(ID, dir, canonID, list, globalFilter)) {
|
||||
throw new IllegalArgumentException("Invalid ID " + ID);
|
||||
}
|
||||
|
||||
Vector<Transliterator> translits = TransliteratorIDParser.instantiateList(list);
|
||||
List<Transliterator> translits = TransliteratorIDParser.instantiateList(list);
|
||||
|
||||
// assert(list.size() > 0);
|
||||
Transliterator t = null;
|
||||
|
@ -1361,7 +1362,7 @@ public abstract class Transliterator implements StringTransform {
|
|||
t = new CompoundTransliterator(translits);
|
||||
}
|
||||
else {
|
||||
t = translits.elementAt(0);
|
||||
t = translits.get(0);
|
||||
}
|
||||
|
||||
t.setID(canonID.toString());
|
||||
|
@ -1434,7 +1435,7 @@ public abstract class Transliterator implements StringTransform {
|
|||
}
|
||||
}
|
||||
else {
|
||||
Vector<Transliterator> transliterators = new Vector<Transliterator>();
|
||||
List<Transliterator> transliterators = new ArrayList<Transliterator>();
|
||||
int passNumber = 1;
|
||||
|
||||
int limit = Math.max(parser.idBlockVector.size(), parser.dataVector.size());
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
package com.ibm.icu.text;
|
||||
|
||||
import java.text.ParsePosition;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import java.util.List;
|
||||
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.util.CaseInsensitiveString;
|
||||
|
@ -337,11 +338,11 @@ class TransliteratorIDParser {
|
|||
*/
|
||||
public static boolean parseCompoundID(String id, int dir,
|
||||
StringBuffer canonID,
|
||||
Vector<SingleID> list,
|
||||
List<SingleID> list,
|
||||
UnicodeSet[] globalFilter) {
|
||||
int[] pos = new int[] { 0 };
|
||||
int[] withParens = new int[1];
|
||||
list.removeAllElements();
|
||||
list.clear();
|
||||
UnicodeSet filter;
|
||||
globalFilter[0] = null;
|
||||
canonID.setLength(0);
|
||||
|
@ -367,9 +368,9 @@ class TransliteratorIDParser {
|
|||
break;
|
||||
}
|
||||
if (dir == FORWARD) {
|
||||
list.addElement(single);
|
||||
list.add(single);
|
||||
} else {
|
||||
list.insertElementAt(single, 0);
|
||||
list.add(0, single);
|
||||
}
|
||||
if (!Utility.parseChar(id, pos, ID_DELIM)) {
|
||||
sawDelimiter = false;
|
||||
|
@ -383,7 +384,7 @@ class TransliteratorIDParser {
|
|||
|
||||
// Construct canonical ID
|
||||
for (int i=0; i<list.size(); ++i) {
|
||||
SingleID single = list.elementAt(i);
|
||||
SingleID single = list.get(i);
|
||||
canonID.append(single.canonID);
|
||||
if (i != (list.size()-1)) {
|
||||
canonID.append(ID_DELIM);
|
||||
|
@ -421,9 +422,9 @@ class TransliteratorIDParser {
|
|||
* @param ids list vector of SingleID objects.
|
||||
* @return Actual transliterators for the list of SingleIDs
|
||||
*/
|
||||
static Vector<Transliterator> instantiateList(Vector<SingleID> ids) {
|
||||
static List<Transliterator> instantiateList(List<SingleID> ids) {
|
||||
Transliterator t;
|
||||
Vector<Transliterator> translits = new Vector<Transliterator>();
|
||||
List<Transliterator> translits = new ArrayList<Transliterator>();
|
||||
for (SingleID single : ids) {
|
||||
if (single.basicID.length() == 0) {
|
||||
continue;
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.text.ParsePosition;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.impl.IllegalIcuArgumentException;
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
|
@ -29,13 +28,13 @@ class TransliteratorParser {
|
|||
* A Vector of RuleBasedTransliterator.Data objects, one for each discrete group
|
||||
* of rules in the rule set
|
||||
*/
|
||||
public Vector<Data> dataVector;
|
||||
public List<Data> dataVector;
|
||||
|
||||
/**
|
||||
* PUBLIC data member.
|
||||
* A Vector of Strings containing all of the ID blocks in the rule set
|
||||
*/
|
||||
public Vector<String> idBlockVector;
|
||||
public List<String> idBlockVector;
|
||||
|
||||
/**
|
||||
* The current data object for which we are parsing rules
|
||||
|
@ -60,7 +59,7 @@ class TransliteratorParser {
|
|||
* is copied into the array data.variables. As with data.variables,
|
||||
* element 0 corresponds to character data.variablesBase.
|
||||
*/
|
||||
private Vector<Object> variablesVector;
|
||||
private List<Object> variablesVector;
|
||||
|
||||
/**
|
||||
* Temporary table of variable names. When parsing is complete, this is
|
||||
|
@ -81,7 +80,7 @@ class TransliteratorParser {
|
|||
* segmentStandins.charAt(0) is the standin for "$1" and corresponds
|
||||
* to StringMatcher object segmentObjects.elementAt(0), etc.
|
||||
*/
|
||||
private Vector<StringMatcher> segmentObjects;
|
||||
private List<StringMatcher> segmentObjects;
|
||||
|
||||
/**
|
||||
* The next available stand-in for variables. This starts at some point in
|
||||
|
@ -214,7 +213,7 @@ class TransliteratorParser {
|
|||
// set array has not been constructed yet.
|
||||
int i = ch - curData.variablesBase;
|
||||
if (i >= 0 && i < variablesVector.size()) {
|
||||
return (UnicodeMatcher) variablesVector.elementAt(i);
|
||||
return (UnicodeMatcher) variablesVector.get(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -250,7 +249,7 @@ class TransliteratorParser {
|
|||
// set array has not been constructed yet.
|
||||
int i = ch - curData.variablesBase;
|
||||
if (i >= 0 && i < variablesVector.size()) {
|
||||
return variablesVector.elementAt(i) instanceof UnicodeMatcher;
|
||||
return variablesVector.get(i) instanceof UnicodeMatcher;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -264,7 +263,7 @@ class TransliteratorParser {
|
|||
// set array has not been constructed yet.
|
||||
int i = ch - curData.variablesBase;
|
||||
if (i >= 0 && i < variablesVector.size()) {
|
||||
return variablesVector.elementAt(i) instanceof UnicodeReplacer;
|
||||
return variablesVector.get(i) instanceof UnicodeReplacer;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -896,12 +895,12 @@ class TransliteratorParser {
|
|||
boolean parsingIDs = true;
|
||||
int ruleCount = 0;
|
||||
|
||||
dataVector = new Vector<Data>();
|
||||
idBlockVector = new Vector<String>();
|
||||
dataVector = new ArrayList<Data>();
|
||||
idBlockVector = new ArrayList<String>();
|
||||
curData = null;
|
||||
direction = dir;
|
||||
compoundFilter = null;
|
||||
variablesVector = new Vector<Object>();
|
||||
variablesVector = new ArrayList<Object>();
|
||||
variableNames = new Hashtable<String, char[]>();
|
||||
parseData = new ParseData();
|
||||
|
||||
|
@ -973,7 +972,7 @@ class TransliteratorParser {
|
|||
if (direction == Transliterator.FORWARD)
|
||||
dataVector.add(curData);
|
||||
else
|
||||
dataVector.insertElementAt(curData, 0);
|
||||
dataVector.add(0, curData);
|
||||
curData = null;
|
||||
}
|
||||
parsingIDs = true;
|
||||
|
@ -1018,7 +1017,7 @@ class TransliteratorParser {
|
|||
if (direction == Transliterator.FORWARD)
|
||||
idBlockVector.add(idBlockResult.toString());
|
||||
else
|
||||
idBlockVector.insertElementAt(idBlockResult.toString(), 0);
|
||||
idBlockVector.add(0, idBlockResult.toString());
|
||||
idBlockResult.delete(0, idBlockResult.length());
|
||||
parsingIDs = false;
|
||||
curData = new RuleBasedTransliterator.Data();
|
||||
|
@ -1059,20 +1058,20 @@ class TransliteratorParser {
|
|||
if (direction == Transliterator.FORWARD)
|
||||
idBlockVector.add(idBlockResult.toString());
|
||||
else
|
||||
idBlockVector.insertElementAt(idBlockResult.toString(), 0);
|
||||
idBlockVector.add(0, idBlockResult.toString());
|
||||
}
|
||||
else if (!parsingIDs && curData != null) {
|
||||
if (direction == Transliterator.FORWARD)
|
||||
dataVector.add(curData);
|
||||
else
|
||||
dataVector.insertElementAt(curData, 0);
|
||||
dataVector.add(0, curData);
|
||||
}
|
||||
|
||||
// Convert the set vector to an array
|
||||
for (int i = 0; i < dataVector.size(); i++) {
|
||||
Data data = dataVector.get(i);
|
||||
data.variables = new Object[variablesVector.size()];
|
||||
variablesVector.copyInto(data.variables);
|
||||
variablesVector.toArray(data.variables);
|
||||
data.variableNames = new Hashtable<String, char[]>();
|
||||
data.variableNames.putAll(variableNames);
|
||||
}
|
||||
|
@ -1137,7 +1136,7 @@ class TransliteratorParser {
|
|||
|
||||
// Set up segments data
|
||||
segmentStandins = new StringBuffer();
|
||||
segmentObjects = new Vector<StringMatcher>();
|
||||
segmentObjects = new ArrayList<StringMatcher>();
|
||||
|
||||
RuleHalf left = new RuleHalf();
|
||||
RuleHalf right = new RuleHalf();
|
||||
|
@ -1227,7 +1226,7 @@ class TransliteratorParser {
|
|||
}
|
||||
}
|
||||
for (int i=0; i<segmentObjects.size(); ++i) {
|
||||
if (segmentObjects.elementAt(i) == null) {
|
||||
if (segmentObjects.get(i) == null) {
|
||||
syntaxError("Internal error", rule, start); // will never happen
|
||||
}
|
||||
}
|
||||
|
@ -1462,7 +1461,7 @@ class TransliteratorParser {
|
|||
// Look up previous stand-in, if any. This is a short list
|
||||
// (typical n is 0, 1, or 2); linear search is optimal.
|
||||
for (int i=0; i<variablesVector.size(); ++i) {
|
||||
if (variablesVector.elementAt(i) == obj) { // [sic] pointer comparison
|
||||
if (variablesVector.get(i) == obj) { // [sic] pointer comparison
|
||||
return (char) (curData.variablesBase + i);
|
||||
}
|
||||
}
|
||||
|
@ -1470,7 +1469,7 @@ class TransliteratorParser {
|
|||
if (variableNext >= variableLimit) {
|
||||
throw new RuntimeException("Variable range exhausted");
|
||||
}
|
||||
variablesVector.addElement(obj);
|
||||
variablesVector.add(obj);
|
||||
return variableNext++;
|
||||
}
|
||||
|
||||
|
@ -1490,7 +1489,7 @@ class TransliteratorParser {
|
|||
// Set a placeholder in the master variables vector that will be
|
||||
// filled in later by setSegmentObject(). We know that we will get
|
||||
// called first because setSegmentObject() will call us.
|
||||
variablesVector.addElement(null);
|
||||
variablesVector.add(null);
|
||||
segmentStandins.setCharAt(seg-1, c);
|
||||
}
|
||||
return c;
|
||||
|
@ -1504,16 +1503,16 @@ class TransliteratorParser {
|
|||
// segments will result in segment i+1 getting parsed
|
||||
// and stored before segment i; be careful with the
|
||||
// vector handling here.
|
||||
if (segmentObjects.size() < seg) {
|
||||
segmentObjects.setSize(seg);
|
||||
while (segmentObjects.size() < seg) {
|
||||
segmentObjects.add(null);
|
||||
}
|
||||
int index = getSegmentStandin(seg) - curData.variablesBase;
|
||||
if (segmentObjects.elementAt(seg-1) != null ||
|
||||
variablesVector.elementAt(index) != null) {
|
||||
if (segmentObjects.get(seg-1) != null ||
|
||||
variablesVector.get(index) != null) {
|
||||
throw new RuntimeException(); // should never happen
|
||||
}
|
||||
segmentObjects.setElementAt(obj, seg-1);
|
||||
variablesVector.setElementAt(obj, index);
|
||||
segmentObjects.set(seg-1, obj);
|
||||
variablesVector.set(index, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,12 +10,14 @@
|
|||
|
||||
package com.ibm.icu.text;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.impl.ICUResourceBundle;
|
||||
import com.ibm.icu.impl.LocaleUtility;
|
||||
|
@ -57,12 +59,12 @@ class TransliteratorRegistry {
|
|||
* Values are Hashtable of (CaseInsensitiveString -> Vector of
|
||||
* CaseInsensitiveString)
|
||||
*/
|
||||
private Hashtable<CaseInsensitiveString, Hashtable<CaseInsensitiveString, Vector<CaseInsensitiveString>>> specDAG;
|
||||
private Hashtable<CaseInsensitiveString, Hashtable<CaseInsensitiveString, List<CaseInsensitiveString>>> specDAG;
|
||||
|
||||
/**
|
||||
* Vector of public full IDs (CaseInsensitiveString objects).
|
||||
*/
|
||||
private Vector<CaseInsensitiveString> availableIDs;
|
||||
private List<CaseInsensitiveString> availableIDs;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class Spec
|
||||
|
@ -242,12 +244,12 @@ class TransliteratorRegistry {
|
|||
|
||||
static class CompoundRBTEntry {
|
||||
private String ID;
|
||||
private Vector<String> idBlockVector;
|
||||
private Vector<Data> dataVector;
|
||||
private List<String> idBlockVector;
|
||||
private List<Data> dataVector;
|
||||
private UnicodeSet compoundFilter;
|
||||
|
||||
public CompoundRBTEntry(String theID, Vector<String> theIDBlockVector,
|
||||
Vector<Data> theDataVector,
|
||||
public CompoundRBTEntry(String theID, List<String> theIDBlockVector,
|
||||
List<Data> theDataVector,
|
||||
UnicodeSet theCompoundFilter) {
|
||||
ID = theID;
|
||||
idBlockVector = theIDBlockVector;
|
||||
|
@ -256,7 +258,7 @@ class TransliteratorRegistry {
|
|||
}
|
||||
|
||||
public Transliterator getInstance() {
|
||||
Vector<Transliterator> transliterators = new Vector<Transliterator>();
|
||||
List<Transliterator> transliterators = new ArrayList<Transliterator>();
|
||||
int passNumber = 1;
|
||||
|
||||
int limit = Math.max(idBlockVector.size(), dataVector.size());
|
||||
|
@ -287,8 +289,8 @@ class TransliteratorRegistry {
|
|||
|
||||
public TransliteratorRegistry() {
|
||||
registry = new Hashtable<CaseInsensitiveString, Object[]>();
|
||||
specDAG = new Hashtable<CaseInsensitiveString, Hashtable<CaseInsensitiveString, Vector<CaseInsensitiveString>>>();
|
||||
availableIDs = new Vector<CaseInsensitiveString>();
|
||||
specDAG = new Hashtable<CaseInsensitiveString, Hashtable<CaseInsensitiveString, List<CaseInsensitiveString>>>();
|
||||
availableIDs = new ArrayList<CaseInsensitiveString>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -376,7 +378,7 @@ class TransliteratorRegistry {
|
|||
String id = TransliteratorIDParser.STVtoID(stv[0], stv[1], stv[2]);
|
||||
registry.remove(new CaseInsensitiveString(id));
|
||||
removeSTV(stv[0], stv[1], stv[2]);
|
||||
availableIDs.removeElement(new CaseInsensitiveString(id));
|
||||
availableIDs.remove(new CaseInsensitiveString(id));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -412,7 +414,7 @@ class TransliteratorRegistry {
|
|||
public Enumeration<String> getAvailableIDs() {
|
||||
// Since the cache contains CaseInsensitiveString objects, but
|
||||
// the caller expects Strings, we have to use an intermediary.
|
||||
return new IDEnumeration(availableIDs.elements());
|
||||
return new IDEnumeration(Collections.enumeration(availableIDs));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -432,7 +434,7 @@ class TransliteratorRegistry {
|
|||
*/
|
||||
public Enumeration<String> getAvailableTargets(String source) {
|
||||
CaseInsensitiveString cisrc = new CaseInsensitiveString(source);
|
||||
Hashtable<CaseInsensitiveString, Vector<CaseInsensitiveString>> targets = specDAG.get(cisrc);
|
||||
Hashtable<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc);
|
||||
if (targets == null) {
|
||||
return new IDEnumeration(null);
|
||||
}
|
||||
|
@ -448,15 +450,15 @@ class TransliteratorRegistry {
|
|||
public Enumeration<String> getAvailableVariants(String source, String target) {
|
||||
CaseInsensitiveString cisrc = new CaseInsensitiveString(source);
|
||||
CaseInsensitiveString citrg = new CaseInsensitiveString(target);
|
||||
Hashtable<CaseInsensitiveString, Vector<CaseInsensitiveString>> targets = specDAG.get(cisrc);
|
||||
Hashtable<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc);
|
||||
if (targets == null) {
|
||||
return new IDEnumeration(null);
|
||||
}
|
||||
Vector<CaseInsensitiveString> variants = targets.get(citrg);
|
||||
List<CaseInsensitiveString> variants = targets.get(citrg);
|
||||
if (variants == null) {
|
||||
return new IDEnumeration(null);
|
||||
}
|
||||
return new IDEnumeration(variants.elements());
|
||||
return new IDEnumeration(Collections.enumeration(variants));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -515,11 +517,11 @@ class TransliteratorRegistry {
|
|||
if (visible) {
|
||||
registerSTV(source, target, variant);
|
||||
if (!availableIDs.contains(ciID)) {
|
||||
availableIDs.addElement(ciID);
|
||||
availableIDs.add(ciID);
|
||||
}
|
||||
} else {
|
||||
removeSTV(source, target, variant);
|
||||
availableIDs.removeElement(ciID);
|
||||
availableIDs.remove(ciID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,14 +539,14 @@ class TransliteratorRegistry {
|
|||
CaseInsensitiveString cisrc = new CaseInsensitiveString(source);
|
||||
CaseInsensitiveString citrg = new CaseInsensitiveString(target);
|
||||
CaseInsensitiveString civar = new CaseInsensitiveString(variant);
|
||||
Hashtable<CaseInsensitiveString, Vector<CaseInsensitiveString>> targets = specDAG.get(cisrc);
|
||||
Hashtable<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc);
|
||||
if (targets == null) {
|
||||
targets = new Hashtable<CaseInsensitiveString, Vector<CaseInsensitiveString>>();
|
||||
targets = new Hashtable<CaseInsensitiveString, List<CaseInsensitiveString>>();
|
||||
specDAG.put(cisrc, targets);
|
||||
}
|
||||
Vector<CaseInsensitiveString> variants = targets.get(citrg);
|
||||
List<CaseInsensitiveString> variants = targets.get(citrg);
|
||||
if (variants == null) {
|
||||
variants = new Vector<CaseInsensitiveString>();
|
||||
variants = new ArrayList<CaseInsensitiveString>();
|
||||
targets.put(citrg, variants);
|
||||
}
|
||||
// assert(NO_VARIANT == "");
|
||||
|
@ -552,9 +554,9 @@ class TransliteratorRegistry {
|
|||
// string, that is, the empty string, we add it at position zero.
|
||||
if (!variants.contains(civar)) {
|
||||
if (variant.length() > 0) {
|
||||
variants.addElement(civar);
|
||||
variants.add(civar);
|
||||
} else {
|
||||
variants.insertElementAt(civar, 0);
|
||||
variants.add(0, civar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -570,15 +572,15 @@ class TransliteratorRegistry {
|
|||
CaseInsensitiveString cisrc = new CaseInsensitiveString(source);
|
||||
CaseInsensitiveString citrg = new CaseInsensitiveString(target);
|
||||
CaseInsensitiveString civar = new CaseInsensitiveString(variant);
|
||||
Hashtable<CaseInsensitiveString, Vector<CaseInsensitiveString>> targets = specDAG.get(cisrc);
|
||||
Hashtable<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc);
|
||||
if (targets == null) {
|
||||
return; // should never happen for valid s-t/v
|
||||
}
|
||||
Vector<CaseInsensitiveString> variants = targets.get(citrg);
|
||||
List<CaseInsensitiveString> variants = targets.get(citrg);
|
||||
if (variants == null) {
|
||||
return; // should never happen for valid s-t/v
|
||||
}
|
||||
variants.removeElement(civar);
|
||||
variants.remove(civar);
|
||||
if (variants.size() == 0) {
|
||||
targets.remove(citrg); // should delete variants
|
||||
if (targets.size() == 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 1996-2009, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
@ -20,8 +20,8 @@
|
|||
package com.ibm.icu.dev.test.charset;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.charset.CharsetICU;
|
||||
import com.ibm.icu.charset.CharsetProviderICU;
|
||||
|
@ -57,7 +57,7 @@ public class TestSelection extends TestFmwk {
|
|||
}
|
||||
}
|
||||
|
||||
private void verifyResultUTF16(String s, Vector encodings, List result,
|
||||
private void verifyResultUTF16(String s, List encodings, List result,
|
||||
UnicodeSet excludedEncodings, int mappingTypes) {
|
||||
boolean[] resultsFromSystem = new boolean[availableCharsetNames.length];
|
||||
boolean[] resultsManually = new boolean[availableCharsetNames.length];
|
||||
|
@ -148,7 +148,7 @@ public class TestSelection extends TestFmwk {
|
|||
for (int testCaseIdx = 0, prev = 0; testCaseIdx < encodingsTestCases.length; testCaseIdx++) {
|
||||
if (encodingsTestCases[testCaseIdx] != -1)
|
||||
continue;
|
||||
Vector encodings = new Vector();
|
||||
List encodings = new ArrayList();
|
||||
for (int i = prev; i < testCaseIdx; i++) {
|
||||
encodings.add(availableCharsetNames[encodingsTestCases[i]]);
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class TestSelection extends TestFmwk {
|
|||
|
||||
/* This test is to provide better code coverage for CharsetSelector */
|
||||
public void TestCharsetSelectorCodeCoverage() {
|
||||
Vector emptyList = new Vector();
|
||||
List emptyList = new ArrayList();
|
||||
UnicodeSet nonEmptySet = new UnicodeSet();
|
||||
|
||||
nonEmptySet.add(0x0001, 0x0FFF);
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
package com.ibm.icu.dev.test.collator;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.text.CollationElementIterator;
|
||||
|
@ -1055,18 +1056,18 @@ public class CollationRegressionTest extends TestFmwk {
|
|||
String text = "T\u00f6ne"; // o-umlaut
|
||||
|
||||
CollationElementIterator iter = coll.getCollationElementIterator(text);
|
||||
Vector elements = new Vector();
|
||||
List elements = new ArrayList();
|
||||
int elem;
|
||||
|
||||
// Iterate forward and collect all of the elements into a Vector
|
||||
while ((elem = iter.next()) != CollationElementIterator.NULLORDER) {
|
||||
elements.addElement(new Integer(elem));
|
||||
elements.add(new Integer(elem));
|
||||
}
|
||||
|
||||
// Now iterate backward and make sure they're the same
|
||||
int index = elements.size() - 1;
|
||||
while ((elem = iter.previous()) != CollationElementIterator.NULLORDER) {
|
||||
int expect = ((Integer)elements.elementAt(index)).intValue();
|
||||
int expect = ((Integer)elements.get(index)).intValue();
|
||||
|
||||
if (elem != expect) {
|
||||
errln("Mismatch at index " + index
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2006, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2010, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.collator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.dev.test.ModuleTest;
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
|
@ -290,7 +291,7 @@ public class CollationTest extends ModuleTest{
|
|||
m_sequenceIndex_ = 0;
|
||||
m_nextRelation_ = -1;
|
||||
m_target_.delete(0, m_target_.length());
|
||||
Vector vector = new Vector();
|
||||
List vector = new ArrayList();
|
||||
int lastsmallerthanindex = -1;
|
||||
getNextInSequence();
|
||||
while (getNextInSequence()) {
|
||||
|
@ -298,7 +299,7 @@ public class CollationTest extends ModuleTest{
|
|||
doTest(this, col, m_source_, target, m_relation_);
|
||||
int vsize = vector.size();
|
||||
for (int i = vsize - 1; i >= 0; i --) {
|
||||
String source = (String)vector.elementAt(i);
|
||||
String source = (String)vector.get(i);
|
||||
if (i > lastsmallerthanindex) {
|
||||
doTest(this, col, source, target, m_relation_);
|
||||
}
|
||||
|
@ -306,7 +307,7 @@ public class CollationTest extends ModuleTest{
|
|||
doTest(this, col, source, target, -1);
|
||||
}
|
||||
}
|
||||
vector.addElement(target);
|
||||
vector.add(target);
|
||||
if (m_relation_ < 0) {
|
||||
lastsmallerthanindex = vsize - 1;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public class DiagBigDecimal extends TestFmwk {
|
|||
//private static final java.lang.String $0 = "DiagBigDecimal.nrx";
|
||||
|
||||
/* properties shared */
|
||||
java.util.Vector Tests = new java.util.Vector(100); // scaffolding
|
||||
java.util.List Tests = new java.util.ArrayList(100); // scaffolding
|
||||
|
||||
/* properties private */
|
||||
private int totalcount = 0; // counts tests run
|
||||
|
@ -5425,7 +5425,7 @@ public class DiagBigDecimal extends TestFmwk {
|
|||
int $144 = count;
|
||||
i = 0;
|
||||
for (; $144 > 0; $144--, i++) {
|
||||
item = (Test) (Tests.elementAt(i));
|
||||
item = (Test) (Tests.get(i));
|
||||
if ((!item.ok))
|
||||
{
|
||||
bad++;
|
||||
|
@ -5434,7 +5434,7 @@ public class DiagBigDecimal extends TestFmwk {
|
|||
}
|
||||
}/*i*/
|
||||
totalcount = totalcount + count;
|
||||
Tests = new java.util.Vector(100); // reinitialize
|
||||
Tests = new java.util.ArrayList(100); // reinitialize
|
||||
if (bad == 0)
|
||||
say("OK" + " " + left(section, 14) + " "
|
||||
+ right("[" + count + " " + "tests]", 12));
|
||||
|
@ -5566,7 +5566,7 @@ public class DiagBigDecimal extends TestFmwk {
|
|||
public Test(java.lang.String testname) {
|
||||
super();
|
||||
name = testname; // save the name
|
||||
DiagBigDecimal.this.Tests.addElement((java.lang.Object) this); // and add to parent's list
|
||||
DiagBigDecimal.this.Tests.add((java.lang.Object) this); // and add to parent's list
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2009, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2010, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -16,9 +16,10 @@ import java.text.AttributedCharacterIterator;
|
|||
import java.text.FieldPosition;
|
||||
import java.text.Format;
|
||||
import java.text.ParsePosition;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.text.DecimalFormat;
|
||||
import com.ibm.icu.text.DecimalFormatSymbols;
|
||||
|
@ -321,8 +322,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
getZeroVector());
|
||||
}
|
||||
|
||||
private static Vector getNumberVectorUS() {
|
||||
Vector v = new Vector();
|
||||
private static List<FieldContainer> getNumberVectorUS() {
|
||||
List<FieldContainer> v = new ArrayList<FieldContainer>(3);
|
||||
v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER));
|
||||
v.add(new FieldContainer(3, 4, NumberFormat.Field.DECIMAL_SEPARATOR));
|
||||
v.add(new FieldContainer(4, 6, NumberFormat.Field.FRACTION));
|
||||
|
@ -344,8 +345,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
// return v;
|
||||
// }
|
||||
|
||||
private static Vector getPositiveCurrencyVectorUS() {
|
||||
Vector v = new Vector();
|
||||
private static List<FieldContainer> getPositiveCurrencyVectorUS() {
|
||||
List<FieldContainer> v = new ArrayList<FieldContainer>(4);
|
||||
v.add(new FieldContainer(0, 1, NumberFormat.Field.CURRENCY));
|
||||
v.add(new FieldContainer(1, 4, NumberFormat.Field.INTEGER));
|
||||
v.add(new FieldContainer(4, 5, NumberFormat.Field.DECIMAL_SEPARATOR));
|
||||
|
@ -353,8 +354,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
return v;
|
||||
}
|
||||
|
||||
private static Vector getNegativeCurrencyVectorUS() {
|
||||
Vector v = new Vector();
|
||||
private static List<FieldContainer> getNegativeCurrencyVectorUS() {
|
||||
List<FieldContainer> v = new ArrayList<FieldContainer>(4);
|
||||
v.add(new FieldContainer(1, 2, NumberFormat.Field.CURRENCY));
|
||||
v.add(new FieldContainer(2, 5, NumberFormat.Field.INTEGER));
|
||||
v.add(new FieldContainer(5, 6, NumberFormat.Field.DECIMAL_SEPARATOR));
|
||||
|
@ -362,8 +363,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
return v;
|
||||
}
|
||||
|
||||
private static Vector getPercentVectorUS() {
|
||||
Vector v = new Vector();
|
||||
private static List<FieldContainer> getPercentVectorUS() {
|
||||
List<FieldContainer> v = new ArrayList<FieldContainer>(5);
|
||||
v.add(new FieldContainer(0, 2, NumberFormat.Field.INTEGER));
|
||||
v.add(new FieldContainer(2, 3, NumberFormat.Field.INTEGER));
|
||||
v.add(new FieldContainer(2, 3, NumberFormat.Field.GROUPING_SEPARATOR));
|
||||
|
@ -372,15 +373,15 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
return v;
|
||||
}
|
||||
|
||||
private static Vector getPermilleVector() {
|
||||
Vector v = new Vector();
|
||||
private static List<FieldContainer> getPermilleVector() {
|
||||
List<FieldContainer> v = new ArrayList<FieldContainer>(2);
|
||||
v.add(new FieldContainer(0, 6, NumberFormat.Field.INTEGER));
|
||||
v.add(new FieldContainer(6, 7, NumberFormat.Field.PERMILLE));
|
||||
return v;
|
||||
}
|
||||
|
||||
private static Vector getNegativeExponentVector() {
|
||||
Vector v = new Vector();
|
||||
private static List<FieldContainer> getNegativeExponentVector() {
|
||||
List<FieldContainer> v = new ArrayList<FieldContainer>(6);
|
||||
v.add(new FieldContainer(0, 4, NumberFormat.Field.INTEGER));
|
||||
v.add(new FieldContainer(4, 5, NumberFormat.Field.DECIMAL_SEPARATOR));
|
||||
v.add(new FieldContainer(5, 6, NumberFormat.Field.FRACTION));
|
||||
|
@ -390,8 +391,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
return v;
|
||||
}
|
||||
|
||||
private static Vector getPositiveExponentVector() {
|
||||
Vector v = new Vector();
|
||||
private static List<FieldContainer> getPositiveExponentVector() {
|
||||
List<FieldContainer> v = new ArrayList<FieldContainer>(5);
|
||||
v.add(new FieldContainer(0, 2, NumberFormat.Field.INTEGER));
|
||||
v.add(new FieldContainer(2, 3, NumberFormat.Field.DECIMAL_SEPARATOR));
|
||||
v.add(new FieldContainer(3, 5, NumberFormat.Field.FRACTION));
|
||||
|
@ -400,8 +401,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
return v;
|
||||
}
|
||||
|
||||
private static Vector getNumberVector2US() {
|
||||
Vector v = new Vector();
|
||||
private static List<FieldContainer> getNumberVector2US() {
|
||||
List<FieldContainer> v = new ArrayList<FieldContainer>(7);
|
||||
v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER));
|
||||
v.add(new FieldContainer(3, 4, NumberFormat.Field.GROUPING_SEPARATOR));
|
||||
v.add(new FieldContainer(3, 4, NumberFormat.Field.INTEGER));
|
||||
|
@ -412,15 +413,15 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
return v;
|
||||
}
|
||||
|
||||
private static Vector getZeroVector() {
|
||||
Vector v = new Vector();
|
||||
private static List<FieldContainer> getZeroVector() {
|
||||
List<FieldContainer> v = new ArrayList<FieldContainer>(1);
|
||||
v.add(new FieldContainer(0, 1, NumberFormat.Field.INTEGER));
|
||||
return v;
|
||||
}
|
||||
|
||||
private void t_Format(int count, Object object, Format format,
|
||||
Vector expectedResults) {
|
||||
Vector results = findFields(format.formatToCharacterIterator(object));
|
||||
List<FieldContainer> expectedResults) {
|
||||
List<FieldContainer> results = findFields(format.formatToCharacterIterator(object));
|
||||
assertTrue("Test " + count
|
||||
+ ": Format returned incorrect CharacterIterator for "
|
||||
+ format.format(object), compare(results, expectedResults));
|
||||
|
@ -429,7 +430,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
/**
|
||||
* compares two vectors regardless of the order of their elements
|
||||
*/
|
||||
private static boolean compare(Vector vector1, Vector vector2) {
|
||||
private static boolean compare(List vector1, List vector2) {
|
||||
return vector1.size() == vector2.size() && vector1.containsAll(vector2);
|
||||
}
|
||||
|
||||
|
@ -442,8 +443,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
|
|||
* which stores start and end indexes and an attribute this range
|
||||
* has
|
||||
*/
|
||||
private static Vector findFields(AttributedCharacterIterator iterator) {
|
||||
Vector result = new Vector();
|
||||
private static List<FieldContainer> findFields(AttributedCharacterIterator iterator) {
|
||||
List<FieldContainer> result = new ArrayList<FieldContainer>();
|
||||
while (iterator.getIndex() != iterator.getEndIndex()) {
|
||||
int start = iterator.getRunStart();
|
||||
int end = iterator.getRunLimit();
|
||||
|
|
|
@ -10,8 +10,9 @@ package com.ibm.icu.dev.test.lang;
|
|||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.dev.test.TestUtil;
|
||||
|
@ -906,7 +907,7 @@ public final class UCharacterCaseTest extends TestFmwk
|
|||
*/
|
||||
private String[] getUnicodeStrings(String str)
|
||||
{
|
||||
Vector v = new Vector(10);
|
||||
List<String> v = new ArrayList<String>(10);
|
||||
int start = 0;
|
||||
for (int casecount = 4; casecount > 0; casecount --) {
|
||||
int end = str.indexOf("; ", start);
|
||||
|
@ -945,7 +946,7 @@ public final class UCharacterCaseTest extends TestFmwk
|
|||
int size = v.size();
|
||||
String result[] = new String[size];
|
||||
for (int i = 0; i < size; i ++) {
|
||||
result[i] = (String)v.elementAt(i);
|
||||
result[i] = v.get(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,9 @@ import java.io.FileInputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.StringCharacterIterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.text.BreakIterator;
|
||||
|
@ -47,19 +48,19 @@ public class BreakIteratorTest extends TestFmwk
|
|||
// general test subroutines
|
||||
//=========================================================================
|
||||
|
||||
private void generalIteratorTest(BreakIterator bi, Vector expectedResult) {
|
||||
private void generalIteratorTest(BreakIterator bi, List<String> expectedResult) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
String text;
|
||||
for (int i = 0; i < expectedResult.size(); i++) {
|
||||
text = (String)expectedResult.elementAt(i);
|
||||
text = expectedResult.get(i);
|
||||
buffer.append(text);
|
||||
}
|
||||
text = buffer.toString();
|
||||
|
||||
bi.setText(text);
|
||||
|
||||
Vector nextResults = _testFirstAndNext(bi, text);
|
||||
Vector previousResults = _testLastAndPrevious(bi, text);
|
||||
List<String> nextResults = _testFirstAndNext(bi, text);
|
||||
List<String> previousResults = _testLastAndPrevious(bi, text);
|
||||
|
||||
logln("comparing forward and backward...");
|
||||
int errs = getErrorCount();
|
||||
|
@ -75,7 +76,7 @@ public class BreakIteratorTest extends TestFmwk
|
|||
boundaries[0] = BreakIterator.DONE;
|
||||
boundaries[1] = 0;
|
||||
for (int i = 0; i < expectedResult.size(); i++)
|
||||
boundaries[i + 2] = boundaries[i + 1] + ((String)expectedResult.elementAt(i)).
|
||||
boundaries[i + 2] = boundaries[i + 1] + (expectedResult.get(i)).
|
||||
length();
|
||||
boundaries[boundaries.length - 1] = BreakIterator.DONE;
|
||||
|
||||
|
@ -86,10 +87,10 @@ public class BreakIteratorTest extends TestFmwk
|
|||
doMultipleSelectionTest(bi, text);
|
||||
}
|
||||
|
||||
private Vector _testFirstAndNext(BreakIterator bi, String text) {
|
||||
private List<String> _testFirstAndNext(BreakIterator bi, String text) {
|
||||
int p = bi.first();
|
||||
int lastP = p;
|
||||
Vector result = new Vector();
|
||||
List<String> result = new ArrayList<String>();
|
||||
|
||||
if (p != 0)
|
||||
errln("first() returned " + p + " instead of 0");
|
||||
|
@ -100,7 +101,7 @@ public class BreakIteratorTest extends TestFmwk
|
|||
errln("next() failed to move forward: next() on position "
|
||||
+ lastP + " yielded " + p);
|
||||
|
||||
result.addElement(text.substring(lastP, p));
|
||||
result.add(text.substring(lastP, p));
|
||||
}
|
||||
else {
|
||||
if (lastP != text.length())
|
||||
|
@ -112,10 +113,10 @@ public class BreakIteratorTest extends TestFmwk
|
|||
return result;
|
||||
}
|
||||
|
||||
private Vector _testLastAndPrevious(BreakIterator bi, String text) {
|
||||
private List<String> _testLastAndPrevious(BreakIterator bi, String text) {
|
||||
int p = bi.last();
|
||||
int lastP = p;
|
||||
Vector result = new Vector();
|
||||
List<String> result = new ArrayList<String>();
|
||||
|
||||
if (p != text.length())
|
||||
errln("last() returned " + p + " instead of " + text.length());
|
||||
|
@ -126,7 +127,7 @@ public class BreakIteratorTest extends TestFmwk
|
|||
errln("previous() failed to move backward: previous() on position "
|
||||
+ lastP + " yielded " + p);
|
||||
|
||||
result.insertElementAt(text.substring(p, lastP), 0);
|
||||
result.add(0, text.substring(p, lastP));
|
||||
}
|
||||
else {
|
||||
if (lastP != 0)
|
||||
|
@ -138,7 +139,7 @@ public class BreakIteratorTest extends TestFmwk
|
|||
return result;
|
||||
}
|
||||
|
||||
private void compareFragmentLists(String f1Name, String f2Name, Vector f1, Vector f2) {
|
||||
private void compareFragmentLists(String f1Name, String f2Name, List<String> f1, List<String> f2) {
|
||||
int p1 = 0;
|
||||
int p2 = 0;
|
||||
String s1;
|
||||
|
@ -147,8 +148,8 @@ public class BreakIteratorTest extends TestFmwk
|
|||
int t2 = 0;
|
||||
|
||||
while (p1 < f1.size() && p2 < f2.size()) {
|
||||
s1 = (String)f1.elementAt(p1);
|
||||
s2 = (String)f2.elementAt(p2);
|
||||
s1 = f1.get(p1);
|
||||
s2 = f2.get(p2);
|
||||
t1 += s1.length();
|
||||
t2 += s2.length();
|
||||
|
||||
|
@ -165,24 +166,24 @@ public class BreakIteratorTest extends TestFmwk
|
|||
|
||||
while (tempT1 != tempT2 && tempP1 < f1.size() && tempP2 < f2.size()) {
|
||||
while (tempT1 < tempT2 && tempP1 < f1.size()) {
|
||||
tempT1 += ((String)f1.elementAt(tempP1)).length();
|
||||
tempT1 += (f1.get(tempP1)).length();
|
||||
++tempP1;
|
||||
}
|
||||
while (tempT2 < tempT1 && tempP2 < f2.size()) {
|
||||
tempT2 += ((String)f2.elementAt(tempP2)).length();
|
||||
tempT2 += (f2.get(tempP2)).length();
|
||||
++tempP2;
|
||||
}
|
||||
}
|
||||
logln("*** " + f1Name + " has:");
|
||||
while (p1 <= tempP1 && p1 < f1.size()) {
|
||||
s1 = (String)f1.elementAt(p1);
|
||||
s1 = f1.get(p1);
|
||||
t1 += s1.length();
|
||||
debugLogln(" *** >" + s1 + "<");
|
||||
++p1;
|
||||
}
|
||||
logln("***** " + f2Name + " has:");
|
||||
while (p2 <= tempP2 && p2 < f2.size()) {
|
||||
s2 = (String)f2.elementAt(p2);
|
||||
s2 = f2.get(p2);
|
||||
t2 += s2.length();
|
||||
debugLogln(" ***** >" + s2 + "<");
|
||||
++p2;
|
||||
|
@ -360,10 +361,10 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4097779
|
||||
*/
|
||||
public void TestBug4097779() {
|
||||
Vector wordSelectionData = new Vector();
|
||||
List<String> wordSelectionData = new ArrayList<String>(2);
|
||||
|
||||
wordSelectionData.addElement("aa\u0300a");
|
||||
wordSelectionData.addElement(" ");
|
||||
wordSelectionData.add("aa\u0300a");
|
||||
wordSelectionData.add(" ");
|
||||
|
||||
generalIteratorTest(wordBreak, wordSelectionData);
|
||||
}
|
||||
|
@ -372,30 +373,30 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4098467
|
||||
*/
|
||||
public void TestBug4098467Words() {
|
||||
Vector wordSelectionData = new Vector();
|
||||
List<String> wordSelectionData = new ArrayList<String>();
|
||||
|
||||
// What follows is a string of Korean characters (I found it in the Yellow Pages
|
||||
// ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
|
||||
// it correctly), first as precomposed syllables, and then as conjoining jamo.
|
||||
// Both sequences should be semantically identical and break the same way.
|
||||
// precomposed syllables...
|
||||
wordSelectionData.addElement("\uc0c1\ud56d");
|
||||
wordSelectionData.addElement(" ");
|
||||
wordSelectionData.addElement("\ud55c\uc778");
|
||||
wordSelectionData.addElement(" ");
|
||||
wordSelectionData.addElement("\uc5f0\ud569");
|
||||
wordSelectionData.addElement(" ");
|
||||
wordSelectionData.addElement("\uc7a5\ub85c\uad50\ud68c");
|
||||
wordSelectionData.addElement(" ");
|
||||
wordSelectionData.add("\uc0c1\ud56d");
|
||||
wordSelectionData.add(" ");
|
||||
wordSelectionData.add("\ud55c\uc778");
|
||||
wordSelectionData.add(" ");
|
||||
wordSelectionData.add("\uc5f0\ud569");
|
||||
wordSelectionData.add(" ");
|
||||
wordSelectionData.add("\uc7a5\ub85c\uad50\ud68c");
|
||||
wordSelectionData.add(" ");
|
||||
// conjoining jamo...
|
||||
wordSelectionData.addElement("\u1109\u1161\u11bc\u1112\u1161\u11bc");
|
||||
wordSelectionData.addElement(" ");
|
||||
wordSelectionData.addElement("\u1112\u1161\u11ab\u110b\u1175\u11ab");
|
||||
wordSelectionData.addElement(" ");
|
||||
wordSelectionData.addElement("\u110b\u1167\u11ab\u1112\u1161\u11b8");
|
||||
wordSelectionData.addElement(" ");
|
||||
wordSelectionData.addElement("\u110c\u1161\u11bc\u1105\u1169\u1100\u116d\u1112\u116c");
|
||||
wordSelectionData.addElement(" ");
|
||||
wordSelectionData.add("\u1109\u1161\u11bc\u1112\u1161\u11bc");
|
||||
wordSelectionData.add(" ");
|
||||
wordSelectionData.add("\u1112\u1161\u11ab\u110b\u1175\u11ab");
|
||||
wordSelectionData.add(" ");
|
||||
wordSelectionData.add("\u110b\u1167\u11ab\u1112\u1161\u11b8");
|
||||
wordSelectionData.add(" ");
|
||||
wordSelectionData.add("\u110c\u1161\u11bc\u1105\u1169\u1100\u116d\u1112\u116c");
|
||||
wordSelectionData.add(" ");
|
||||
|
||||
generalIteratorTest(wordBreak, wordSelectionData);
|
||||
}
|
||||
|
@ -405,20 +406,20 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4111338
|
||||
*/
|
||||
public void TestBug4111338() {
|
||||
Vector sentenceSelectionData = new Vector();
|
||||
List<String> sentenceSelectionData = new ArrayList<String>();
|
||||
|
||||
// test for bug #4111338: Don't break sentences at the boundary between CJK
|
||||
// and other letters
|
||||
sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165:\"JAVA\u821c"
|
||||
sentenceSelectionData.add("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165:\"JAVA\u821c"
|
||||
+ "\u8165\u7fc8\u51ce\u306d,\u2494\u56d8\u4ec0\u60b1\u8560\u51ba"
|
||||
+ "\u611d\u57b6\u2510\u5d46\".\u2029");
|
||||
sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8"
|
||||
sentenceSelectionData.add("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8"
|
||||
+ "\u97e4JAVA\u821c\u8165\u7fc8\u51ce\u306d\ue30b\u2494\u56d8\u4ec0"
|
||||
+ "\u60b1\u8560\u51ba\u611d\u57b6\u2510\u5d46\u97e5\u7751\u2029");
|
||||
sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8\u97e4"
|
||||
sentenceSelectionData.add("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8\u97e4"
|
||||
+ "\u6470\u8790JAVA\u821c\u8165\u7fc8\u51ce\u306d\ue30b\u2494\u56d8"
|
||||
+ "\u4ec0\u60b1\u8560\u51ba\u611d\u57b6\u2510\u5d46\u97e5\u7751\u2029");
|
||||
sentenceSelectionData.addElement("He said, \"I can go there.\"\u2029");
|
||||
sentenceSelectionData.add("He said, \"I can go there.\"\u2029");
|
||||
|
||||
generalIteratorTest(sentenceBreak, sentenceSelectionData);
|
||||
}
|
||||
|
@ -428,12 +429,12 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4143071
|
||||
*/
|
||||
public void TestBug4143071() {
|
||||
Vector sentenceSelectionData = new Vector();
|
||||
List<String> sentenceSelectionData = new ArrayList<String>(3);
|
||||
|
||||
// Make sure sentences that end with digits work right
|
||||
sentenceSelectionData.addElement("Today is the 27th of May, 1998. ");
|
||||
sentenceSelectionData.addElement("Tomorrow will be 28 May 1998. ");
|
||||
sentenceSelectionData.addElement("The day after will be the 30th.\u2029");
|
||||
sentenceSelectionData.add("Today is the 27th of May, 1998. ");
|
||||
sentenceSelectionData.add("Tomorrow will be 28 May 1998. ");
|
||||
sentenceSelectionData.add("The day after will be the 30th.\u2029");
|
||||
|
||||
generalIteratorTest(sentenceBreak, sentenceSelectionData);
|
||||
}
|
||||
|
@ -442,12 +443,12 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4152416
|
||||
*/
|
||||
public void TestBug4152416() {
|
||||
Vector sentenceSelectionData = new Vector();
|
||||
List<String> sentenceSelectionData = new ArrayList<String>(2);
|
||||
|
||||
// Make sure sentences ending with a capital letter are treated correctly
|
||||
sentenceSelectionData.addElement("The type of all primitive "
|
||||
sentenceSelectionData.add("The type of all primitive "
|
||||
+ "<code>boolean</code> values accessed in the target VM. ");
|
||||
sentenceSelectionData.addElement("Calls to xxx will return an "
|
||||
sentenceSelectionData.add("Calls to xxx will return an "
|
||||
+ "implementor of this interface.\u2029");
|
||||
|
||||
generalIteratorTest(sentenceBreak, sentenceSelectionData);
|
||||
|
@ -457,55 +458,55 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4152117
|
||||
*/
|
||||
public void TestBug4152117() {
|
||||
Vector sentenceSelectionData = new Vector();
|
||||
List<String> sentenceSelectionData = new ArrayList<String>(3);
|
||||
|
||||
// Make sure sentence breaking is handling punctuation correctly
|
||||
// [COULD NOT REPRODUCE THIS BUG, BUT TEST IS HERE TO MAKE SURE
|
||||
// IT DOESN'T CROP UP]
|
||||
sentenceSelectionData.addElement("Constructs a randomly generated "
|
||||
sentenceSelectionData.add("Constructs a randomly generated "
|
||||
+ "BigInteger, uniformly distributed over the range <tt>0</tt> "
|
||||
+ "to <tt>(2<sup>numBits</sup> - 1)</tt>, inclusive. ");
|
||||
sentenceSelectionData.addElement("The uniformity of the distribution "
|
||||
sentenceSelectionData.add("The uniformity of the distribution "
|
||||
+ "assumes that a fair source of random bits is provided in "
|
||||
+ "<tt>rnd</tt>. ");
|
||||
sentenceSelectionData.addElement("Note that this constructor always "
|
||||
sentenceSelectionData.add("Note that this constructor always "
|
||||
+ "constructs a non-negative BigInteger.\u2029");
|
||||
|
||||
generalIteratorTest(sentenceBreak, sentenceSelectionData);
|
||||
}
|
||||
|
||||
public void TestLineBreak() {
|
||||
Vector lineSelectionData = new Vector();
|
||||
List<String> lineSelectionData = new ArrayList<String>();
|
||||
|
||||
lineSelectionData.addElement("Multi-");
|
||||
lineSelectionData.addElement("Level ");
|
||||
lineSelectionData.addElement("example ");
|
||||
lineSelectionData.addElement("of ");
|
||||
lineSelectionData.addElement("a ");
|
||||
lineSelectionData.addElement("semi-");
|
||||
lineSelectionData.addElement("idiotic ");
|
||||
lineSelectionData.addElement("non-");
|
||||
lineSelectionData.addElement("sensical ");
|
||||
lineSelectionData.addElement("(non-");
|
||||
lineSelectionData.addElement("important) ");
|
||||
lineSelectionData.addElement("sentence. ");
|
||||
lineSelectionData.add("Multi-");
|
||||
lineSelectionData.add("Level ");
|
||||
lineSelectionData.add("example ");
|
||||
lineSelectionData.add("of ");
|
||||
lineSelectionData.add("a ");
|
||||
lineSelectionData.add("semi-");
|
||||
lineSelectionData.add("idiotic ");
|
||||
lineSelectionData.add("non-");
|
||||
lineSelectionData.add("sensical ");
|
||||
lineSelectionData.add("(non-");
|
||||
lineSelectionData.add("important) ");
|
||||
lineSelectionData.add("sentence. ");
|
||||
|
||||
lineSelectionData.addElement("Hi ");
|
||||
lineSelectionData.addElement("Hello ");
|
||||
lineSelectionData.addElement("How\n");
|
||||
lineSelectionData.addElement("are\r");
|
||||
lineSelectionData.addElement("you\u2028");
|
||||
lineSelectionData.addElement("fine.\t");
|
||||
lineSelectionData.addElement("good. ");
|
||||
lineSelectionData.add("Hi ");
|
||||
lineSelectionData.add("Hello ");
|
||||
lineSelectionData.add("How\n");
|
||||
lineSelectionData.add("are\r");
|
||||
lineSelectionData.add("you\u2028");
|
||||
lineSelectionData.add("fine.\t");
|
||||
lineSelectionData.add("good. ");
|
||||
|
||||
lineSelectionData.addElement("Now\r");
|
||||
lineSelectionData.addElement("is\n");
|
||||
lineSelectionData.addElement("the\r\n");
|
||||
lineSelectionData.addElement("time\n");
|
||||
lineSelectionData.addElement("\r");
|
||||
lineSelectionData.addElement("for\r");
|
||||
lineSelectionData.addElement("\r");
|
||||
lineSelectionData.addElement("all");
|
||||
lineSelectionData.add("Now\r");
|
||||
lineSelectionData.add("is\n");
|
||||
lineSelectionData.add("the\r\n");
|
||||
lineSelectionData.add("time\n");
|
||||
lineSelectionData.add("\r");
|
||||
lineSelectionData.add("for\r");
|
||||
lineSelectionData.add("\r");
|
||||
lineSelectionData.add("all");
|
||||
|
||||
generalIteratorTest(lineBreak, lineSelectionData);
|
||||
}
|
||||
|
@ -514,17 +515,17 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4068133
|
||||
*/
|
||||
public void TestBug4068133() {
|
||||
Vector lineSelectionData = new Vector();
|
||||
List<String> lineSelectionData = new ArrayList<String>(9);
|
||||
|
||||
lineSelectionData.addElement("\u96f6");
|
||||
lineSelectionData.addElement("\u4e00\u3002");
|
||||
lineSelectionData.addElement("\u4e8c\u3001");
|
||||
lineSelectionData.addElement("\u4e09\u3002\u3001");
|
||||
lineSelectionData.addElement("\u56db\u3001\u3002\u3001");
|
||||
lineSelectionData.addElement("\u4e94,");
|
||||
lineSelectionData.addElement("\u516d.");
|
||||
lineSelectionData.addElement("\u4e03.\u3001,\u3002");
|
||||
lineSelectionData.addElement("\u516b");
|
||||
lineSelectionData.add("\u96f6");
|
||||
lineSelectionData.add("\u4e00\u3002");
|
||||
lineSelectionData.add("\u4e8c\u3001");
|
||||
lineSelectionData.add("\u4e09\u3002\u3001");
|
||||
lineSelectionData.add("\u56db\u3001\u3002\u3001");
|
||||
lineSelectionData.add("\u4e94,");
|
||||
lineSelectionData.add("\u516d.");
|
||||
lineSelectionData.add("\u4e03.\u3001,\u3002");
|
||||
lineSelectionData.add("\u516b");
|
||||
|
||||
generalIteratorTest(lineBreak, lineSelectionData);
|
||||
}
|
||||
|
@ -533,9 +534,9 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4086052
|
||||
*/
|
||||
public void TestBug4086052() {
|
||||
Vector lineSelectionData = new Vector();
|
||||
List<String> lineSelectionData = new ArrayList<String>(1);
|
||||
|
||||
lineSelectionData.addElement("foo\u00a0bar ");
|
||||
lineSelectionData.add("foo\u00a0bar ");
|
||||
// lineSelectionData.addElement("foo\ufeffbar");
|
||||
|
||||
generalIteratorTest(lineBreak, lineSelectionData);
|
||||
|
@ -545,11 +546,11 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4097920
|
||||
*/
|
||||
public void TestBug4097920() {
|
||||
Vector lineSelectionData = new Vector();
|
||||
List<String> lineSelectionData = new ArrayList<String>(3);
|
||||
|
||||
lineSelectionData.addElement("dog,cat,mouse ");
|
||||
lineSelectionData.addElement("(one)");
|
||||
lineSelectionData.addElement("(two)\n");
|
||||
lineSelectionData.add("dog,cat,mouse ");
|
||||
lineSelectionData.add("(one)");
|
||||
lineSelectionData.add("(two)\n");
|
||||
generalIteratorTest(lineBreak, lineSelectionData);
|
||||
}
|
||||
|
||||
|
@ -559,12 +560,12 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4117554
|
||||
*/
|
||||
public void TestBug4117554Lines() {
|
||||
Vector lineSelectionData = new Vector();
|
||||
List<String> lineSelectionData = new ArrayList<String>(3);
|
||||
|
||||
// Fullwidth .!? should be treated as postJwrd
|
||||
lineSelectionData.addElement("\u4e01\uff0e");
|
||||
lineSelectionData.addElement("\u4e02\uff01");
|
||||
lineSelectionData.addElement("\u4e03\uff1f");
|
||||
lineSelectionData.add("\u4e01\uff0e");
|
||||
lineSelectionData.add("\u4e02\uff01");
|
||||
lineSelectionData.add("\u4e03\uff1f");
|
||||
|
||||
generalIteratorTest(lineBreak, lineSelectionData);
|
||||
}
|
||||
|
@ -572,11 +573,11 @@ public class BreakIteratorTest extends TestFmwk
|
|||
public void TestLettersAndDigits() {
|
||||
// a character sequence such as "X11" or "30F3" or "native2ascii" should
|
||||
// be kept together as a single word
|
||||
Vector lineSelectionData = new Vector();
|
||||
List<String> lineSelectionData = new ArrayList<String>(3);
|
||||
|
||||
lineSelectionData.addElement("X11 ");
|
||||
lineSelectionData.addElement("30F3 ");
|
||||
lineSelectionData.addElement("native2ascii");
|
||||
lineSelectionData.add("X11 ");
|
||||
lineSelectionData.add("30F3 ");
|
||||
lineSelectionData.add("native2ascii");
|
||||
|
||||
generalIteratorTest(lineBreak, lineSelectionData);
|
||||
}
|
||||
|
@ -589,32 +590,32 @@ public class BreakIteratorTest extends TestFmwk
|
|||
private static final String tildeE = "e\u0303";
|
||||
|
||||
public void TestCharacterBreak() {
|
||||
Vector characterSelectionData = new Vector();
|
||||
List<String> characterSelectionData = new ArrayList<String>();
|
||||
|
||||
characterSelectionData.addElement(graveS);
|
||||
characterSelectionData.addElement(acuteBelowI);
|
||||
characterSelectionData.addElement("m");
|
||||
characterSelectionData.addElement("p");
|
||||
characterSelectionData.addElement("l");
|
||||
characterSelectionData.addElement(acuteE);
|
||||
characterSelectionData.addElement(" ");
|
||||
characterSelectionData.addElement("s");
|
||||
characterSelectionData.addElement(circumflexA);
|
||||
characterSelectionData.addElement("m");
|
||||
characterSelectionData.addElement("p");
|
||||
characterSelectionData.addElement("l");
|
||||
characterSelectionData.addElement(tildeE);
|
||||
characterSelectionData.addElement(".");
|
||||
characterSelectionData.addElement("w");
|
||||
characterSelectionData.addElement(circumflexA);
|
||||
characterSelectionData.addElement("w");
|
||||
characterSelectionData.addElement("a");
|
||||
characterSelectionData.addElement("f");
|
||||
characterSelectionData.addElement("q");
|
||||
characterSelectionData.addElement("\n");
|
||||
characterSelectionData.addElement("\r");
|
||||
characterSelectionData.addElement("\r\n");
|
||||
characterSelectionData.addElement("\n");
|
||||
characterSelectionData.add(graveS);
|
||||
characterSelectionData.add(acuteBelowI);
|
||||
characterSelectionData.add("m");
|
||||
characterSelectionData.add("p");
|
||||
characterSelectionData.add("l");
|
||||
characterSelectionData.add(acuteE);
|
||||
characterSelectionData.add(" ");
|
||||
characterSelectionData.add("s");
|
||||
characterSelectionData.add(circumflexA);
|
||||
characterSelectionData.add("m");
|
||||
characterSelectionData.add("p");
|
||||
characterSelectionData.add("l");
|
||||
characterSelectionData.add(tildeE);
|
||||
characterSelectionData.add(".");
|
||||
characterSelectionData.add("w");
|
||||
characterSelectionData.add(circumflexA);
|
||||
characterSelectionData.add("w");
|
||||
characterSelectionData.add("a");
|
||||
characterSelectionData.add("f");
|
||||
characterSelectionData.add("q");
|
||||
characterSelectionData.add("\n");
|
||||
characterSelectionData.add("\r");
|
||||
characterSelectionData.add("\r\n");
|
||||
characterSelectionData.add("\n");
|
||||
|
||||
generalIteratorTest(characterBreak, characterSelectionData);
|
||||
}
|
||||
|
@ -623,56 +624,56 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* @bug 4098467
|
||||
*/
|
||||
public void TestBug4098467Characters() {
|
||||
Vector characterSelectionData = new Vector();
|
||||
List<String> characterSelectionData = new ArrayList<String>();
|
||||
|
||||
// What follows is a string of Korean characters (I found it in the Yellow Pages
|
||||
// ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
|
||||
// it correctly), first as precomposed syllables, and then as conjoining jamo.
|
||||
// Both sequences should be semantically identical and break the same way.
|
||||
// precomposed syllables...
|
||||
characterSelectionData.addElement("\uc0c1");
|
||||
characterSelectionData.addElement("\ud56d");
|
||||
characterSelectionData.addElement(" ");
|
||||
characterSelectionData.addElement("\ud55c");
|
||||
characterSelectionData.addElement("\uc778");
|
||||
characterSelectionData.addElement(" ");
|
||||
characterSelectionData.addElement("\uc5f0");
|
||||
characterSelectionData.addElement("\ud569");
|
||||
characterSelectionData.addElement(" ");
|
||||
characterSelectionData.addElement("\uc7a5");
|
||||
characterSelectionData.addElement("\ub85c");
|
||||
characterSelectionData.addElement("\uad50");
|
||||
characterSelectionData.addElement("\ud68c");
|
||||
characterSelectionData.addElement(" ");
|
||||
characterSelectionData.add("\uc0c1");
|
||||
characterSelectionData.add("\ud56d");
|
||||
characterSelectionData.add(" ");
|
||||
characterSelectionData.add("\ud55c");
|
||||
characterSelectionData.add("\uc778");
|
||||
characterSelectionData.add(" ");
|
||||
characterSelectionData.add("\uc5f0");
|
||||
characterSelectionData.add("\ud569");
|
||||
characterSelectionData.add(" ");
|
||||
characterSelectionData.add("\uc7a5");
|
||||
characterSelectionData.add("\ub85c");
|
||||
characterSelectionData.add("\uad50");
|
||||
characterSelectionData.add("\ud68c");
|
||||
characterSelectionData.add(" ");
|
||||
// conjoining jamo...
|
||||
characterSelectionData.addElement("\u1109\u1161\u11bc");
|
||||
characterSelectionData.addElement("\u1112\u1161\u11bc");
|
||||
characterSelectionData.addElement(" ");
|
||||
characterSelectionData.addElement("\u1112\u1161\u11ab");
|
||||
characterSelectionData.addElement("\u110b\u1175\u11ab");
|
||||
characterSelectionData.addElement(" ");
|
||||
characterSelectionData.addElement("\u110b\u1167\u11ab");
|
||||
characterSelectionData.addElement("\u1112\u1161\u11b8");
|
||||
characterSelectionData.addElement(" ");
|
||||
characterSelectionData.addElement("\u110c\u1161\u11bc");
|
||||
characterSelectionData.addElement("\u1105\u1169");
|
||||
characterSelectionData.addElement("\u1100\u116d");
|
||||
characterSelectionData.addElement("\u1112\u116c");
|
||||
characterSelectionData.add("\u1109\u1161\u11bc");
|
||||
characterSelectionData.add("\u1112\u1161\u11bc");
|
||||
characterSelectionData.add(" ");
|
||||
characterSelectionData.add("\u1112\u1161\u11ab");
|
||||
characterSelectionData.add("\u110b\u1175\u11ab");
|
||||
characterSelectionData.add(" ");
|
||||
characterSelectionData.add("\u110b\u1167\u11ab");
|
||||
characterSelectionData.add("\u1112\u1161\u11b8");
|
||||
characterSelectionData.add(" ");
|
||||
characterSelectionData.add("\u110c\u1161\u11bc");
|
||||
characterSelectionData.add("\u1105\u1169");
|
||||
characterSelectionData.add("\u1100\u116d");
|
||||
characterSelectionData.add("\u1112\u116c");
|
||||
|
||||
generalIteratorTest(characterBreak, characterSelectionData);
|
||||
}
|
||||
|
||||
public void TestTitleBreak()
|
||||
{
|
||||
Vector titleData = new Vector();
|
||||
titleData.addElement(" ");
|
||||
titleData.addElement("This ");
|
||||
titleData.addElement("is ");
|
||||
titleData.addElement("a ");
|
||||
titleData.addElement("simple ");
|
||||
titleData.addElement("sample ");
|
||||
titleData.addElement("sentence. ");
|
||||
titleData.addElement("This ");
|
||||
List<String> titleData = new ArrayList<String>();
|
||||
titleData.add(" ");
|
||||
titleData.add("This ");
|
||||
titleData.add("is ");
|
||||
titleData.add("a ");
|
||||
titleData.add("simple ");
|
||||
titleData.add("sample ");
|
||||
titleData.add("sentence. ");
|
||||
titleData.add("This ");
|
||||
|
||||
generalIteratorTest(titleBreak, titleData);
|
||||
}
|
||||
|
@ -708,11 +709,11 @@ public class BreakIteratorTest extends TestFmwk
|
|||
|
||||
|
||||
public void TestBug4146175Lines() {
|
||||
Vector lineSelectionData = new Vector();
|
||||
List<String> lineSelectionData = new ArrayList<String>(2);
|
||||
|
||||
// the fullwidth comma should stick to the preceding Japanese character
|
||||
lineSelectionData.addElement("\u7d42\uff0c");
|
||||
lineSelectionData.addElement("\u308f");
|
||||
lineSelectionData.add("\u7d42\uff0c");
|
||||
lineSelectionData.add("\u308f");
|
||||
|
||||
generalIteratorTest(lineBreak, lineSelectionData);
|
||||
}
|
||||
|
@ -734,8 +735,8 @@ public class BreakIteratorTest extends TestFmwk
|
|||
public void TestEmptyString()
|
||||
{
|
||||
String text = "";
|
||||
Vector x = new Vector();
|
||||
x.addElement(text);
|
||||
List<String> x = new ArrayList<String>(1);
|
||||
x.add(text);
|
||||
|
||||
generalIteratorTest(lineBreak, x);
|
||||
}
|
||||
|
@ -816,7 +817,7 @@ public class BreakIteratorTest extends TestFmwk
|
|||
* Bug 4450804
|
||||
*/
|
||||
public void TestLineBreakContractions() {
|
||||
Vector expected = new Vector();
|
||||
List<String> expected = new ArrayList<String>(7);
|
||||
expected.add("These ");
|
||||
expected.add("are ");
|
||||
expected.add("'foobles'. ");
|
||||
|
|
|
@ -15,7 +15,8 @@ package com.ibm.icu.dev.test.rbbi;
|
|||
// which is common between ICU4C and ICU4J. The remaining test data should also be moved,
|
||||
// or simply retired if it is no longer interesting.
|
||||
import java.text.CharacterIterator;
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.text.BreakIterator;
|
||||
|
@ -23,335 +24,342 @@ import com.ibm.icu.text.DictionaryBasedBreakIterator;
|
|||
import com.ibm.icu.text.RuleBasedBreakIterator;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
|
||||
public class RBBITest extends TestFmwk
|
||||
{
|
||||
public class RBBITest extends TestFmwk {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new RBBITest().run(args);
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
new RBBITest().run(args);
|
||||
}
|
||||
|
||||
public RBBITest() {
|
||||
}
|
||||
public RBBITest() {
|
||||
}
|
||||
|
||||
private static final String halfNA = "\u0928\u094d\u200d"; /*halfform NA = devanigiri NA + virama(supresses inherent vowel)+ zero width joiner */
|
||||
private static final String halfNA = "\u0928\u094d\u200d"; /*
|
||||
* halfform NA = devanigiri NA + virama(supresses
|
||||
* inherent vowel)+ zero width joiner
|
||||
*/
|
||||
|
||||
// tests default rules based character iteration.
|
||||
// Builds a new iterator from the source rules in the default (prebuilt) iterator.
|
||||
//
|
||||
public void TestDefaultRuleBasedCharacterIteration() {
|
||||
RuleBasedBreakIterator rbbi = (RuleBasedBreakIterator) BreakIterator.getCharacterInstance();
|
||||
logln("Testing the RBBI for character iteration by using default rules");
|
||||
|
||||
// tests default rules based character iteration.
|
||||
// Builds a new iterator from the source rules in the default (prebuilt) iterator.
|
||||
//
|
||||
public void TestDefaultRuleBasedCharacterIteration(){
|
||||
RuleBasedBreakIterator rbbi=(RuleBasedBreakIterator)BreakIterator.getCharacterInstance();
|
||||
logln("Testing the RBBI for character iteration by using default rules");
|
||||
// fetch the rules used to create the above RuleBasedBreakIterator
|
||||
String defaultRules = rbbi.toString();
|
||||
|
||||
//fetch the rules used to create the above RuleBasedBreakIterator
|
||||
String defaultRules=rbbi.toString();
|
||||
|
||||
RuleBasedBreakIterator charIterDefault=null;
|
||||
try{
|
||||
charIterDefault = new RuleBasedBreakIterator(defaultRules);
|
||||
}catch(IllegalArgumentException iae){
|
||||
errln("ERROR: failed construction in TestDefaultRuleBasedCharacterIteration()"+ iae.toString());
|
||||
}
|
||||
RuleBasedBreakIterator charIterDefault = null;
|
||||
try {
|
||||
charIterDefault = new RuleBasedBreakIterator(defaultRules);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
errln("ERROR: failed construction in TestDefaultRuleBasedCharacterIteration()" + iae.toString());
|
||||
}
|
||||
|
||||
Vector chardata = new Vector();
|
||||
chardata.addElement("H");
|
||||
chardata.addElement("e");
|
||||
chardata.addElement("l");
|
||||
chardata.addElement("l");
|
||||
chardata.addElement("o");
|
||||
chardata.addElement("e\u0301"); //acuteE
|
||||
chardata.addElement("&");
|
||||
chardata.addElement("e\u0303"); //tildaE
|
||||
//devanagiri characters for Hindi support
|
||||
chardata.addElement("\u0906"); //devanagiri AA
|
||||
//chardata.addElement("\u093e\u0901"); //devanagiri vowelsign AA+ chandrabindhu
|
||||
chardata.addElement("\u0916\u0947"); //devanagiri KHA+vowelsign E
|
||||
chardata.addElement("\u0938\u0941\u0902"); //devanagiri SA+vowelsign U + anusvara(bindu)
|
||||
chardata.addElement("\u0926"); //devanagiri consonant DA
|
||||
chardata.addElement("\u0930"); //devanagiri consonant RA
|
||||
// chardata.addElement("\u0939\u094c"); //devanagiri HA+vowel sign AI
|
||||
chardata.addElement("\u0964"); //devanagiri danda
|
||||
//end hindi characters
|
||||
chardata.addElement("A\u0302"); // circumflexA
|
||||
chardata.addElement("i\u0301"); // acuteBelowI
|
||||
// conjoining jamo...
|
||||
chardata.addElement("\u1109\u1161\u11bc");
|
||||
chardata.addElement("\u1112\u1161\u11bc");
|
||||
chardata.addElement("\n");
|
||||
chardata.addElement("\r\n"); // keep CRLF sequences together
|
||||
chardata.addElement("S\u0300"); //graveS
|
||||
chardata.addElement("i\u0301"); // acuteBelowI
|
||||
chardata.addElement("!");
|
||||
List<String> chardata = new ArrayList<String>();
|
||||
chardata.add("H");
|
||||
chardata.add("e");
|
||||
chardata.add("l");
|
||||
chardata.add("l");
|
||||
chardata.add("o");
|
||||
chardata.add("e\u0301"); // acuteE
|
||||
chardata.add("&");
|
||||
chardata.add("e\u0303"); // tildaE
|
||||
// devanagiri characters for Hindi support
|
||||
chardata.add("\u0906"); // devanagiri AA
|
||||
// chardata.add("\u093e\u0901"); //devanagiri vowelsign AA+ chandrabindhu
|
||||
chardata.add("\u0916\u0947"); // devanagiri KHA+vowelsign E
|
||||
chardata.add("\u0938\u0941\u0902"); // devanagiri SA+vowelsign U + anusvara(bindu)
|
||||
chardata.add("\u0926"); // devanagiri consonant DA
|
||||
chardata.add("\u0930"); // devanagiri consonant RA
|
||||
// chardata.add("\u0939\u094c"); //devanagiri HA+vowel sign AI
|
||||
chardata.add("\u0964"); // devanagiri danda
|
||||
// end hindi characters
|
||||
chardata.add("A\u0302"); // circumflexA
|
||||
chardata.add("i\u0301"); // acuteBelowI
|
||||
// conjoining jamo...
|
||||
chardata.add("\u1109\u1161\u11bc");
|
||||
chardata.add("\u1112\u1161\u11bc");
|
||||
chardata.add("\n");
|
||||
chardata.add("\r\n"); // keep CRLF sequences together
|
||||
chardata.add("S\u0300"); // graveS
|
||||
chardata.add("i\u0301"); // acuteBelowI
|
||||
chardata.add("!");
|
||||
|
||||
// What follows is a string of Korean characters (I found it in the Yellow Pages
|
||||
// ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
|
||||
// it correctly), first as precomposed syllables, and then as conjoining jamo.
|
||||
// Both sequences should be semantically identical and break the same way.
|
||||
// precomposed syllables...
|
||||
chardata.addElement("\uc0c1");
|
||||
chardata.addElement("\ud56d");
|
||||
chardata.addElement(" ");
|
||||
chardata.addElement("\ud55c");
|
||||
chardata.addElement("\uc778");
|
||||
chardata.addElement(" ");
|
||||
chardata.addElement("\uc5f0");
|
||||
chardata.addElement("\ud569");
|
||||
chardata.addElement(" ");
|
||||
chardata.addElement("\uc7a5");
|
||||
chardata.addElement("\ub85c");
|
||||
chardata.addElement("\uad50");
|
||||
chardata.addElement("\ud68c");
|
||||
chardata.addElement(" ");
|
||||
// conjoining jamo...
|
||||
chardata.addElement("\u1109\u1161\u11bc");
|
||||
chardata.addElement("\u1112\u1161\u11bc");
|
||||
chardata.addElement(" ");
|
||||
chardata.addElement("\u1112\u1161\u11ab");
|
||||
chardata.addElement("\u110b\u1175\u11ab");
|
||||
chardata.addElement(" ");
|
||||
chardata.addElement("\u110b\u1167\u11ab");
|
||||
chardata.addElement("\u1112\u1161\u11b8");
|
||||
chardata.addElement(" ");
|
||||
chardata.addElement("\u110c\u1161\u11bc");
|
||||
chardata.addElement("\u1105\u1169");
|
||||
chardata.addElement("\u1100\u116d");
|
||||
chardata.addElement("\u1112\u116c");
|
||||
// What follows is a string of Korean characters (I found it in the Yellow Pages
|
||||
// ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
|
||||
// it correctly), first as precomposed syllables, and then as conjoining jamo.
|
||||
// Both sequences should be semantically identical and break the same way.
|
||||
// precomposed syllables...
|
||||
chardata.add("\uc0c1");
|
||||
chardata.add("\ud56d");
|
||||
chardata.add(" ");
|
||||
chardata.add("\ud55c");
|
||||
chardata.add("\uc778");
|
||||
chardata.add(" ");
|
||||
chardata.add("\uc5f0");
|
||||
chardata.add("\ud569");
|
||||
chardata.add(" ");
|
||||
chardata.add("\uc7a5");
|
||||
chardata.add("\ub85c");
|
||||
chardata.add("\uad50");
|
||||
chardata.add("\ud68c");
|
||||
chardata.add(" ");
|
||||
// conjoining jamo...
|
||||
chardata.add("\u1109\u1161\u11bc");
|
||||
chardata.add("\u1112\u1161\u11bc");
|
||||
chardata.add(" ");
|
||||
chardata.add("\u1112\u1161\u11ab");
|
||||
chardata.add("\u110b\u1175\u11ab");
|
||||
chardata.add(" ");
|
||||
chardata.add("\u110b\u1167\u11ab");
|
||||
chardata.add("\u1112\u1161\u11b8");
|
||||
chardata.add(" ");
|
||||
chardata.add("\u110c\u1161\u11bc");
|
||||
chardata.add("\u1105\u1169");
|
||||
chardata.add("\u1100\u116d");
|
||||
chardata.add("\u1112\u116c");
|
||||
|
||||
generalIteratorTest(charIterDefault, chardata);
|
||||
|
||||
generalIteratorTest(charIterDefault, chardata);
|
||||
}
|
||||
|
||||
}
|
||||
public void TestDefaultRuleBasedWordIteration() {
|
||||
logln("Testing the RBBI for word iteration using default rules");
|
||||
RuleBasedBreakIterator rbbi = (RuleBasedBreakIterator) BreakIterator.getWordInstance();
|
||||
// fetch the rules used to create the above RuleBasedBreakIterator
|
||||
String defaultRules = rbbi.toString();
|
||||
|
||||
public void TestDefaultRuleBasedWordIteration(){
|
||||
logln("Testing the RBBI for word iteration using default rules");
|
||||
RuleBasedBreakIterator rbbi=(RuleBasedBreakIterator)BreakIterator.getWordInstance();
|
||||
//fetch the rules used to create the above RuleBasedBreakIterator
|
||||
String defaultRules=rbbi.toString();
|
||||
|
||||
RuleBasedBreakIterator wordIterDefault=null;
|
||||
try{
|
||||
wordIterDefault = new RuleBasedBreakIterator(defaultRules);
|
||||
}catch(IllegalArgumentException iae){
|
||||
errln("ERROR: failed construction in TestDefaultRuleBasedWordIteration() -- custom rules"+ iae.toString());
|
||||
}
|
||||
RuleBasedBreakIterator wordIterDefault = null;
|
||||
try {
|
||||
wordIterDefault = new RuleBasedBreakIterator(defaultRules);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
errln("ERROR: failed construction in TestDefaultRuleBasedWordIteration() -- custom rules" + iae.toString());
|
||||
}
|
||||
|
||||
Vector worddata = new Vector();
|
||||
worddata.addElement ("Write");
|
||||
worddata.addElement (" ");
|
||||
worddata.addElement ("wordrules");
|
||||
worddata.addElement (".");
|
||||
worddata.addElement(" ");
|
||||
//worddata.addElement("alpha-beta-gamma");
|
||||
worddata.addElement(" ");
|
||||
worddata.addElement("\u092f\u0939");
|
||||
worddata.addElement(" ");
|
||||
worddata.addElement("\u0939\u093f" + halfNA + "\u0926\u0940");
|
||||
worddata.addElement(" ");
|
||||
worddata.addElement("\u0939\u0948");
|
||||
// worddata.addElement("\u0964"); //danda followed by a space
|
||||
worddata.addElement(" ");
|
||||
worddata.addElement("\u0905\u093e\u092a");
|
||||
worddata.addElement(" ");
|
||||
worddata.addElement("\u0938\u093f\u0916\u094b\u0917\u0947");
|
||||
worddata.addElement("?");
|
||||
worddata.addElement(" ");
|
||||
worddata.addElement("\r");
|
||||
worddata.addElement("It's");
|
||||
worddata.addElement(" ");
|
||||
// worddata.addElement("$30.10");
|
||||
worddata.addElement(" ");
|
||||
worddata.addElement(" ");
|
||||
worddata.addElement("Badges");
|
||||
worddata.addElement("?");
|
||||
worddata.addElement(" ");
|
||||
worddata.addElement("BADGES");
|
||||
worddata.addElement("!");
|
||||
worddata.addElement("1000,233,456.000");
|
||||
worddata.addElement(" ");
|
||||
List<String> worddata = new ArrayList<String>();
|
||||
worddata.add("Write");
|
||||
worddata.add(" ");
|
||||
worddata.add("wordrules");
|
||||
worddata.add(".");
|
||||
worddata.add(" ");
|
||||
// worddata.add("alpha-beta-gamma");
|
||||
worddata.add(" ");
|
||||
worddata.add("\u092f\u0939");
|
||||
worddata.add(" ");
|
||||
worddata.add("\u0939\u093f" + halfNA + "\u0926\u0940");
|
||||
worddata.add(" ");
|
||||
worddata.add("\u0939\u0948");
|
||||
// worddata.add("\u0964"); //danda followed by a space
|
||||
worddata.add(" ");
|
||||
worddata.add("\u0905\u093e\u092a");
|
||||
worddata.add(" ");
|
||||
worddata.add("\u0938\u093f\u0916\u094b\u0917\u0947");
|
||||
worddata.add("?");
|
||||
worddata.add(" ");
|
||||
worddata.add("\r");
|
||||
worddata.add("It's");
|
||||
worddata.add(" ");
|
||||
// worddata.add("$30.10");
|
||||
worddata.add(" ");
|
||||
worddata.add(" ");
|
||||
worddata.add("Badges");
|
||||
worddata.add("?");
|
||||
worddata.add(" ");
|
||||
worddata.add("BADGES");
|
||||
worddata.add("!");
|
||||
worddata.add("1000,233,456.000");
|
||||
worddata.add(" ");
|
||||
|
||||
generalIteratorTest(wordIterDefault, worddata);
|
||||
}
|
||||
// private static final String kParagraphSeparator = "\u2029";
|
||||
private static final String kLineSeparator = "\u2028";
|
||||
generalIteratorTest(wordIterDefault, worddata);
|
||||
}
|
||||
|
||||
public void TestDefaultRuleBasedSentenceIteration(){
|
||||
logln("Testing the RBBI for sentence iteration using default rules");
|
||||
RuleBasedBreakIterator rbbi=(RuleBasedBreakIterator)BreakIterator.getSentenceInstance();
|
||||
|
||||
//fetch the rules used to create the above RuleBasedBreakIterator
|
||||
String defaultRules=rbbi.toString();
|
||||
RuleBasedBreakIterator sentIterDefault=null;
|
||||
try{
|
||||
sentIterDefault = new RuleBasedBreakIterator(defaultRules);
|
||||
}catch(IllegalArgumentException iae){
|
||||
errln("ERROR: failed construction in TestDefaultRuleBasedSentenceIteration()" + iae.toString());
|
||||
}
|
||||
|
||||
Vector sentdata = new Vector();
|
||||
sentdata.addElement("(This is it.) ");
|
||||
sentdata.addElement("Testing the sentence iterator. ");
|
||||
sentdata.addElement("\"This isn\'t it.\" ");
|
||||
sentdata.addElement("Hi! ");
|
||||
sentdata.addElement("This is a simple sample sentence. ");
|
||||
sentdata.addElement("(This is it.) ");
|
||||
sentdata.addElement("This is a simple sample sentence. ");
|
||||
sentdata.addElement("\"This isn\'t it.\" ");
|
||||
sentdata.addElement("Hi! ");
|
||||
sentdata.addElement("This is a simple sample sentence. ");
|
||||
sentdata.addElement("It does not have to make any sense as you can see. ");
|
||||
sentdata.addElement("Nel mezzo del cammin di nostra vita, mi ritrovai in una selva oscura. ");
|
||||
sentdata.addElement("Che la dritta via aveo smarrita. ");
|
||||
generalIteratorTest(sentIterDefault, sentdata);
|
||||
}
|
||||
|
||||
public void TestDefaultRuleBasedLineIteration(){
|
||||
logln("Testing the RBBI for line iteration using default rules");
|
||||
RuleBasedBreakIterator rbbi=(RuleBasedBreakIterator)RuleBasedBreakIterator.getLineInstance();
|
||||
//fetch the rules used to create the above RuleBasedBreakIterator
|
||||
String defaultRules=rbbi.toString();
|
||||
RuleBasedBreakIterator lineIterDefault=null;
|
||||
try{
|
||||
lineIterDefault = new RuleBasedBreakIterator(defaultRules);
|
||||
}catch(IllegalArgumentException iae){
|
||||
errln("ERROR: failed construction in TestDefaultRuleBasedLineIteration()" + iae.toString());
|
||||
}
|
||||
// private static final String kParagraphSeparator = "\u2029";
|
||||
private static final String kLineSeparator = "\u2028";
|
||||
|
||||
Vector linedata = new Vector();
|
||||
linedata.addElement("Multi-");
|
||||
linedata.addElement("Level ");
|
||||
linedata.addElement("example ");
|
||||
linedata.addElement("of ");
|
||||
linedata.addElement("a ");
|
||||
linedata.addElement("semi-");
|
||||
linedata.addElement("idiotic ");
|
||||
linedata.addElement("non-");
|
||||
linedata.addElement("sensical ");
|
||||
linedata.addElement("(non-");
|
||||
linedata.addElement("important) ");
|
||||
linedata.addElement("sentence. ");
|
||||
public void TestDefaultRuleBasedSentenceIteration() {
|
||||
logln("Testing the RBBI for sentence iteration using default rules");
|
||||
RuleBasedBreakIterator rbbi = (RuleBasedBreakIterator) BreakIterator.getSentenceInstance();
|
||||
|
||||
linedata.addElement("Hi ");
|
||||
linedata.addElement("Hello ");
|
||||
linedata.addElement("How\n");
|
||||
linedata.addElement("are\r");
|
||||
linedata.addElement("you" + kLineSeparator);
|
||||
linedata.addElement("fine.\t");
|
||||
linedata.addElement("good. ");
|
||||
// fetch the rules used to create the above RuleBasedBreakIterator
|
||||
String defaultRules = rbbi.toString();
|
||||
RuleBasedBreakIterator sentIterDefault = null;
|
||||
try {
|
||||
sentIterDefault = new RuleBasedBreakIterator(defaultRules);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
errln("ERROR: failed construction in TestDefaultRuleBasedSentenceIteration()" + iae.toString());
|
||||
}
|
||||
|
||||
linedata.addElement("Now\r");
|
||||
linedata.addElement("is\n");
|
||||
linedata.addElement("the\r\n");
|
||||
linedata.addElement("time\n");
|
||||
linedata.addElement("\r");
|
||||
linedata.addElement("for\r");
|
||||
linedata.addElement("\r");
|
||||
linedata.addElement("all");
|
||||
List<String> sentdata = new ArrayList<String>();
|
||||
sentdata.add("(This is it.) ");
|
||||
sentdata.add("Testing the sentence iterator. ");
|
||||
sentdata.add("\"This isn\'t it.\" ");
|
||||
sentdata.add("Hi! ");
|
||||
sentdata.add("This is a simple sample sentence. ");
|
||||
sentdata.add("(This is it.) ");
|
||||
sentdata.add("This is a simple sample sentence. ");
|
||||
sentdata.add("\"This isn\'t it.\" ");
|
||||
sentdata.add("Hi! ");
|
||||
sentdata.add("This is a simple sample sentence. ");
|
||||
sentdata.add("It does not have to make any sense as you can see. ");
|
||||
sentdata.add("Nel mezzo del cammin di nostra vita, mi ritrovai in una selva oscura. ");
|
||||
sentdata.add("Che la dritta via aveo smarrita. ");
|
||||
|
||||
generalIteratorTest(lineIterDefault, linedata);
|
||||
generalIteratorTest(sentIterDefault, sentdata);
|
||||
}
|
||||
|
||||
public void TestDefaultRuleBasedLineIteration() {
|
||||
logln("Testing the RBBI for line iteration using default rules");
|
||||
RuleBasedBreakIterator rbbi = (RuleBasedBreakIterator) RuleBasedBreakIterator.getLineInstance();
|
||||
// fetch the rules used to create the above RuleBasedBreakIterator
|
||||
String defaultRules = rbbi.toString();
|
||||
RuleBasedBreakIterator lineIterDefault = null;
|
||||
try {
|
||||
lineIterDefault = new RuleBasedBreakIterator(defaultRules);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
errln("ERROR: failed construction in TestDefaultRuleBasedLineIteration()" + iae.toString());
|
||||
}
|
||||
|
||||
}
|
||||
List<String> linedata = new ArrayList<String>();
|
||||
linedata.add("Multi-");
|
||||
linedata.add("Level ");
|
||||
linedata.add("example ");
|
||||
linedata.add("of ");
|
||||
linedata.add("a ");
|
||||
linedata.add("semi-");
|
||||
linedata.add("idiotic ");
|
||||
linedata.add("non-");
|
||||
linedata.add("sensical ");
|
||||
linedata.add("(non-");
|
||||
linedata.add("important) ");
|
||||
linedata.add("sentence. ");
|
||||
|
||||
linedata.add("Hi ");
|
||||
linedata.add("Hello ");
|
||||
linedata.add("How\n");
|
||||
linedata.add("are\r");
|
||||
linedata.add("you" + kLineSeparator);
|
||||
linedata.add("fine.\t");
|
||||
linedata.add("good. ");
|
||||
|
||||
linedata.add("Now\r");
|
||||
linedata.add("is\n");
|
||||
linedata.add("the\r\n");
|
||||
linedata.add("time\n");
|
||||
linedata.add("\r");
|
||||
linedata.add("for\r");
|
||||
linedata.add("\r");
|
||||
linedata.add("all");
|
||||
|
||||
generalIteratorTest(lineIterDefault, linedata);
|
||||
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// general test subroutines
|
||||
//=========================================================================
|
||||
// =========================================================================
|
||||
// general test subroutines
|
||||
// =========================================================================
|
||||
|
||||
private void generalIteratorTest(RuleBasedBreakIterator rbbi, Vector expectedResult){
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
String text;
|
||||
for (int i = 0; i < expectedResult.size(); i++) {
|
||||
text = (String)expectedResult.elementAt(i);
|
||||
buffer.append(text);
|
||||
}
|
||||
text = buffer.toString();
|
||||
if (rbbi == null) {
|
||||
errln("null iterator, test skipped.");
|
||||
return;
|
||||
}
|
||||
private void generalIteratorTest(RuleBasedBreakIterator rbbi, List<String> expectedResult) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
String text;
|
||||
for (int i = 0; i < expectedResult.size(); i++) {
|
||||
text = expectedResult.get(i);
|
||||
buffer.append(text);
|
||||
}
|
||||
text = buffer.toString();
|
||||
if (rbbi == null) {
|
||||
errln("null iterator, test skipped.");
|
||||
return;
|
||||
}
|
||||
|
||||
rbbi.setText(text);
|
||||
rbbi.setText(text);
|
||||
|
||||
Vector nextResults = _testFirstAndNext(rbbi, text);
|
||||
Vector previousResults = _testLastAndPrevious(rbbi, text);
|
||||
List<String> nextResults = _testFirstAndNext(rbbi, text);
|
||||
List<String> previousResults = _testLastAndPrevious(rbbi, text);
|
||||
|
||||
logln("comparing forward and backward...");
|
||||
int errs = getErrorCount();
|
||||
compareFragmentLists("forward iteration", "backward iteration", nextResults,
|
||||
previousResults);
|
||||
if (getErrorCount() == errs) {
|
||||
logln("comparing expected and actual...");
|
||||
compareFragmentLists("expected result", "actual result", expectedResult,
|
||||
nextResults);
|
||||
}
|
||||
logln("comparing forward and backward...");
|
||||
int errs = getErrorCount();
|
||||
compareFragmentLists("forward iteration", "backward iteration", nextResults, previousResults);
|
||||
if (getErrorCount() == errs) {
|
||||
logln("comparing expected and actual...");
|
||||
compareFragmentLists("expected result", "actual result", expectedResult, nextResults);
|
||||
}
|
||||
|
||||
int[] boundaries = new int[expectedResult.size() + 3];
|
||||
boundaries[0] = RuleBasedBreakIterator.DONE;
|
||||
boundaries[1] = 0;
|
||||
for (int i = 0; i < expectedResult.size(); i++)
|
||||
boundaries[i + 2] = boundaries[i + 1] + ((String)expectedResult.elementAt(i)).length();
|
||||
|
||||
for (int i = 0; i < expectedResult.size(); i++) {
|
||||
boundaries[i + 2] = boundaries[i + 1] + (expectedResult.get(i).length());
|
||||
}
|
||||
|
||||
boundaries[boundaries.length - 1] = RuleBasedBreakIterator.DONE;
|
||||
|
||||
|
||||
_testFollowing(rbbi, text, boundaries);
|
||||
_testPreceding(rbbi, text, boundaries);
|
||||
_testIsBoundary(rbbi, text, boundaries);
|
||||
|
||||
doMultipleSelectionTest(rbbi, text);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector _testFirstAndNext(RuleBasedBreakIterator rbbi, String text) {
|
||||
private List<String> _testFirstAndNext(RuleBasedBreakIterator rbbi, String text) {
|
||||
int p = rbbi.first();
|
||||
int lastP = p;
|
||||
Vector result = new Vector();
|
||||
List<String> result = new ArrayList<String>();
|
||||
|
||||
if (p != 0)
|
||||
if (p != 0) {
|
||||
errln("first() returned " + p + " instead of 0");
|
||||
}
|
||||
|
||||
while (p != RuleBasedBreakIterator.DONE) {
|
||||
p = rbbi.next();
|
||||
if (p != RuleBasedBreakIterator.DONE) {
|
||||
if (p <= lastP)
|
||||
if (p <= lastP) {
|
||||
errln("next() failed to move forward: next() on position "
|
||||
+ lastP + " yielded " + p);
|
||||
|
||||
result.addElement(text.substring(lastP, p));
|
||||
}
|
||||
result.add(text.substring(lastP, p));
|
||||
}
|
||||
else {
|
||||
if (lastP != text.length())
|
||||
if (lastP != text.length()) {
|
||||
errln("next() returned DONE prematurely: offset was "
|
||||
+ lastP + " instead of " + text.length());
|
||||
}
|
||||
}
|
||||
lastP = p;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Vector _testLastAndPrevious(RuleBasedBreakIterator rbbi, String text) {
|
||||
private List<String> _testLastAndPrevious(RuleBasedBreakIterator rbbi, String text) {
|
||||
int p = rbbi.last();
|
||||
int lastP = p;
|
||||
Vector result = new Vector();
|
||||
List<String> result = new ArrayList<String>();
|
||||
|
||||
if (p != text.length())
|
||||
if (p != text.length()) {
|
||||
errln("last() returned " + p + " instead of " + text.length());
|
||||
}
|
||||
|
||||
while (p != RuleBasedBreakIterator.DONE) {
|
||||
p = rbbi.previous();
|
||||
if (p != RuleBasedBreakIterator.DONE) {
|
||||
if (p >= lastP)
|
||||
if (p >= lastP) {
|
||||
errln("previous() failed to move backward: previous() on position "
|
||||
+ lastP + " yielded " + p);
|
||||
}
|
||||
|
||||
result.insertElementAt(text.substring(p, lastP), 0);
|
||||
result.add(0, text.substring(p, lastP));
|
||||
}
|
||||
else {
|
||||
if (lastP != 0)
|
||||
if (lastP != 0) {
|
||||
errln("previous() returned DONE prematurely: offset was "
|
||||
+ lastP + " instead of 0");
|
||||
}
|
||||
}
|
||||
lastP = p;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void compareFragmentLists(String f1Name, String f2Name, Vector f1, Vector f2) {
|
||||
private void compareFragmentLists(String f1Name, String f2Name, List<String> f1, List<String> f2) {
|
||||
int p1 = 0;
|
||||
int p2 = 0;
|
||||
String s1;
|
||||
|
@ -360,8 +368,8 @@ public class RBBITest extends TestFmwk
|
|||
int t2 = 0;
|
||||
|
||||
while (p1 < f1.size() && p2 < f2.size()) {
|
||||
s1 = (String)f1.elementAt(p1);
|
||||
s2 = (String)f2.elementAt(p2);
|
||||
s1 = f1.get(p1);
|
||||
s2 = f2.get(p2);
|
||||
t1 += s1.length();
|
||||
t2 += s2.length();
|
||||
|
||||
|
@ -378,24 +386,24 @@ public class RBBITest extends TestFmwk
|
|||
|
||||
while (tempT1 != tempT2 && tempP1 < f1.size() && tempP2 < f2.size()) {
|
||||
while (tempT1 < tempT2 && tempP1 < f1.size()) {
|
||||
tempT1 += ((String)f1.elementAt(tempP1)).length();
|
||||
tempT1 += (f1.get(tempP1)).length();
|
||||
++tempP1;
|
||||
}
|
||||
while (tempT2 < tempT1 && tempP2 < f2.size()) {
|
||||
tempT2 += ((String)f2.elementAt(tempP2)).length();
|
||||
tempT2 += (f2.get(tempP2)).length();
|
||||
++tempP2;
|
||||
}
|
||||
}
|
||||
logln("*** " + f1Name + " has:");
|
||||
while (p1 <= tempP1 && p1 < f1.size()) {
|
||||
s1 = (String)f1.elementAt(p1);
|
||||
s1 = f1.get(p1);
|
||||
t1 += s1.length();
|
||||
debugLogln(" *** >" + s1 + "<");
|
||||
++p1;
|
||||
}
|
||||
logln("***** " + f2Name + " has:");
|
||||
while (p2 <= tempP2 && p2 < f2.size()) {
|
||||
s2 = (String)f2.elementAt(p2);
|
||||
s2 = f2.get(p2);
|
||||
t2 += s2.length();
|
||||
debugLogln(" ***** >" + s2 + "<");
|
||||
++p2;
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
*/
|
||||
package com.ibm.icu.dev.test.translit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.dev.test.TestUtil;
|
||||
|
@ -3615,7 +3616,7 @@ the ::BEGIN/::END stuff)
|
|||
|
||||
// Test incremental transliteration -- this result
|
||||
// must be the same after we finalize (see below).
|
||||
Vector v = new Vector();
|
||||
List<String> v = new ArrayList<String>();
|
||||
v.add(source);
|
||||
rsource.replace(0, rsource.length(), "");
|
||||
if (pos != null) {
|
||||
|
@ -3643,7 +3644,7 @@ the ::BEGIN/::END stuff)
|
|||
v.add(result);
|
||||
|
||||
String[] results = new String[v.size()];
|
||||
v.copyInto(results);
|
||||
v.toArray(results);
|
||||
expectAux(t.getID() + ":Incremental", results,
|
||||
result.equals(expectedResult),
|
||||
expectedResult);
|
||||
|
|
Loading…
Add table
Reference in a new issue