bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,103
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,104
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,105
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,106
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,107
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,108
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,109
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,110
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,111
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,112
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,113
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,114
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,115
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,116
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,117
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,118
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,119
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,120
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,121
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,122
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,123
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,124
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,125
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,126
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
public Number parse(String str, ParsePosition pos) { // Our strategy is simple: copy the text into a buffer, // translating or omitting locale-specific information. Then // let Double or Long convert the number for us. boolean is_neg = false; int index = pos.getIndex(); StringBuffer buf = new StringBuffer(); // We have to check both prefixes, because one might be empty. // We want to pick the longest prefix that matches. boolean got_pos = str.startsWith(positivePrefix, index); String np = (negativePrefix != null ? negativePrefix : positivePrefix + symbols.getMinusSign()); boolean got_neg = str.startsWith(np, index); if (got_pos && got_neg) { // By checking this way, we preserve ambiguity in the case // where the negative format differs only in suffix. We // check this again later. if (np.length() > positivePrefix.length()) { is_neg = true; index += np.length(); } else index += positivePrefix.length(); } else if (got_neg) { is_neg = true; index += np.length(); } else if (got_pos) index += positivePrefix.length(); else { pos.setErrorIndex(index); return null; } // FIXME: handle Inf and NaN. // FIXME: do we have to respect minimum/maxmimum digit stuff? // What about leading zeros? What about multiplier? int start_index = index; int max = str.length(); char zero = symbols.getZeroDigit(); int last_group = -1; boolean int_part = true; boolean exp_part = false; for (; index < max; ++index) { char c = str.charAt(index); // FIXME: what about grouping size? if (groupingUsed && c == symbols.getGroupingSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } last_group = index; } else if (c >= zero && c <= zero + 9) { buf.append((char) (c - zero + '0')); exp_part = false; } else if (parseIntegerOnly) break; else if (c == symbols.getDecimalSeparator()) { if (last_group != -1 && (index - last_group) % groupingSize != 0) { pos.setErrorIndex(index); return null; } buf.append('.'); int_part = false; } else if (c == symbols.getExponential()) { buf.append('E'); int_part = false; exp_part = true; } else if (exp_part && (c == '+' || c == '-' || c == symbols.getMinusSign())) { // For exponential notation. buf.append(c); } else break; } if (index == start_index) { // Didn't see any digits. pos.setErrorIndex(index); return null; } // Check the suffix. We must do this before converting the // buffer to a number to handle the case of a number which is // the most negative Long. boolean got_pos_suf = str.startsWith(positiveSuffix, index); String ns = (negativePrefix == null ? positiveSuffix : negativeSuffix); boolean got_neg_suf = str.startsWith(ns, index); if (is_neg) { if (!got_neg_suf) { pos.setErrorIndex(index); return null; } } else if (got_pos && got_neg && got_neg_suf) { is_neg = true; } else if (got_pos != got_pos_suf && got_neg != got_neg_suf) { pos.setErrorIndex(index); return null; } String suffix = is_neg ? ns : positiveSuffix; if (is_neg) buf.insert(0, '-'); String t = buf.toString(); Number result = null; try { result = new Long(t); } catch (NumberFormatException x1) { try { result = new Double(t); } catch (NumberFormatException x2) { } } if (result == null) { pos.setErrorIndex(index); return null; } pos.setIndex(index + suffix.length()); return result; }
15,127
private final String patternChars(DecimalFormatSymbols syms) { StringBuffer buf = new StringBuffer(); buf.append(syms.getDecimalSeparator()); buf.append(syms.getDigit()); buf.append(syms.getExponential()); buf.append(syms.getGroupingSeparator()); // Adding this one causes pattern application to fail. // Of course, omitting is causes toPattern to fail. // ... but we already have bugs there. FIXME. // buf.append(syms.getMinusSign()); buf.append(syms.getPatternSeparator()); buf.append(syms.getPercent()); buf.append(syms.getPerMill()); buf.append(syms.getZeroDigit()); buf.append('\u00a4'); return buf.toString(); }
private final String patternChars(DecimalFormatSymbols syms) { StringBuffer buf = new StringBuffer(); buf.append(syms.getDecimalSeparator()); buf.append(syms.getDigit()); buf.append(syms.getExponential()); buf.append(syms.getGroupingSeparator()); // Adding this one causes pattern application to fail. // Of course, omitting is causes toPattern to fail. // ... but we already have bugs there. FIXME. // buf.append(syms.getMinusSign()); buf.append(syms.getPatternSeparator()); buf.append(syms.getPercent()); buf.append(syms.getPerMill()); buf.append(syms.getZeroDigit()); buf.append('\u00a4'); return buf.toString(); }
15,128
private final void quoteFix(StringBuffer buf, String text, String patChars) { int len = text.length(); for (int index = 0; index < len; ++index) { char c = text.charAt(index); if (patChars.indexOf(c) != -1) { buf.append('\''); buf.append(c); buf.append('\''); } else buf.append(c); } }
private final void quoteFix(StringBuffer buf, String text, String patChars) { int len = text.length(); for (int index = 0; index < len; ++index) { char c = text.charAt(index); if (patChars.indexOf(c) != -1) { buf.append('\''); buf.append(c); buf.append('\''); } else buf.append(c); } }
15,129
private final void quoteFix(StringBuffer buf, String text, String patChars) { int len = text.length(); for (int index = 0; index < len; ++index) { char c = text.charAt(index); if (patChars.indexOf(c) != -1) { buf.append('\''); buf.append(c); buf.append('\''); } else buf.append(c); } }
private final void quoteFix(StringBuffer buf, String text, String patChars) { int len = text.length(); for (int index = 0; index < len; ++index) { char c = text.charAt(index); if (patChars.indexOf(c) != -1) { buf.append('\''); buf.append(c); buf.append('\''); } else buf.append(c); } }
15,130
private final void quoteFix(StringBuffer buf, String text, String patChars) { int len = text.length(); for (int index = 0; index < len; ++index) { char c = text.charAt(index); if (patChars.indexOf(c) != -1) { buf.append('\''); buf.append(c); buf.append('\''); } else buf.append(c); } }
private final void quoteFix(StringBuffer buf, String text, String patChars) { int len = text.length(); for (int index = 0; index < len; ++index) { char c = text.charAt(index); if (patChars.indexOf(c) != -1) { buf.append('\''); buf.append(c); buf.append('\''); } else buf.append(c); } }
15,131
private final void quoteFix(StringBuffer buf, String text, String patChars) { int len = text.length(); for (int index = 0; index < len; ++index) { char c = text.charAt(index); if (patChars.indexOf(c) != -1) { buf.append('\''); buf.append(c); buf.append('\''); } else buf.append(c); } }
private final void quoteFix(StringBuffer buf, String text, String patChars) { int len = text.length(); for (int index = 0; index < len; ++index) { char c = text.charAt(index); if (patChars.indexOf(c) != -1) { buf.append('\''); buf.append(c); buf.append('\''); } else buf.append(c); } }
15,132
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); if (serialVersionOnStream < 1) { useExponentialNotation = false; serialVersionOnStream = 1; } }
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); if (serialVersionOnStream < 1) { useExponentialNotation = false; serialVersionOnStream = 1; } }
15,133
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); if (serialVersionOnStream < 1) { useExponentialNotation = false; serialVersionOnStream = 1; } }
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); if (serialVersionOnStream < 1) { useExponentialNotation = false; serialVersionOnStream = 1; } }
15,134
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,135
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,136
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,137
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,138
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,139
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,140
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,141
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,142
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,143
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,144
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
private final int scanFix(String pattern, int index, StringBuffer buf, String patChars, DecimalFormatSymbols syms, boolean is_suffix) { int len = pattern.length(); buf.setLength(0); boolean multiplierSet = false; while (index < len) { char c = pattern.charAt(index); if (c == '\'' && index + 1 < len && pattern.charAt(index + 1) == '\'') { buf.append(c); ++index; } else if (c == '\'' && index + 2 < len && pattern.charAt(index + 2) == '\'') { buf.append(pattern.charAt(index + 1)); index += 2; } else if (c == '\u00a4') { if (index + 1 < len && pattern.charAt(index + 1) == '\u00a4') { buf.append(syms.getInternationalCurrencySymbol()); ++index; } else buf.append(syms.getCurrencySymbol()); } else if (is_suffix && c == syms.getPercent()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 100; buf.append(c); } else if (is_suffix && c == syms.getPerMill()) { if (multiplierSet) throw new IllegalArgumentException("multiplier already set " + "- index: " + index); multiplierSet = true; multiplier = 1000; buf.append(c); } else if (patChars.indexOf(c) != -1) { // This is a pattern character. break; } else buf.append(c); ++index; } return index; }
15,145
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,147
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,148
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,149
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,150
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,151
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,152
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,153
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,154
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,155
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,156
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,157
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,158
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,159
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,160
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,161
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,162
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,163
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,164
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,165
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,166
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
private final int scanFormat(String pattern, int index, String patChars, DecimalFormatSymbols syms, boolean is_positive) { int max = pattern.length(); int countSinceGroup = 0; int zeroCount = 0; boolean saw_group = false; // // Scan integer part. // while (index < max) { char c = pattern.charAt(index); if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following " + "zero - index: " + index); ++countSinceGroup; } else if (c == syms.getZeroDigit()) { ++zeroCount; ++countSinceGroup; } else if (c == syms.getGroupingSeparator()) { countSinceGroup = 0; saw_group = true; } else break; ++index; } // We can only side-effect when parsing the positive format. if (is_positive) { groupingUsed = saw_group; groupingSize = (byte) countSinceGroup; minimumIntegerDigits = zeroCount; } // Early termination. if (index == max || pattern.charAt(index) == syms.getGroupingSeparator()) { if (is_positive) decimalSeparatorAlwaysShown = false; return index; } if (pattern.charAt(index) == syms.getDecimalSeparator()) { ++index; // // Scan fractional part. // int hashCount = 0; zeroCount = 0; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) { if (hashCount > 0) throw new IllegalArgumentException("zero mark " + "following digit - index: " + index); ++zeroCount; } else if (c == syms.getDigit()) { ++hashCount; } else if (c != syms.getExponential() && c != syms.getPatternSeparator() && patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { maximumFractionDigits = hashCount + zeroCount; minimumFractionDigits = zeroCount; } if (index == max) return index; } if (pattern.charAt(index) == syms.getExponential()) { // // Scan exponential format. // zeroCount = 0; ++index; while (index < max) { char c = pattern.charAt(index); if (c == syms.getZeroDigit()) ++zeroCount; else if (c == syms.getDigit()) { if (zeroCount > 0) throw new IllegalArgumentException("digit mark following zero " + "in exponent - index: " + index); } else if (patChars.indexOf(c) != -1) throw new IllegalArgumentException("unexpected special " + "character - index: " + index); else break; ++index; } if (is_positive) { useExponentialNotation = true; minExponentDigits = (byte) zeroCount; } } return index; }
15,167
public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) { symbols = newSymbols; }
public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) { symbols = newSymbols; }
15,169
public void setDecimalSeparatorAlwaysShown(boolean newValue) { decimalSeparatorAlwaysShown = newValue; }
public void setDecimalSeparatorAlwaysShown(boolean newValue) { decimalSeparatorAlwaysShown = newValue; }
15,170
public void setGroupingSize(int groupSize) { groupingSize = (byte) groupSize; }
public void setGroupingSize(int groupSize) { groupingSize = (byte) groupSize; }
15,171
public void setMaximumFractionDigits(int newValue) { maximumFractionDigits = Math.min(newValue, 340); }
public void setMaximumFractionDigits(int newValue) { maximumFractionDigits = Math.min(newValue, 340); }
15,172
public void setMaximumIntegerDigits(int newValue) { maximumIntegerDigits = Math.min(newValue, 309); }
public void setMaximumIntegerDigits(int newValue) { maximumIntegerDigits = Math.min(newValue, 309); }
15,173
public void setMinimumFractionDigits(int newValue) { minimumFractionDigits = Math.min(newValue, 340); }
public void setMinimumFractionDigits(int newValue) { minimumFractionDigits = Math.min(newValue, 340); }
15,174
public void setMinimumIntegerDigits(int newValue) { minimumIntegerDigits = Math.min(newValue, 309); }
public void setMinimumIntegerDigits(int newValue) { minimumIntegerDigits = Math.min(newValue, 309); }
15,175
public void setMultiplier(int newValue) { multiplier = newValue; }
public void setMultiplier(int newValue) { multiplier = newValue; }
15,176
public void setNegativePrefix(String newValue) { negativePrefix = newValue; }
public void setNegativePrefix(String newValue) { negativePrefix = newValue; }
15,177
public void setNegativeSuffix(String newValue) { negativeSuffix = newValue; }
public void setNegativeSuffix(String newValue) { negativeSuffix = newValue; }
15,178
public void setPositivePrefix(String newValue) { positivePrefix = newValue; }
public void setPositivePrefix(String newValue) { positivePrefix = newValue; }
15,179
public void setPositiveSuffix(String newValue) { positiveSuffix = newValue; }
public void setPositiveSuffix(String newValue) { positiveSuffix = newValue; }
15,180
public String toLocalizedPattern() { return computePattern(symbols); }
public String toLocalizedPattern() { return computePattern(symbols); }
15,181
public String toPattern() { return computePattern(nonLocalizedSymbols); }
public String toPattern() { return computePattern(nonLocalizedSymbols); }
15,182
public DecimalFormatSymbols (Locale loc) { ResourceBundle res; try { res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", loc); } catch (MissingResourceException x) { res = null; } currencySymbol = safeGetString (res, "currencySymbol", "$"); decimalSeparator = safeGetChar (res, "decimalSeparator", '.'); digit = safeGetChar (res, "digit", '#'); exponential = safeGetChar (res, "exponential", 'E'); groupingSeparator = safeGetChar (res, "groupingSeparator", ','); infinity = safeGetString (res, "infinity", "\u221e"); // FIXME: default? intlCurrencySymbol = safeGetString (res, "intlCurrencySymbol", "$"); try { monetarySeparator = safeGetChar (res, "monetarySeparator", '.'); } catch (MissingResourceException x) { monetarySeparator = decimalSeparator; } minusSign = safeGetChar (res, "minusSign", '-'); NaN = safeGetString (res, "NaN", "\ufffd"); patternSeparator = safeGetChar (res, "patternSeparator", ';'); percent = safeGetChar (res, "percent", '%'); perMill = safeGetChar (res, "perMill", '\u2030'); zeroDigit = safeGetChar (res, "zeroDigit", '0'); }
public DecimalFormatSymbols () { ResourceBundle res; try { res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", loc); } catch (MissingResourceException x) { res = null; } currencySymbol = safeGetString (res, "currencySymbol", "$"); decimalSeparator = safeGetChar (res, "decimalSeparator", '.'); digit = safeGetChar (res, "digit", '#'); exponential = safeGetChar (res, "exponential", 'E'); groupingSeparator = safeGetChar (res, "groupingSeparator", ','); infinity = safeGetString (res, "infinity", "\u221e"); // FIXME: default? intlCurrencySymbol = safeGetString (res, "intlCurrencySymbol", "$"); try { monetarySeparator = safeGetChar (res, "monetarySeparator", '.'); } catch (MissingResourceException x) { monetarySeparator = decimalSeparator; } minusSign = safeGetChar (res, "minusSign", '-'); NaN = safeGetString (res, "NaN", "\ufffd"); patternSeparator = safeGetChar (res, "patternSeparator", ';'); percent = safeGetChar (res, "percent", '%'); perMill = safeGetChar (res, "perMill", '\u2030'); zeroDigit = safeGetChar (res, "zeroDigit", '0'); }
15,183
public DecimalFormatSymbols (Locale loc) { ResourceBundle res; try { res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", loc); } catch (MissingResourceException x) { res = null; } currencySymbol = safeGetString (res, "currencySymbol", "$"); decimalSeparator = safeGetChar (res, "decimalSeparator", '.'); digit = safeGetChar (res, "digit", '#'); exponential = safeGetChar (res, "exponential", 'E'); groupingSeparator = safeGetChar (res, "groupingSeparator", ','); infinity = safeGetString (res, "infinity", "\u221e"); // FIXME: default? intlCurrencySymbol = safeGetString (res, "intlCurrencySymbol", "$"); try { monetarySeparator = safeGetChar (res, "monetarySeparator", '.'); } catch (MissingResourceException x) { monetarySeparator = decimalSeparator; } minusSign = safeGetChar (res, "minusSign", '-'); NaN = safeGetString (res, "NaN", "\ufffd"); patternSeparator = safeGetChar (res, "patternSeparator", ';'); percent = safeGetChar (res, "percent", '%'); perMill = safeGetChar (res, "perMill", '\u2030'); zeroDigit = safeGetChar (res, "zeroDigit", '0'); }
public DecimalFormatSymbols (Locale loc) { ResourceBundle res; try { res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", loc); } catch (MissingResourceException x) { res = null; } currencySymbol = safeGetString (res, "currencySymbol", "$"); decimalSeparator = safeGetChar (res, "decimalSeparator", '.'); digit = safeGetChar (res, "digit", '#'); exponential = safeGetChar (res, "exponential", 'E'); groupingSeparator = safeGetChar (res, "groupingSeparator", ','); infinity = safeGetString (res, "infinity", "\u221e"); // FIXME: default? intlCurrencySymbol = safeGetString (res, "intlCurrencySymbol", "$"); try { monetarySeparator = safeGetChar (res, "monetarySeparator", '.'); } catch (MissingResourceException x) { monetarySeparator = decimalSeparator; } minusSign = safeGetChar (res, "minusSign", '-'); NaN = safeGetString (res, "NaN", "\ufffd"); patternSeparator = safeGetChar (res, "patternSeparator", ';'); percent = safeGetChar (res, "percent", '%'); perMill = safeGetChar (res, "perMill", '\u2030'); zeroDigit = safeGetChar (res, "zeroDigit", '0'); }
15,184
public synchronized StringBuffer insert(int offset, char ch) { if (offset < 0 || offset > count) throw new StringIndexOutOfBoundsException(offset); ensureCapacity_unsynchronized(count + 1); VMSystem.arraycopy(value, offset, value, offset + 1, count - offset); value[offset] = ch; count++; return this; }
public synchronized StringBuffer insert(int offset, char[] str, int str_offset, int len) { if (offset < 0 || offset > count) throw new StringIndexOutOfBoundsException(offset); ensureCapacity_unsynchronized(count + 1); VMSystem.arraycopy(value, offset, value, offset + 1, count - offset); value[offset] = ch; count++; return this; }
15,185
public synchronized StringBuffer insert(int offset, char ch) { if (offset < 0 || offset > count) throw new StringIndexOutOfBoundsException(offset); ensureCapacity_unsynchronized(count + 1); VMSystem.arraycopy(value, offset, value, offset + 1, count - offset); value[offset] = ch; count++; return this; }
public synchronized StringBuffer insert(int offset, char ch) { if (offset < 0 || offset > count) throw new StringIndexOutOfBoundsException(offset); ensureCapacity_unsynchronized(count + 1); VMSystem.arraycopy(value, offset, value, offset + 1, count - offset); value[offset] = ch; count++; return this; }
15,186
public abstract StringBuffer format (double number, StringBuffer sbuf, FieldPosition pos);
public abstract StringBuffer format (double number, StringBuffer sbuf, FieldPosition pos);
15,187
public boolean isBorderOpaque();
public boolean isBorderOpaque();
15,188
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height);
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height);
15,189
public boolean isLoggable(LogRecord record);
public boolean isLoggable(LogRecord record);
15,190
public void error(String message, Exception ex, int errorCode) { if (everUsed) return; synchronized (ErrorManager.class) { /* The double check is intentional. If the first check was * omitted, the monitor would have to be entered every time * error() method was called. If the second check was * omitted, the code below could be executed by multiple * threads simultaneously. */ if (everUsed) return; everUsed = true; } String codeMsg; switch (errorCode) { case GENERIC_FAILURE: codeMsg = "GENERIC_FAILURE"; break; case WRITE_FAILURE: codeMsg = "WRITE_FAILURE"; break; case FLUSH_FAILURE: codeMsg = "FLUSH_FAILURE"; break; case CLOSE_FAILURE: codeMsg = "CLOSE_FAILURE"; break; case OPEN_FAILURE: codeMsg = "OPEN_FAILURE"; break; case FORMAT_FAILURE: codeMsg = "FORMAT_FAILURE"; break; default: codeMsg = String.valueOf(errorCode); break; } System.err.println("Error upon logging: " + codeMsg); if ((message != null) && (message.length() > 0)) System.err.println(message); if (ex != null) ex.printStackTrace(); }
public void error(String message, Exception ex, int errorCode) { if (everUsed) return; synchronized (this) { /* The double check is intentional. If the first check was * omitted, the monitor would have to be entered every time * error() method was called. If the second check was * omitted, the code below could be executed by multiple * threads simultaneously. */ if (everUsed) return; everUsed = true; } String codeMsg; switch (errorCode) { case GENERIC_FAILURE: codeMsg = "GENERIC_FAILURE"; break; case WRITE_FAILURE: codeMsg = "WRITE_FAILURE"; break; case FLUSH_FAILURE: codeMsg = "FLUSH_FAILURE"; break; case CLOSE_FAILURE: codeMsg = "CLOSE_FAILURE"; break; case OPEN_FAILURE: codeMsg = "OPEN_FAILURE"; break; case FORMAT_FAILURE: codeMsg = "FORMAT_FAILURE"; break; default: codeMsg = String.valueOf(errorCode); break; } System.err.println("Error upon logging: " + codeMsg); if ((message != null) && (message.length() > 0)) System.err.println(message); if (ex != null) ex.printStackTrace(); }
15,191
protected GraphicAttribute (int alignment) { this.alignment = alignment; }
protected GraphicAttribute(int alignment) { this.alignment = alignment; }
15,193
public abstract void draw (Graphics2D graphics, float x, float y);
public abstract void draw (Graphics2D graphics, float x, float y);
15,195
public final int getAlignment () { return alignment; }
public final int getAlignment() { return alignment; }
15,196
public abstract float getAdvance ();
public abstract float getAdvance ();
15,197
public abstract float getAscent ();
public abstract float getAscent ();
15,198
public Rectangle2D getBounds () throws NotImplementedException { throw new Error ("not implemented"); }
public Rectangle2D getBounds () throws NotImplementedException { throw new Error ("not implemented"); }
15,199
public Rectangle2D getBounds () throws NotImplementedException { throw new Error ("not implemented"); }
public Rectangle2D getBounds () throws NotImplementedException { float asc = getAscent(); return new Rectangle2D.Float(0, - asc, getAdvance(), asc + getDescent()); }
15,200
public abstract float getDescent ();
public abstract float getDescent ();
15,201
public Dimension getMaximumSize(JComponent c) { return getPreferredSize(c); }
public Dimension getMaximumSize(JComponent c) { return maxSize; }
15,202
public Dimension getMinimumSize(JComponent c) { return getPreferredSize(c); }
public Dimension getMinimumSize(JComponent c) { return minSize; }
15,203
public Dimension getPreferredSize(JComponent c) { Dimension dims = new Dimension(0, 0); Insets insets = c.getInsets(); if (c instanceof JSeparator) { JSeparator s = (JSeparator) c; if (s.getOrientation() == JSeparator.HORIZONTAL) { dims.height = 2; dims.width = 40; } else { dims.width = 2; dims.height = 40; } } dims.width += insets.left + insets.right; dims.height += insets.top + insets.bottom; return dims; }
public Dimension getPreferredSize(JComponent c) { Dimension dims = new Dimension(0, 0); Insets insets = c.getInsets(); if (c instanceof JSeparator) { JSeparator s = (JSeparator) c; if (s.getOrientation() == JSeparator.HORIZONTAL) { dims.height = 2; dims.width = 40; } else { dims.width = 2; dims.height = 40; } } dims.width += insets.left + insets.right; dims.height += insets.top + insets.bottom; return dims; }
15,204
public Dimension getPreferredSize(JComponent c) { Dimension dims = new Dimension(0, 0); Insets insets = c.getInsets(); if (c instanceof JSeparator) { JSeparator s = (JSeparator) c; if (s.getOrientation() == JSeparator.HORIZONTAL) { dims.height = 2; dims.width = 40; } else { dims.width = 2; dims.height = 40; } } dims.width += insets.left + insets.right; dims.height += insets.top + insets.bottom; return dims; }
publicDimensiongetPreferredSize(JComponentc){Dimensiondims=newDimension(0,0);Insetsinsets=c.getInsets();if(cinstanceofJSeparator){ JSeparators=(JSeparator)c; if(s.getOrientation()==JSeparator.HORIZONTAL) { dims.height=2; dims.width=40; } else { dims.width=2; dims.height=40; }}dims.width+=insets.left+insets.right;dims.height+=insets.top+insets.bottom;returndims;}
15,205
public Dimension getPreferredSize(JComponent c) { Dimension dims = new Dimension(0, 0); Insets insets = c.getInsets(); if (c instanceof JSeparator) { JSeparator s = (JSeparator) c; if (s.getOrientation() == JSeparator.HORIZONTAL) { dims.height = 2; dims.width = 40; } else { dims.width = 2; dims.height = 40; } } dims.width += insets.left + insets.right; dims.height += insets.top + insets.bottom; return dims; }
public Dimension getPreferredSize(JComponent c) { Dimension dims = new Dimension(0, 0); Insets insets = c.getInsets(); if (c instanceof JSeparator) { JSeparator s = (JSeparator) c; if (s.getOrientation() == JSeparator.HORIZONTAL) { dims.height = 2; dims.width = 40; } else { dims.width = 2; dims.height = 40; } } dims.width += insets.left + insets.right; dims.height += insets.top + insets.bottom; return dims; }
15,206