bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public void setLayeredPane(JLayeredPane layeredPane);
void setLayeredPane(JLayeredPane layeredPane);
9,276
public TreeMap(Comparator<? super K> c) { comparator = c; fabricateTree(0); }
public TreeMap() { comparator = c; fabricateTree(0); }
9,277
public TreeMap(Comparator<? super K> c) { comparator = c; fabricateTree(0); }
public TreeMap(Comparator<? super K> c) { comparator = c; fabricateTree(0); }
9,278
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = MAXIMUM_INTEGER_DIGITS; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
9,279
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
9,280
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
9,281
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
9,282
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
9,283
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
private final void applyPatternWithSymbols(String pattern, DecimalFormatSymbols syms) { // Initialize to the state the parser expects. negativePrefix = ""; negativeSuffix = ""; positivePrefix = ""; positiveSuffix = ""; decimalSeparatorAlwaysShown = false; groupingSize = 0; minExponentDigits = 0; multiplier = 1; useExponentialNotation = false; groupingUsed = false; maximumFractionDigits = 0; maximumIntegerDigits = 309; minimumFractionDigits = 0; minimumIntegerDigits = 1; StringBuffer buf = new StringBuffer(); String patChars = patternChars(syms); int max = pattern.length(); int index = scanFix(pattern, 0, buf, patChars, syms, false); positivePrefix = buf.toString(); index = scanFormat(pattern, index, patChars, syms, true); index = scanFix(pattern, index, buf, patChars, syms, true); positiveSuffix = buf.toString(); if (index == pattern.length()) { // No negative info. negativePrefix = null; negativeSuffix = null; } else { if (pattern.charAt(index) != syms.getPatternSeparator()) throw new IllegalArgumentException("separator character " + "expected - index: " + index); index = scanFix(pattern, index + 1, buf, patChars, syms, false); negativePrefix = buf.toString(); // We parse the negative format for errors but we don't let // it side-effect this object. index = scanFormat(pattern, index, patChars, syms, false); index = scanFix(pattern, index, buf, patChars, syms, true); negativeSuffix = buf.toString(); if (index != pattern.length()) throw new IllegalArgumentException("end of pattern expected " + "- index: " + index); } }
9,284
private final String computePattern(DecimalFormatSymbols syms) { StringBuffer mainPattern = new StringBuffer(); // We have to at least emit a zero for the minimum number of // digits. Past that we need hash marks up to the grouping // separator (and one beyond). int total_digits = Math.max(minimumIntegerDigits, groupingUsed ? groupingSize + 1 : 0); for (int i = 0; i < total_digits - minimumIntegerDigits; ++i) mainPattern.append(syms.getDigit()); for (int i = total_digits - minimumIntegerDigits; i < total_digits; ++i) mainPattern.append(syms.getZeroDigit()); // Inserting the gropuing operator afterwards is easier. if (groupingUsed) mainPattern.insert(mainPattern.length() - groupingSize, syms.getGroupingSeparator()); // See if we need decimal info. if (minimumFractionDigits > 0 || maximumFractionDigits > 0 || decimalSeparatorAlwaysShown) mainPattern.append(syms.getDecimalSeparator()); for (int i = 0; i < minimumFractionDigits; ++i) mainPattern.append(syms.getZeroDigit()); for (int i = minimumFractionDigits; i < maximumFractionDigits; ++i) mainPattern.append(syms.getDigit()); if (useExponentialNotation) { mainPattern.append(syms.getExponential()); for (int i = 0; i < minExponentDigits; ++i) mainPattern.append(syms.getZeroDigit()); if (minExponentDigits == 0) mainPattern.append(syms.getDigit()); } String main = mainPattern.toString(); String patChars = patternChars(syms); mainPattern.setLength(0); quoteFix(mainPattern, positivePrefix, patChars); mainPattern.append(main); quoteFix(mainPattern, positiveSuffix, patChars); if (negativePrefix != null) { quoteFix(mainPattern, negativePrefix, patChars); mainPattern.append(main); quoteFix(mainPattern, negativeSuffix, patChars); } return mainPattern.toString(); }
private final String computePattern(DecimalFormatSymbols syms) { StringBuffer mainPattern = new StringBuffer(); // We have to at least emit a zero for the minimum number of // digits. Past that we need hash marks up to the grouping // separator (and one beyond). int total_digits = Math.max(minimumIntegerDigits, groupingUsed ? groupingSize + 1: groupingSize); for (int i = 0; i < total_digits - minimumIntegerDigits; ++i) mainPattern.append(syms.getDigit()); for (int i = total_digits - minimumIntegerDigits; i < total_digits; ++i) mainPattern.append(syms.getZeroDigit()); // Inserting the gropuing operator afterwards is easier. if (groupingUsed) mainPattern.insert(mainPattern.length() - groupingSize, syms.getGroupingSeparator()); // See if we need decimal info. if (minimumFractionDigits > 0 || maximumFractionDigits > 0 || decimalSeparatorAlwaysShown) mainPattern.append(syms.getDecimalSeparator()); for (int i = 0; i < minimumFractionDigits; ++i) mainPattern.append(syms.getZeroDigit()); for (int i = minimumFractionDigits; i < maximumFractionDigits; ++i) mainPattern.append(syms.getDigit()); if (useExponentialNotation) { mainPattern.append(syms.getExponential()); for (int i = 0; i < minExponentDigits; ++i) mainPattern.append(syms.getZeroDigit()); if (minExponentDigits == 0) mainPattern.append(syms.getDigit()); } String main = mainPattern.toString(); String patChars = patternChars(syms); mainPattern.setLength(0); quoteFix(mainPattern, positivePrefix, patChars); mainPattern.append(main); quoteFix(mainPattern, positiveSuffix, patChars); if (negativePrefix != null) { quoteFix(mainPattern, negativePrefix, patChars); mainPattern.append(main); quoteFix(mainPattern, negativeSuffix, patChars); } return mainPattern.toString(); }
9,285
public StringBuffer format(double number, StringBuffer dest, FieldPosition fieldPos) { // A very special case. if (Double.isNaN(number)) { dest.append(symbols.getNaN()); if (fieldPos != null && fieldPos.getField() == INTEGER_FIELD) { int index = dest.length(); fieldPos.setBeginIndex(index - symbols.getNaN().length()); fieldPos.setEndIndex(index); } return dest; } boolean is_neg = number < 0; if (is_neg) { if (negativePrefix != null) dest.append(negativePrefix); else { dest.append(symbols.getMinusSign()); dest.append(positivePrefix); } number = -number; } else dest.append(positivePrefix); int integerBeginIndex = dest.length(); int integerEndIndex = 0; if (Double.isInfinite(number)) { dest.append(symbols.getInfinity()); integerEndIndex = dest.length(); } else { number *= multiplier; // Compute exponent. long exponent = 0; double baseNumber; if (useExponentialNotation) { exponent = (long) Math.floor(Math.log(number) / Math.log(10)); if (minimumIntegerDigits > 0) exponent -= minimumIntegerDigits - 1; baseNumber = (long) (number / Math.pow(10.0, exponent)); } else baseNumber = number; // Round to the correct number of digits. baseNumber += 5 * Math.pow(10.0, -maximumFractionDigits - 1); int index = dest.length(); double intPart = Math.floor(baseNumber); int count = 0; while (count < maximumIntegerDigits && (intPart > 0 || count < minimumIntegerDigits)) { long dig = (long) (intPart % 10); intPart = Math.floor(intPart / 10); // Append group separator if required. if (groupingUsed && count > 0 && count % groupingSize == 0) dest.insert(index, symbols.getGroupingSeparator()); dest.insert(index, (char) (symbols.getZeroDigit() + dig)); ++count; } integerEndIndex = dest.length(); int decimal_index = integerEndIndex; int consecutive_zeros = 0; int total_digits = 0; // Strip integer part from NUMBER. double fracPart = baseNumber - Math.floor(baseNumber); for (count = 0; count < maximumFractionDigits && (fracPart != 0 || count < minimumFractionDigits); ++count) { ++total_digits; fracPart *= 10; long dig = (long) fracPart; if (dig == 0) ++consecutive_zeros; else consecutive_zeros = 0; dest.append((char) (symbols.getZeroDigit() + dig)); // Strip integer part from FRACPART. fracPart = fracPart - Math.floor(fracPart); } // Strip extraneous trailing `0's. We can't always detect // these in the loop. int extra_zeros = Math.min(consecutive_zeros, total_digits - minimumFractionDigits); if (extra_zeros > 0) { dest.setLength(dest.length() - extra_zeros); total_digits -= extra_zeros; } // If required, add the decimal symbol. if (decimalSeparatorAlwaysShown || total_digits > 0) { dest.insert(decimal_index, symbols.getDecimalSeparator()); if (fieldPos != null && fieldPos.getField() == FRACTION_FIELD) { fieldPos.setBeginIndex(decimal_index + 1); fieldPos.setEndIndex(dest.length()); } } // Finally, print the exponent. if (useExponentialNotation) { dest.append(symbols.getExponential()); if (exponent < 0) { dest.append(symbols.getMinusSign()); exponent = -exponent; } index = dest.length(); for (count = 0; exponent > 0 || count < minExponentDigits; ++count) { long dig = exponent % 10; exponent /= 10; dest.insert(index, (char) (symbols.getZeroDigit() + dig)); } } } if (fieldPos != null && fieldPos.getField() == INTEGER_FIELD) { fieldPos.setBeginIndex(integerBeginIndex); fieldPos.setEndIndex(integerEndIndex); } dest.append((is_neg && negativeSuffix != null) ? negativeSuffix : positiveSuffix); return dest; }
public StringBuffer format(double number, StringBuffer dest, FieldPosition fieldPos) { // A very special case. if (Double.isNaN(number)) { dest.append(symbols.getNaN()); if (fieldPos != null && fieldPos.getField() == INTEGER_FIELD) { int index = dest.length(); fieldPos.setBeginIndex(index - symbols.getNaN().length()); fieldPos.setEndIndex(index); } return dest; } boolean is_neg = number < 0; if (is_neg) { if (negativePrefix != null) dest.append(negativePrefix); else { dest.append(symbols.getMinusSign()); dest.append(positivePrefix); } number = -number; } else dest.append(positivePrefix); int integerBeginIndex = dest.length(); int integerEndIndex = 0; if (Double.isInfinite(number)) { dest.append(symbols.getInfinity()); integerEndIndex = dest.length(); } else { number *= multiplier; // Compute exponent. long exponent = 0; double baseNumber; if (useExponentialNotation) { exponent = (long) Math.floor(Math.log(number) / Math.log(10)); if (minimumIntegerDigits > 0) exponent -= minimumIntegerDigits - 1; baseNumber = (long) (number / Math.pow(10.0, exponent)); } else baseNumber = number; // Round to the correct number of digits. baseNumber += 5 * Math.pow(10.0, -maximumFractionDigits - 1); int index = dest.length(); double intPart = Math.floor(baseNumber); int count = 0; while (count < maximumIntegerDigits && (intPart > 0 || count < minimumIntegerDigits)) { long dig = (long) (intPart % 10); intPart = Math.floor(intPart / 10); // Append group separator if required. if (groupingUsed && count > 0 && count % groupingSize == 0) dest.insert(index, symbols.getGroupingSeparator()); dest.insert(index, (char) (symbols.getZeroDigit() + dig)); ++count; } integerEndIndex = dest.length(); int decimal_index = integerEndIndex; int consecutive_zeros = 0; int total_digits = 0; // Strip integer part from NUMBER. double fracPart = baseNumber - Math.floor(baseNumber); for (count = 0; count < maximumFractionDigits && (fracPart != 0 || count < minimumFractionDigits); ++count) { ++total_digits; fracPart *= 10; long dig = (long) fracPart; if (dig == 0) ++consecutive_zeros; else consecutive_zeros = 0; dest.append((char) (symbols.getZeroDigit() + dig)); // Strip integer part from FRACPART. fracPart = fracPart - Math.floor(fracPart); } // Strip extraneous trailing `0's. We can't always detect // these in the loop. int extra_zeros = Math.min(consecutive_zeros, total_digits - minimumFractionDigits); if (extra_zeros > 0) { dest.setLength(dest.length() - extra_zeros); total_digits -= extra_zeros; } // If required, add the decimal symbol. if (decimalSeparatorAlwaysShown || total_digits > 0) { dest.insert(decimal_index, symbols.getDecimalSeparator()); if (fieldPos != null && fieldPos.getField() == FRACTION_FIELD) { fieldPos.setBeginIndex(decimal_index + 1); fieldPos.setEndIndex(dest.length()); } } // Finally, print the exponent. if (useExponentialNotation) { dest.append(symbols.getExponential()); if (exponent < 0) { dest.append(symbols.getMinusSign()); exponent = -exponent; } index = dest.length(); for (count = 0; exponent > 0 || count < minExponentDigits; ++count) { long dig = exponent % 10; exponent /= 10; dest.insert(index, (char) (symbols.getZeroDigit() + dig)); } } } if (fieldPos != null && fieldPos.getField() == INTEGER_FIELD) { fieldPos.setBeginIndex(integerBeginIndex); fieldPos.setEndIndex(integerEndIndex); } dest.append((is_neg && negativeSuffix != null) ? negativeSuffix : positiveSuffix); return dest; }
9,286
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 int_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; }
9,287
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; }
9,289
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; }
9,290
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; }
9,291
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; }
9,292
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 = frac_buf = new StringBuffer(); frac_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; }
9,293
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; }
9,294
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; exp_index = index+1; } 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; }
9,295
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; }
9,296
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; }
9,297
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; }
9,298
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, FormatBuffer 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; }
9,299
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(); boolean quoteStarted = false; buf.clear(); 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; }
9,300
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 (quoteStarted) { if (c == '\'') quoteStarted = false; else 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; }
9,301
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; }
9,302
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; }
9,303
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; }
9,304
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; }
9,305
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; }
9,307
public void setMaximumFractionDigits(int newValue) { maximumFractionDigits = Math.min(newValue, 340); }
public void setMaximumFractionDigits(int newValue) { maximumFractionDigits = Math.min(newValue, 340); }
9,309
public void setMaximumIntegerDigits(int newValue) { maximumIntegerDigits = Math.min(newValue, 309); }
public void setMaximumIntegerDigits(int newValue) { maximumIntegerDigits = Math.min(newValue, 309); }
9,310
public void setMinimumFractionDigits(int newValue) { minimumFractionDigits = Math.min(newValue, 340); }
public void setMinimumFractionDigits(int newValue) { minimumFractionDigits = Math.min(newValue, 340); }
9,311
public void setMinimumIntegerDigits(int newValue) { minimumIntegerDigits = Math.min(newValue, 309); }
public void setMinimumIntegerDigits(int newValue) { minimumIntegerDigits = Math.min(newValue, 309); }
9,312
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'); }
9,313
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'); }
9,314
public abstract StringBuffer format (double number, StringBuffer sbuf, FieldPosition pos);
public abstract StringBuffer format (double number, StringBuffer sbuf, FieldPosition pos);
9,315
public boolean isBorderOpaque();
boolean isBorderOpaque();
9,316
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);
9,317
public boolean isLoggable(LogRecord record);
boolean isLoggable(LogRecord record);
9,318
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(); }
9,319
public Rectangle2D getBounds () throws NotImplementedException { throw new Error ("not implemented"); }
public Rectangle2D getBounds () throws NotImplementedException { throw new Error ("not implemented"); }
9,322
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()); }
9,323
public Dimension getMaximumSize(JComponent c) { return getPreferredSize(c); }
public Dimension getMaximumSize(JComponent c) { return maxSize; }
9,324
public Dimension getMinimumSize(JComponent c) { return getPreferredSize(c); }
public Dimension getMinimumSize(JComponent c) { return minSize; }
9,325
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; }
9,326
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; }
9,327
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; }
9,328
public void paint(Graphics g, JComponent c) { Rectangle r = new Rectangle(); SwingUtilities.calculateInnerArea(c, r); Color saved = g.getColor(); int midAB = r.width / 2 + r.x; int midAD = r.height / 2 + r.y; JSeparator s; if (c instanceof JSeparator) s = (JSeparator) c; else return; if (s.getOrientation() == JSeparator.HORIZONTAL) { g.setColor(highlight); g.drawLine(r.x, midAD, r.x + r.width, midAD); g.setColor(shadow); g.drawLine(r.x, midAD + 1, r.x + r.width, midAD + 1); } else { g.setColor(highlight); g.drawLine(midAB, r.y, midAB, r.y + r.height); g.setColor(shadow); g.drawLine(midAB + 1, r.y, midAB + 1, r.y + r.height); } }
public void paint(Graphics g, JComponent c) { Rectangle r = new Rectangle(); SwingUtilities.calculateInnerArea(c, r); Color saved = g.getColor(); int midAB = r.width / 2 + r.x; int midAD = r.height / 2 + r.y; JSeparator s; if (c instanceof JSeparator) s = (JSeparator) c; else return; if (s.getOrientation() == JSeparator.HORIZONTAL) { g.setColor(highlight); g.drawLine(r.x, midAD, r.x + r.width, midAD); g.setColor(shadow); g.drawLine(r.x, midAD + 1, r.x + r.width, midAD + 1); } else { g.setColor(highlight); g.drawLine(midAB, r.y, midAB, r.y + r.height); g.setColor(shadow); g.drawLine(midAB + 1, r.y, midAB + 1, r.y + r.height); } }
9,329
public void paint(Graphics g, JComponent c) { Rectangle r = new Rectangle(); SwingUtilities.calculateInnerArea(c, r); Color saved = g.getColor(); int midAB = r.width / 2 + r.x; int midAD = r.height / 2 + r.y; JSeparator s; if (c instanceof JSeparator) s = (JSeparator) c; else return; if (s.getOrientation() == JSeparator.HORIZONTAL) { g.setColor(highlight); g.drawLine(r.x, midAD, r.x + r.width, midAD); g.setColor(shadow); g.drawLine(r.x, midAD + 1, r.x + r.width, midAD + 1); } else { g.setColor(highlight); g.drawLine(midAB, r.y, midAB, r.y + r.height); g.setColor(shadow); g.drawLine(midAB + 1, r.y, midAB + 1, r.y + r.height); } }
public void paint(Graphics g, JComponent c) { Rectangle r = new Rectangle(); SwingUtilities.calculateInnerArea(c, r); Color saved = g.getColor(); int midAB = r.width / 2 + r.x; int midAD = r.height / 2 + r.y; JSeparator s; if (c instanceof JSeparator) s = (JSeparator) c; else return; if (s.getOrientation() == JSeparator.HORIZONTAL) { g.setColor(highlight); g.drawLine(r.x, midAD, r.x + r.width, midAD); g.setColor(shadow); g.drawLine(r.x, midAD + 1, r.x + r.width, midAD + 1); } else { g.setColor(highlight); g.drawLine(midAB, r.y, midAB, r.y + r.height); g.setColor(shadow); g.drawLine(midAB + 1, r.y, midAB + 1, r.y + r.height); } }
9,330
public TreeSelectionEvent(Object source, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath) { super(source); this.paths = new TreePath[]{path}; this.areNew = new boolean[]{isNew}; this.oldLeadSelectionPath = oldLeadSelectionPath; this.newLeadSelectionPath = newLeadSelectionPath; } // TreeSelectionEvent()
public TreeSelectionEvent(Object source, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath) { super(source); this.paths = new TreePath[]{path}; this.areNew = new boolean[]{isNew}; this.oldLeadSelectionPath = oldLeadSelectionPath; this.newLeadSelectionPath = newLeadSelectionPath; } // TreeSelectionEvent()
9,331
public TreeSelectionEvent(Object source, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath) { super(source); this.paths = new TreePath[]{path}; this.areNew = new boolean[]{isNew}; this.oldLeadSelectionPath = oldLeadSelectionPath; this.newLeadSelectionPath = newLeadSelectionPath; } // TreeSelectionEvent()
public TreeSelectionEvent(Object source, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath) { super(source); this.paths = new TreePath[]{path}; this.areNew = new boolean[]{isNew}; this.oldLeadSelectionPath = oldLeadSelectionPath; this.newLeadSelectionPath = newLeadSelectionPath; } // TreeSelectionEvent()
9,332
public boolean equals(Object object) { // Variables Object[] treepath; int index; // Check for TreePath if (object instanceof TreePath) { // Get Path Elements treepath = ((TreePath) object).getPath(); // Check length if (treepath.length != path.length) { return false; } // if // Check Elements for (index = 0; index < path.length; index++) { if (treepath[index] != path[index]) { return false; } // if } // for // Tree Path's are equals return true; } // if // Unequal return false; } // equals()
public boolean equals(Object object) { // Variables Object[] treepath; int index; // Check for TreePath if (object instanceof TreePath) { // Get Path Elements treepath = ((TreePath) object).getPath(); // Check length if (treepath.length != path.length) return false; } // if // Check Elements for (index = 0; index < path.length; index++) { if (treepath[index] != path[index]) { return false; } // if } // for // Tree Path's are equals return true; } // if // Unequal return false; } // equals()
9,333
public boolean equals(Object object) { // Variables Object[] treepath; int index; // Check for TreePath if (object instanceof TreePath) { // Get Path Elements treepath = ((TreePath) object).getPath(); // Check length if (treepath.length != path.length) { return false; } // if // Check Elements for (index = 0; index < path.length; index++) { if (treepath[index] != path[index]) { return false; } // if } // for // Tree Path's are equals return true; } // if // Unequal return false; } // equals()
public boolean equals(Object object) { // Variables Object[] treepath; int index; // Check for TreePath if (object instanceof TreePath) { // Get Path Elements treepath = ((TreePath) object).getPath(); // Check length if (treepath.length != path.length) { return false; // if // Check Elements for (index = 0; index < path.length; index++) { if (treepath[index] != path[index]) { return false; // if // for // Tree Path's are equals return true; // if // Unequal return false; // equals()
9,334
public boolean equals(Object object) { // Variables Object[] treepath; int index; // Check for TreePath if (object instanceof TreePath) { // Get Path Elements treepath = ((TreePath) object).getPath(); // Check length if (treepath.length != path.length) { return false; } // if // Check Elements for (index = 0; index < path.length; index++) { if (treepath[index] != path[index]) { return false; } // if } // for // Tree Path's are equals return true; } // if // Unequal return false; } // equals()
public boolean equals(Object object) { // Variables Object[] treepath; int index; // Check for TreePath if (object instanceof TreePath) { // Get Path Elements treepath = ((TreePath) object).getPath(); // Check length if (treepath.length != path.length) { return false; } // if // Check Elements for (index = 0; index < path.length; index++) { if (treepath[index] != path[index]) { return false; } // if } // for // Tree Path's are equals return true; } // if // Unequal return false; } // equals()
9,335
public boolean equals(Object object) { // Variables Object[] treepath; int index; // Check for TreePath if (object instanceof TreePath) { // Get Path Elements treepath = ((TreePath) object).getPath(); // Check length if (treepath.length != path.length) { return false; } // if // Check Elements for (index = 0; index < path.length; index++) { if (treepath[index] != path[index]) { return false; } // if } // for // Tree Path's are equals return true; } // if // Unequal return false; } // equals()
public boolean equals(Object object) { // Variables Object[] treepath; int index; // Check for TreePath if (object instanceof TreePath) { // Get Path Elements treepath = ((TreePath) object).getPath(); // Check length if (treepath.length != path.length) { return false; } // if // Check Elements for (index = 0; index < path.length; index++) { if (treepath[index] != path[index]) { return false; } // if } // for // Tree Path's are equals return true; } // if // Unequal return false; } // equals()
9,336
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); for (int i = 0; i < 16; i += 2) { int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); boolean empty = sbuf.length() == 0; if (empty) { if (i > 0) sbuf.append("::"); } else sbuf.append(':'); if (x != 0 || i >= 14) sbuf.append(Integer.toHexString(x)); } return sbuf.toString(); }
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); for (int i = 0; i < 16; i += 2) { int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); if (empty) { if (i > 0) sbuf.append("::"); } else sbuf.append(':'); if (x != 0 || i >= 14) sbuf.append(Integer.toHexString(x)); } return sbuf.toString(); }
9,337
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); for (int i = 0; i < 16; i += 2) { int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); boolean empty = sbuf.length() == 0; if (empty) { if (i > 0) sbuf.append("::"); } else sbuf.append(':'); if (x != 0 || i >= 14) sbuf.append(Integer.toHexString(x)); } return sbuf.toString(); }
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); for (int i = 0; i < 16; i += 2) { int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); boolean empty = sbuf.length() == 0; if (empty) { if (i > 0) sbuf.append("::"); } else sbuf.append(':'); if (x != 0 || i >= 14) sbuf.append(Integer.toHexString(x)); } return sbuf.toString(); }
9,338
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); for (int i = 0; i < 16; i += 2) { int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); boolean empty = sbuf.length() == 0; if (empty) { if (i > 0) sbuf.append("::"); } else sbuf.append(':'); if (x != 0 || i >= 14) sbuf.append(Integer.toHexString(x)); } return sbuf.toString(); }
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); for (int i = 0; i < 16; i += 2) { int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); boolean empty = sbuf.length() == 0; if (empty) { if (i > 0) sbuf.append("::"); } else sbuf.append(':'); if (x != 0 || i >= 14) sbuf.append(Integer.toHexString(x)); } return sbuf.toString(); }
9,339
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); for (int i = 0; i < 16; i += 2) { int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); boolean empty = sbuf.length() == 0; if (empty) { if (i > 0) sbuf.append("::"); } else sbuf.append(':'); if (x != 0 || i >= 14) sbuf.append(Integer.toHexString(x)); } return sbuf.toString(); }
public String getHostAddress() { StringBuffer sbuf = new StringBuffer(40); for (int i = 0; i < 16; i += 2) { int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); boolean empty = sbuf.length() == 0; if (empty) { if (i > 0) sbuf.append("::"); } else sbuf.append(':'); sbuf.append(Integer.toHexString(x)); } return sbuf.toString(); }
9,340
public IIOImage (RenderedImage image, List thumbnails, IIOMetadata metadata) { if (image == null) throw new IllegalArgumentException ("image may not be null"); this.image = image; this.thumbnails = thumbnails; this.metadata = metadata; }
public IIOImage (Raster raster, List thumbnails, IIOMetadata metadata) { if (image == null) throw new IllegalArgumentException ("image may not be null"); this.image = image; this.thumbnails = thumbnails; this.metadata = metadata; }
9,341
public IIOImage (RenderedImage image, List thumbnails, IIOMetadata metadata) { if (image == null) throw new IllegalArgumentException ("image may not be null"); this.image = image; this.thumbnails = thumbnails; this.metadata = metadata; }
public IIOImage (RenderedImage image, List thumbnails, IIOMetadata metadata) { if (image == null) throw new IllegalArgumentException ("image may not be null"); this.image = image; this.thumbnails = thumbnails; this.metadata = metadata; }
9,342
public IIOImage (RenderedImage image, List thumbnails, IIOMetadata metadata) { if (image == null) throw new IllegalArgumentException ("image may not be null"); this.image = image; this.thumbnails = thumbnails; this.metadata = metadata; }
public IIOImage (RenderedImage image, List thumbnails, IIOMetadata metadata) { if (image == null) throw new IllegalArgumentException ("image may not be null"); this.raster = raster; this.thumbnails = thumbnails; this.metadata = metadata; }
9,343
public int getNumThumbnails() { return thumbnails.size(); }
public int getNumThumbnails() { return thumbnails == null ? 0 : thumbnails.size(); }
9,344
public void appendData(String arg) { if (isReadonly()) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } String value = text + arg; mutating(value); text = value; }
public void appendData(String arg) { if (isReadonly()) { throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } String value = text + arg; mutating(value); text = value; }
9,345
public void deleteData(int offset, int count) { if (isReadonly()) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); if (offset < 0 || count < 0 || offset > raw.length) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { count = raw.length - offset; } if (count == 0) { return; } try { char[] buf = new char[raw.length - count]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(raw, offset + count, buf, offset, raw.length - (offset + count)); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
public void deleteData(int offset, int count) { if (isReadonly()) { throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); if (offset < 0 || count < 0 || offset > raw.length) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { count = raw.length - offset; } if (count == 0) { return; } try { char[] buf = new char[raw.length - count]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(raw, offset + count, buf, offset, raw.length - (offset + count)); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
9,346
public void deleteData(int offset, int count) { if (isReadonly()) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); if (offset < 0 || count < 0 || offset > raw.length) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { count = raw.length - offset; } if (count == 0) { return; } try { char[] buf = new char[raw.length - count]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(raw, offset + count, buf, offset, raw.length - (offset + count)); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
public void deleteData(int offset, int count) { if (isReadonly()) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); if (offset < 0 || count < 0 || offset > raw.length) { throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { count = raw.length - offset; } if (count == 0) { return; } try { char[] buf = new char[raw.length - count]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(raw, offset + count, buf, offset, raw.length - (offset + count)); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } }
9,347
public void insertData(int offset, String arg) { if (isReadonly()) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); char[] tmp = arg.toCharArray (); char[] buf = new char[raw.length + tmp.length]; try { System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(tmp, 0, buf, offset, tmp.length); System.arraycopy(raw, offset, buf, offset + tmp.length, raw.length - offset); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
public void insertData(int offset, String arg) { if (isReadonly()) { throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); char[] tmp = arg.toCharArray (); char[] buf = new char[raw.length + tmp.length]; try { System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(tmp, 0, buf, offset, tmp.length); System.arraycopy(raw, offset, buf, offset + tmp.length, raw.length - offset); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
9,348
public void insertData(int offset, String arg) { if (isReadonly()) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); char[] tmp = arg.toCharArray (); char[] buf = new char[raw.length + tmp.length]; try { System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(tmp, 0, buf, offset, tmp.length); System.arraycopy(raw, offset, buf, offset + tmp.length, raw.length - offset); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
public void insertData(int offset, String arg) { if (isReadonly()) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); char[] tmp = arg.toCharArray (); char[] buf = new char[raw.length + tmp.length]; try { System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(tmp, 0, buf, offset, tmp.length); System.arraycopy(raw, offset, buf, offset + tmp.length, raw.length - offset); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } }
9,349
public void replaceData(int offset, int count, String arg) { if (readonly) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); // deleteData if (offset < 0 || count < 0 || offset > raw.length) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { count = raw.length - offset; } try { char[] buf = new char[raw.length - count]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(raw, offset + count, buf, offset, raw.length - (offset + count)); // insertData char[] tmp = arg.toCharArray (); char[] buf2 = new char[buf.length + tmp.length]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(tmp, 0, buf, offset, tmp.length); System.arraycopy(raw, offset, buf, offset + tmp.length, raw.length - offset); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
public void replaceData(int offset, int count, String arg) { if (readonly) { throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); // deleteData if (offset < 0 || count < 0 || offset > raw.length) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { count = raw.length - offset; } try { char[] buf = new char[raw.length - count]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(raw, offset + count, buf, offset, raw.length - (offset + count)); // insertData char[] tmp = arg.toCharArray (); char[] buf2 = new char[buf.length + tmp.length]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(tmp, 0, buf, offset, tmp.length); System.arraycopy(raw, offset, buf, offset + tmp.length, raw.length - offset); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
9,350
public void replaceData(int offset, int count, String arg) { if (readonly) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); // deleteData if (offset < 0 || count < 0 || offset > raw.length) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { count = raw.length - offset; } try { char[] buf = new char[raw.length - count]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(raw, offset + count, buf, offset, raw.length - (offset + count)); // insertData char[] tmp = arg.toCharArray (); char[] buf2 = new char[buf.length + tmp.length]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(tmp, 0, buf, offset, tmp.length); System.arraycopy(raw, offset, buf, offset + tmp.length, raw.length - offset); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
public void replaceData(int offset, int count, String arg) { if (readonly) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); // deleteData if (offset < 0 || count < 0 || offset > raw.length) { throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { count = raw.length - offset; } try { char[] buf = new char[raw.length - count]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(raw, offset + count, buf, offset, raw.length - (offset + count)); // insertData char[] tmp = arg.toCharArray (); char[] buf2 = new char[buf.length + tmp.length]; System.arraycopy(raw, 0, buf, 0, offset); System.arraycopy(tmp, 0, buf, offset, tmp.length); System.arraycopy(raw, offset, buf, offset + tmp.length, raw.length - offset); String value = new String(buf); mutating(value); text = value; } catch (IndexOutOfBoundsException x) { throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } }
9,351
public void setNodeValue(String value) { if (isReadonly()) { throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR); } if (value == null) { value = ""; } mutating(value); text = value; }
public void setNodeValue(String value) { if (isReadonly()) { throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (value == null) { value = ""; } mutating(value); text = value; }
9,352
public String substringData(int offset, int count) { try { return text.substring(offset, count); } catch (StringIndexOutOfBoundsException e) { if (offset >= 0 && count >= 0 && offset < text.length()) { return text.substring(offset); } throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
public String substringData(int offset, int count) { try { return text.substring(offset, count); } catch (StringIndexOutOfBoundsException e) { if (offset >= 0 && count >= 0 && offset < text.length()) { return text.substring(offset); } throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } }
9,353
public RemoteException(String s) { this(s, null); }
public RemoteException() { this(s, null); }
9,354
public RemoteException(String s) { this(s, null); }
public RemoteException(String s) { this(null, null); }
9,355
public InetSocketAddress(String hostname, int port) throws IllegalArgumentException { if (port < 0 || port > 65535) throw new IllegalArgumentException(); this.port = port; this.hostname = hostname; try { this.addr = InetAddress.getByName(hostname); } catch (Exception e) // UnknownHostException, SecurityException { this.addr = null; } }
public InetSocketAddress(InetAddress addr, int port) throws IllegalArgumentException { if (port < 0 || port > 65535) throw new IllegalArgumentException(); this.port = port; this.hostname = hostname; try { this.addr = InetAddress.getByName(hostname); } catch (Exception e) // UnknownHostException, SecurityException { this.addr = null; } }
9,356
public InetSocketAddress(String hostname, int port) throws IllegalArgumentException { if (port < 0 || port > 65535) throw new IllegalArgumentException(); this.port = port; this.hostname = hostname; try { this.addr = InetAddress.getByName(hostname); } catch (Exception e) // UnknownHostException, SecurityException { this.addr = null; } }
public InetSocketAddress(String hostname, int port) throws IllegalArgumentException { if (port < 0 || port > 65535) throw new IllegalArgumentException("Bad port number: " + port); this.port = port; this.hostname = hostname; try { this.addr = InetAddress.getByName(hostname); } catch (Exception e) // UnknownHostException, SecurityException { this.addr = null; } }
9,357
public InetSocketAddress(String hostname, int port) throws IllegalArgumentException { if (port < 0 || port > 65535) throw new IllegalArgumentException(); this.port = port; this.hostname = hostname; try { this.addr = InetAddress.getByName(hostname); } catch (Exception e) // UnknownHostException, SecurityException { this.addr = null; } }
public InetSocketAddress(String hostname, int port) throws IllegalArgumentException { if (port < 0 || port > 65535) throw new IllegalArgumentException(); this.port = port; this.hostname = hostname; try { this.addr = InetAddress.getByName(hostname); } catch (Exception e) // UnknownHostException, SecurityException { this.addr = null; } }
9,358
public ProtocolException(String message) { super(message); }
public ProtocolException() { super(message); }
9,359
public ProtocolException(String message) { super(message); }
public ProtocolException(String message) { }
9,360
ForEachNode(TemplateNode children, TemplateNode next, Expr select, List sortKeys) { super(children, next); this.select = select; this.sortKeys = sortKeys; }
ForEachNode(TemplateNode children, TemplateNode next, Expr select, List sortKeys) { super(children, next); this.select = select; this.sortKeys = sortKeys; }
9,361
ForEachNode(TemplateNode children, TemplateNode next, Expr select, List sortKeys) { super(children, next); this.select = select; this.sortKeys = sortKeys; }
ForEachNode(TemplateNode children, TemplateNode next, Expr select, List sortKeys) { this.select = select; this.sortKeys = sortKeys; }
9,362
TemplateNode clone(Stylesheet stylesheet) { int len = sortKeys.size(); List sortKeys2 = new ArrayList(len); for (int i = 0; i < len; i++) { sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); } return new ForEachNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet), select.clone(stylesheet), sortKeys2); }
TemplateNode clone(Stylesheet stylesheet) { int len = sortKeys.size(); List sortKeys2 = new ArrayList(len); for (int i = 0; i < len; i++) { sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); } return new ForEachNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet), select.clone(stylesheet), sortKeys2); }
9,363
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus);
Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus);
9,365
public Component getEditorComponent();
Component getEditorComponent();
9,366
public void addItemListener(ItemListener value0) { // TODO } // addItemListener()
public void addItemListener(ItemListener value0) { // TODO } // addItemListener()
9,367
public void setItem(Object item);
void setItem(Object item);
9,368
public void removeItemListener(ItemListener value0) { // TODO } // removeItemListener()
public void removeItemListener(ItemListener value0) { // TODO } // removeItemListener()
9,369
public Set getAllFonts() { if(fontsByName.size() == 0) { // load the luxisr.ttf TTFFontData fontData; try { fontData = new TTFFontDataFile(this.getClass().getClassLoader().getResource("/" + "luxisr.ttf")); TTFFont font = new TTFFont(fontData,10 ); fontsByName.put(font.getName(),font); } catch (IOException e) { throw new RuntimeException(e); } } return new HashSet(fontsByName.values()); }
public Set getAllFonts() { if(fontsByName.size() == 0) { // load the luxisr.ttf TTFFontData fontData; try { fontData = new TTFFontDataFile(this.getClass().getClassLoader().getResource("/" + "luxisr.ttf")); TTFFont font = new TTFFont(fontData,10 ); fontsByName.put(font.getName(),font); } catch (IOException e) { throw new RuntimeException(e); } } return new HashSet(fontsByName.values()); }
9,370
private TTFFontData getFontData(Font font) { if(font instanceof TTFFont) return ((TTFFont)font).getFontData(); return null; }
private TTFFontData getFontData(Font font) { if(font instanceof TTFFont) return ((TTFFont)font).getFontData(); return null; }
9,371
public boolean provides(Font font) { final Font f = (Font)fontsByName.get(font.getFamily()); return (f != null); }
public boolean provides(Font font) { if (!fontsLoaded) { loadFonts(); } final Font f = (Font) fontsByName.get(font.getFamily()); return (f != null); }
9,372
public boolean isLoggable(LogRecord record) { if (record.getLevel().intValue() < level.intValue()) return false; if (filter != null) return filter.isLoggable(record); else return true; }
public boolean isLoggable(LogRecord record) { if (record.getLevel().intValue() < level.intValue()) return false; if (filter != null) return filter.isLoggable(record); else return true; }
9,373
public void render(Graphics2D g, String text, int x, int y) { try { final GeneralPath gp = new GeneralPath(); gp.moveTo(x, y); final TTFGlyphTable glyphTable = fontData.getGlyphTable(); final TTFCMapTable cmapTable = fontData.getCMapTable(); final TTFHorizontalHeaderTable hheadTable = fontData.getHorizontalHeaderTable(); final TTFHorizontalMetricsTable hmTable = fontData.getHorizontalMetricsTable(); if (!(cmapTable.getNrEncodingTables() > 0)) { throw new RuntimeException("No Encoding is found!"); } final TTFCMapTable.EncodingTable encTable = cmapTable.getEncodingTable(0); if (encTable.getTableFormat() == null) { throw new RuntimeException("The table is NUll!!"); } final int ascent = hheadTable.getAscent(); final AffineTransform tx = new AffineTransform(); final double scale = fontSize / ascent; tx.translate(x, y + fontSize); //System.out.println("Scale=" + scale); tx.scale(scale, -scale); tx.translate(0, ascent); for (int i = 0; i < text.length(); i++) { // get the index for the needed glyph int index = encTable.getTableFormat().getGlyphIndex(text.charAt(i)); Shape shape = glyphTable.getGlyph(index).getShape(); gp.append(shape.getPathIterator(tx), false); tx.translate(hmTable.getAdvanceWidth(index), 0); } //System.out.println("Drawing string..." + gp + ", bounds " + gp.getBounds()); g.draw(gp); } catch (IOException ex) { log.error("Error drawing text", ex); } }
public void render(Graphics2D g, String text, int x, int y) { try { final GeneralPath gp = new GeneralPath(); gp.moveTo(x, y); final TTFGlyphTable glyphTable = fontData.getGlyphTable(); final TTFCMapTable cmapTable = fontData.getCMapTable(); final TTFHorizontalHeaderTable hheadTable = fontData.getHorizontalHeaderTable(); final TTFHorizontalMetricsTable hmTable = fontData.getHorizontalMetricsTable(); if (!(cmapTable.getNrEncodingTables() > 0)) { throw new RuntimeException("No Encoding is found!"); } final TTFCMapTable.EncodingTable encTable = cmapTable.getEncodingTable(0); if (encTable.getTableFormat() == null) { throw new RuntimeException("The table is NUll!!"); } final double ascent = hheadTable.getAscent(); final AffineTransform tx = new AffineTransform(); final double scale = fontSize / ascent; tx.translate(x, y + fontSize); //System.out.println("Scale=" + scale); tx.scale(scale, -scale); tx.translate(0, ascent); for (int i = 0; i < text.length(); i++) { // get the index for the needed glyph int index = encTable.getTableFormat().getGlyphIndex(text.charAt(i)); Shape shape = glyphTable.getGlyph(index).getShape(); gp.append(shape.getPathIterator(tx), false); tx.translate(hmTable.getAdvanceWidth(index), 0); } //System.out.println("Drawing string..." + gp + ", bounds " + gp.getBounds()); g.draw(gp); } catch (IOException ex) { log.error("Error drawing text", ex); } }
9,374
public void render(Graphics2D g, String text, int x, int y) { try { final GeneralPath gp = new GeneralPath(); gp.moveTo(x, y); final TTFGlyphTable glyphTable = fontData.getGlyphTable(); final TTFCMapTable cmapTable = fontData.getCMapTable(); final TTFHorizontalHeaderTable hheadTable = fontData.getHorizontalHeaderTable(); final TTFHorizontalMetricsTable hmTable = fontData.getHorizontalMetricsTable(); if (!(cmapTable.getNrEncodingTables() > 0)) { throw new RuntimeException("No Encoding is found!"); } final TTFCMapTable.EncodingTable encTable = cmapTable.getEncodingTable(0); if (encTable.getTableFormat() == null) { throw new RuntimeException("The table is NUll!!"); } final int ascent = hheadTable.getAscent(); final AffineTransform tx = new AffineTransform(); final double scale = fontSize / ascent; tx.translate(x, y + fontSize); //System.out.println("Scale=" + scale); tx.scale(scale, -scale); tx.translate(0, ascent); for (int i = 0; i < text.length(); i++) { // get the index for the needed glyph int index = encTable.getTableFormat().getGlyphIndex(text.charAt(i)); Shape shape = glyphTable.getGlyph(index).getShape(); gp.append(shape.getPathIterator(tx), false); tx.translate(hmTable.getAdvanceWidth(index), 0); } //System.out.println("Drawing string..." + gp + ", bounds " + gp.getBounds()); g.draw(gp); } catch (IOException ex) { log.error("Error drawing text", ex); } }
public void render(Graphics2D g, String text, int x, int y) { try { final GeneralPath gp = new GeneralPath(); gp.moveTo(x, y); final TTFGlyphTable glyphTable = fontData.getGlyphTable(); final TTFCMapTable cmapTable = fontData.getCMapTable(); final TTFHorizontalHeaderTable hheadTable = fontData.getHorizontalHeaderTable(); final TTFHorizontalMetricsTable hmTable = fontData.getHorizontalMetricsTable(); if (!(cmapTable.getNrEncodingTables() > 0)) { throw new RuntimeException("No Encoding is found!"); } final TTFCMapTable.EncodingTable encTable = cmapTable.getEncodingTable(0); if (encTable.getTableFormat() == null) { throw new RuntimeException("The table is NUll!!"); } final int ascent = hheadTable.getAscent(); final AffineTransform tx = new AffineTransform(); final double scale = fontSize / ascent; tx.translate(x, y + fontSize); //System.out.println("Scale=" + scale); tx.scale(scale, -scale); tx.translate(0, ascent); for (int i = 0; i < text.length(); i++) { // get the index for the needed glyph final int index = encTable.getTableFormat().getGlyphIndex(text.charAt(i)); Shape shape = glyphTable.getGlyph(index).getShape(); gp.append(shape.getPathIterator(tx), false); tx.translate(hmTable.getAdvanceWidth(index), 0); } //System.out.println("Drawing string..." + gp + ", bounds " + gp.getBounds()); g.draw(gp); } catch (IOException ex) { log.error("Error drawing text", ex); } }
9,375
public SQLWarning(String message, String SQLState) { super(message, SQLState); }
public SQLWarning(String reason, String SQLState, int vendorCode) { super(message, SQLState); }
9,376
public SQLWarning(String message, String SQLState) { super(message, SQLState); }
public SQLWarning(String message, String SQLState) { super(reason, SQLState, vendorCode); }
9,377
public BigInteger(byte[] val) { if (val == null || val.length < 1) throw new NumberFormatException(); words = byteArrayToIntArray(val, val[0] < 0 ? -1 : 0); BigInteger result = make(words, words.length); this.ival = result.ival; this.words = result.words; }
private BigInteger() { if (val == null || val.length < 1) throw new NumberFormatException(); words = byteArrayToIntArray(val, val[0] < 0 ? -1 : 0); BigInteger result = make(words, words.length); this.ival = result.ival; this.words = result.words; }
9,378
public BigInteger(byte[] val) { if (val == null || val.length < 1) throw new NumberFormatException(); words = byteArrayToIntArray(val, val[0] < 0 ? -1 : 0); BigInteger result = make(words, words.length); this.ival = result.ival; this.words = result.words; }
public BigInteger(byte[] val) { if (val == null || val.length < 1) throw new NumberFormatException(); words = byteArrayToIntArray(val, val[0] < 0 ? -1 : 0); BigInteger result = make(words, words.length); this.ival = result.ival; this.words = result.words; }
9,379
public String toString(int radix) { if (words == null) return Integer.toString(ival, radix); if (ival <= 2) return Long.toString(longValue(), radix); int buf_size = ival * (MPN.chars_per_word(radix) + 1); StringBuffer buffer = new StringBuffer(buf_size); format(radix, buffer); return buffer.toString(); }
public String toString() { if (words == null) return Integer.toString(ival, radix); if (ival <= 2) return Long.toString(longValue(), radix); int buf_size = ival * (MPN.chars_per_word(radix) + 1); StringBuffer buffer = new StringBuffer(buf_size); format(radix, buffer); return buffer.toString(); }
9,380
public String toString(int radix) { if (words == null) return Integer.toString(ival, radix); if (ival <= 2) return Long.toString(longValue(), radix); int buf_size = ival * (MPN.chars_per_word(radix) + 1); StringBuffer buffer = new StringBuffer(buf_size); format(radix, buffer); return buffer.toString(); }
public String toString(int radix) { if (words == null) return Integer.toString(ival, radix); if (ival <= 2) return Long.toString(longValue(), radix); int buf_size = ival * (MPN.chars_per_word(radix) + 1); StringBuffer buffer = new StringBuffer(buf_size); format(radix, buffer); return buffer.toString(); }
9,381