174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes/* 2994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * Licensed to the Apache Software Foundation (ASF) under one or more 3994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * contributor license agreements. See the NOTICE file distributed with 4994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * this work for additional information regarding copyright ownership. 5994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * The ASF licenses this file to You under the Apache License, Version 2.0 6994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * (the "License"); you may not use this file except in compliance with 7994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * the License. You may obtain a copy of the License at 874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes * 9994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 1074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes * 11994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * Unless required by applicable law or agreed to in writing, software 12994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 13994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * See the License for the specific language governing permissions and 15994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes * limitations under the License. 16994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes */ 17994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes 18994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughespackage org.apache.harmony.tests.java.text; 19994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes 20994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughesimport java.text.DecimalFormat; 21994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughesimport java.text.NumberFormat; 22994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughesimport java.util.Locale; 23994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughesimport java.util.Vector; 24994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes 25994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughespublic class Support_DecimalFormat extends Support_Format { 26994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes 2774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes public Support_DecimalFormat(String p1) { 2874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes super(p1); 2974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 3074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 3174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes @Override public void runTest() { 3274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_formatToCharacterIterator(); 3374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_format_with_FieldPosition(); 3474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 3574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 3674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes public static void main(String[] args) { 3774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes new Support_DecimalFormat("").runTest(); 3874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 3974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 4074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes public void t_format_with_FieldPosition() { 4174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes DecimalFormat format = (DecimalFormat) NumberFormat.getCurrencyInstance(Locale.US); 4274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Number number = new Double(10000000.76); 4374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes String text = "$10,000,000.76"; 4474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 4574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(0, format, number, text, NumberFormat.Field.CURRENCY, 0, 1); 4674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(1, format, number, text, NumberFormat.Field.INTEGER, 1, 11); 4774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(2, format, number, text, NumberFormat.Field.GROUPING_SEPARATOR, 3, 4); 4874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(3, format, number, text, NumberFormat.Field.DECIMAL_SEPARATOR, 11, 12); 4974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(4, format, number, text, NumberFormat.Field.FRACTION, 12, 14); 5074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 5174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test fields that are not included in the formatted text 5274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(5, format, number, text, NumberFormat.Field.SIGN, 0, 0); 5374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(6, format, number, text, NumberFormat.Field.EXPONENT, 0, 0); 5474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(7, format, number, text, NumberFormat.Field.EXPONENT_SIGN, 0, 0); 5574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(8, format, number, text, NumberFormat.Field.EXPONENT_SYMBOL, 0, 0); 5674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(9, format, number, text, NumberFormat.Field.PERCENT, 0, 0); 5774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(10, format, number, text, NumberFormat.Field.PERMILLE, 0, 0); 5874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 5974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test Exponential 6074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes format = new DecimalFormat("000000000.0#E0"); 6174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes text = "100000007.6E-1"; 6274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(11, format, number, text, NumberFormat.Field.INTEGER, 0, 9); 6374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(12, format, number, text, NumberFormat.Field.DECIMAL_SEPARATOR, 9, 10); 6474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(13, format, number, text, NumberFormat.Field.FRACTION, 10, 11); 6574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(14, format, number, text, NumberFormat.Field.EXPONENT_SYMBOL, 11, 12); 6674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(15, format, number, text, NumberFormat.Field.EXPONENT_SIGN, 12, 13); 6774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(16, format, number, text, NumberFormat.Field.EXPONENT, 13, 14); 6874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 6974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test fields that are not included in the formatted text 7074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(17, format, number, text, NumberFormat.Field.GROUPING_SEPARATOR, 0, 0); 7174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(18, format, number, text, NumberFormat.Field.SIGN, 0, 0); 7274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(19, format, number, text, NumberFormat.Field.CURRENCY, 0, 0); 7374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(20, format, number, text, NumberFormat.Field.PERCENT, 0, 0); 7474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(21, format, number, text, NumberFormat.Field.PERMILLE, 0, 0); 7574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 7674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test currency instance with TR Locale 7774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes number = new Double(350.76); 7874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes format = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale("tr", "TR")); 79c56ec7b571ba6cc02ae9c1b5a790b7141b4de394Elliott Hughes // Turkey either uses "123,45 TL" or "₺123,45"; google3 uses the former because most 80c56ec7b571ba6cc02ae9c1b5a790b7141b4de394Elliott Hughes // platforms' fonts don't include U+20BA TURKISH LIRA SIGN. http://b/16727554. 81c56ec7b571ba6cc02ae9c1b5a790b7141b4de394Elliott Hughes text = "₺350,76"; 82c56ec7b571ba6cc02ae9c1b5a790b7141b4de394Elliott Hughes t_FormatWithField(23, format, number, text, NumberFormat.Field.CURRENCY, 0, 1); 83c56ec7b571ba6cc02ae9c1b5a790b7141b4de394Elliott Hughes t_FormatWithField(22, format, number, text, NumberFormat.Field.INTEGER, 1, 4); 84c56ec7b571ba6cc02ae9c1b5a790b7141b4de394Elliott Hughes t_FormatWithField(22, format, number, text, NumberFormat.Field.DECIMAL_SEPARATOR, 4, 5); 85c56ec7b571ba6cc02ae9c1b5a790b7141b4de394Elliott Hughes t_FormatWithField(22, format, number, text, NumberFormat.Field.FRACTION, 5, 7); 8674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 8774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test fields that are not included in the formatted text 8874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(25, format, number, text, NumberFormat.Field.GROUPING_SEPARATOR, 0, 0); 8974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(27, format, number, text, NumberFormat.Field.SIGN, 0, 0); 9074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(28, format, number, text, NumberFormat.Field.EXPONENT, 0, 0); 9174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(29, format, number, text, NumberFormat.Field.EXPONENT_SIGN, 0, 0); 9274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(30, format, number, text, NumberFormat.Field.EXPONENT_SYMBOL, 0, 0); 9374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(31, format, number, text, NumberFormat.Field.PERCENT, 0, 0); 9474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_FormatWithField(32, format, number, text, NumberFormat.Field.PERMILLE, 0, 0); 9574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 9674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 9774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes public void t_formatToCharacterIterator() { 9874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Number number = new Double(350.76); 9974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Number negativeNumber = new Double(-350.76); 10074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 10174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Locale us = Locale.US; 10274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Locale tr = new Locale("tr", "TR"); 10374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 10474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test number instance 10574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(1, number, NumberFormat.getNumberInstance(us), getNumberVectorUS()); 10674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 10774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test integer instance 10874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // testFormat(2, number, NumberFormat.getIntegerInstance(us), 10974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // getPercentVectorUS()); 11074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 11174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test percent instance 11274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(3, number, NumberFormat.getPercentInstance(us), getPercentVectorUS()); 11374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 11474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test permille pattern 11574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes DecimalFormat format = new DecimalFormat("###0.##\u2030"); 11674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(4, number, format, getPermilleVector()); 11774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 11874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test exponential pattern with positive exponent 11974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes format = new DecimalFormat("00.0#E0"); 12074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(5, number, format, getPositiveExponentVector()); 12174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 12274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test exponential pattern with negative exponent 12374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes format = new DecimalFormat("0000.0#E0"); 12474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(6, number, format, getNegativeExponentVector()); 12574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 12674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test currency instance with US Locale 12774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(7, number, NumberFormat.getCurrencyInstance(us), getPositiveCurrencyVectorUS()); 12874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 12974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test negative currency instance with US Locale 13074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(8, negativeNumber, NumberFormat.getCurrencyInstance(us), getNegativeCurrencyVectorUS()); 13174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 13274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test currency instance with TR Locale 13374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(9, number, NumberFormat.getCurrencyInstance(tr), getPositiveCurrencyVectorTR()); 13474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 13574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test negative currency instance with TR Locale 13674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(10, negativeNumber, NumberFormat.getCurrencyInstance(tr), getNegativeCurrencyVectorTR()); 13774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 13874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test multiple grouping separators 13974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes number = new Long(100300400); 14074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(11, number, NumberFormat.getNumberInstance(us), getNumberVector2US()); 14174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 14274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes // test 0 14374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes number = new Long(0); 14474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes t_Format(12, number, NumberFormat.getNumberInstance(us), getZeroVector()); 14574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 14674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 14774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getNumberVectorUS() { 14874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 14974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER)); 15074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(3, 4, NumberFormat.Field.DECIMAL_SEPARATOR)); 15174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(4, 6, NumberFormat.Field.FRACTION)); 15274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 15374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 15474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 15574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getPositiveCurrencyVectorTR() { 15674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 1577e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(0, 1, NumberFormat.Field.CURRENCY)); 1587e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(1, 4, NumberFormat.Field.INTEGER)); 1597e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(4, 5, NumberFormat.Field.DECIMAL_SEPARATOR)); 1607e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(5, 7, NumberFormat.Field.FRACTION)); 16174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 16274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 16374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 16474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getNegativeCurrencyVectorTR() { 16574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 1667e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(0, 1, NumberFormat.Field.SIGN)); 1677e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(1, 2, NumberFormat.Field.CURRENCY)); 1687e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(2, 5, NumberFormat.Field.INTEGER)); 1697e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(5, 6, NumberFormat.Field.DECIMAL_SEPARATOR)); 1707e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(6, 8, NumberFormat.Field.FRACTION)); 17174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 17274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 17374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 17474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getPositiveCurrencyVectorUS() { 17574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 17674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(0, 1, NumberFormat.Field.CURRENCY)); 17774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(1, 4, NumberFormat.Field.INTEGER)); 17874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(4, 5, NumberFormat.Field.DECIMAL_SEPARATOR)); 17974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(5, 7, NumberFormat.Field.FRACTION)); 18074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 18174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 18274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 18374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getNegativeCurrencyVectorUS() { 18474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 1857e9ba6479f0f350be6f3aef91b9ffdb7c0a46995Neil Fuller v.add(new FieldContainer(0, 1, NumberFormat.Field.SIGN)); 18674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(1, 2, NumberFormat.Field.CURRENCY)); 18774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(2, 5, NumberFormat.Field.INTEGER)); 18874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(5, 6, NumberFormat.Field.DECIMAL_SEPARATOR)); 18974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(6, 8, NumberFormat.Field.FRACTION)); 19074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 19174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 19274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 19374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getPercentVectorUS() { 19474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 19574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(0, 2, NumberFormat.Field.INTEGER)); 19674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(2, 3, NumberFormat.Field.INTEGER)); 19774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(2, 3, NumberFormat.Field.GROUPING_SEPARATOR)); 19874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(3, 6, NumberFormat.Field.INTEGER)); 19974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(6, 7, NumberFormat.Field.PERCENT)); 20074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 20174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 20274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 20374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getPermilleVector() { 20474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 20574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(0, 6, NumberFormat.Field.INTEGER)); 20674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(6, 7, NumberFormat.Field.PERMILLE)); 20774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 20874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 20974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 21074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getNegativeExponentVector() { 21174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 21274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(0, 4, NumberFormat.Field.INTEGER)); 21374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(4, 5, NumberFormat.Field.DECIMAL_SEPARATOR)); 21474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(5, 6, NumberFormat.Field.FRACTION)); 21574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(6, 7, NumberFormat.Field.EXPONENT_SYMBOL)); 21674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(7, 8, NumberFormat.Field.EXPONENT_SIGN)); 21774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(8, 9, NumberFormat.Field.EXPONENT)); 21874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 21974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 22074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 22174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getPositiveExponentVector() { 22274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 22374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(0, 2, NumberFormat.Field.INTEGER)); 22474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(2, 3, NumberFormat.Field.DECIMAL_SEPARATOR)); 22574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(3, 5, NumberFormat.Field.FRACTION)); 22674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(5, 6, NumberFormat.Field.EXPONENT_SYMBOL)); 22774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(6, 7, NumberFormat.Field.EXPONENT)); 22874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 22974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 23074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 23174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getNumberVector2US() { 23274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 23374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(0, 3, NumberFormat.Field.INTEGER)); 23474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(3, 4, NumberFormat.Field.GROUPING_SEPARATOR)); 23574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(3, 4, NumberFormat.Field.INTEGER)); 23674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(4, 7, NumberFormat.Field.INTEGER)); 23774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(7, 8, NumberFormat.Field.GROUPING_SEPARATOR)); 23874473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(7, 8, NumberFormat.Field.INTEGER)); 23974473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(8, 11, NumberFormat.Field.INTEGER)); 24074473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 24174473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 24274473971cc9d960376295fbcc430320c9ed62991Elliott Hughes 24374473971cc9d960376295fbcc430320c9ed62991Elliott Hughes private static Vector<FieldContainer> getZeroVector() { 24474473971cc9d960376295fbcc430320c9ed62991Elliott Hughes Vector<FieldContainer> v = new Vector<FieldContainer>(); 24574473971cc9d960376295fbcc430320c9ed62991Elliott Hughes v.add(new FieldContainer(0, 1, NumberFormat.Field.INTEGER)); 24674473971cc9d960376295fbcc430320c9ed62991Elliott Hughes return v; 24774473971cc9d960376295fbcc430320c9ed62991Elliott Hughes } 248994e4e5ded616a100ca42b16cffa36aa9f595f64Elliott Hughes} 249