@Override public DigitBuffer subSequence(int start, int end) { start = clamp(start, 0, size - 1); end = clamp(end, start, size - 1); int sz = end - start; char[] newbuf = new char[16 + sz]; System.arraycopy(buf, start, newbuf, 0, sz); return new DigitBuffer(newbuf, sz); }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(unit); }
/** * Append a character to the buffer, expanding it if necessary. */ public DigitBuffer append(char ch) { check(1); this.buf[size] = ch; size++; return this; }
DigitBuffer number = new DigitBuffer(); NumberFormattingUtils.format(q, number, params, false, grouping, ctx.minIntDigits(), numberPattern.format.primaryGroupingSize(), number.appendTo(destination); DigitBuffer dbuf = new DigitBuffer(); for (FieldPattern.Node node : unitPattern) { if (node instanceof FieldPattern.Text) { dbuf.append(((FieldPattern.Text)node).text()); dbuf.appendTo(destination);
int bufferStart = buf.length(); if (idx != -1) { while (end > idx) { buf.append(s.charAt(end)); end--; buf.append(decimal); if (emit) { buf.append(group); emitted -= groupSize; groupSize = secondaryGroupingSize; buf.append(s.charAt(end)); end--; emitted++; buf.append(group); emitted -= groupSize; groupSize = secondaryGroupingSize; buf.append('0'); emitted++; buf.reverse(bufferStart);
BigDecimal n, CLDR.Currency currencyCode, StringBuilder destination, CurrencyFormatOptions options) { DigitBuffer dbuf = new DigitBuffer(); CurrencyFormatStyle style = options.style(); NumberFormatMode formatMode = orDefault(options.formatMode(), NumberFormatMode.DEFAULT); String symbol = options.symbolWidth() == CurrencySymbolWidth.NARROW ? getNarrowCurrencySymbol(currencyCode) : getCurrencySymbol(currencyCode); DigitBuffer other = new DigitBuffer(); setup(params, pattern, n, other, options, symbol, formatMode, grouping, currencyDigits, -1, -1); format(pattern, other, dbuf, symbol, null); dbuf.appendTo(destination); break; DigitBuffer number = new DigitBuffer(); NumberFormattingUtils.format(q2, number, params, true, grouping, pattern.format.minimumIntegerDigits, dbuf.appendTo(destination); break; DigitBuffer number = new DigitBuffer(); setup(GENERIC_PARAMS, pattern, n, number, options, null, formatMode, false, currencyDigits, -1, -1); number.reset();
Node node = nodes.get(i); if (node instanceof Text) { buf.append(((Text)node).text()); buf.append(number); emitted = true; switch ((Symbol)node) { case MINUS: buf.append(params.minus); break; buf.append(percent); if (!isSymbol(firstCh) && Character.isDigit(buf.last())) { buf.append(NBSP); buf.append(currency); buf.append(currency); boolean nextFormat = i < (size - 1) && nodes.get(i + 1) instanceof Format; char lastCh = currency.charAt(currency.length() - 1); if (!isSymbol(lastCh) && nextFormat) { buf.append(NBSP);
DigitBuffer dbuf = new DigitBuffer(); DecimalFormatStyle style = options.style(); boolean grouping = orDefault(options.grouping(), false); BigDecimal q = ctx.adjust(n); DigitBuffer number = new DigitBuffer(); NumberFormattingUtils.format(q, number, params, currency, grouping, ctx.minIntDigits(), pattern.format.secondaryGroupingSize()); format(pattern, number, dbuf, null, null); dbuf.appendTo(destination); break; DigitBuffer number = new DigitBuffer(); NumberFormattingUtils.format(q2, number, params, false, grouping, pattern.format.minimumIntegerDigits, dbuf.appendTo(destination); break; DigitBuffer number = new DigitBuffer(); setup(params, pattern, n, number, options, null, formatMode, grouping, -1, -1, -1); format(pattern, number, dbuf, null, symbol); dbuf.appendTo(destination); break;
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }
/** * Append the contents of the other buffer to this one. */ public void append(DigitBuffer other) { check(other.size); System.arraycopy(other.buf, 0, buf, size, other.size); size += other.size; }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }
/** * Append a string to the buffer, expanding it if necessary. */ public DigitBuffer append(String s) { int len = s.length(); check(len); for (int i = 0; i < len; i++) { this.buf[size] = s.charAt(i); size++; } return this; }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }
protected void wrapUnits(PluralCategory category, DigitBuffer dbuf, String unit, StringBuilder dest) { dbuf.appendTo(dest); dest.append(" "); dest.append(unit); }