Tabnine Logo
NativeDecimalFormat
Code IndexAdd Tabnine to your IDE (free)

How to use
NativeDecimalFormat
in
libcore.icu

Best Java code snippets using libcore.icu.NativeDecimalFormat (Showing top 20 results out of 315)

origin: robovm/robovm

private void initNative(String pattern) {
  try {
    this.ndf = new NativeDecimalFormat(pattern, symbols);
  } catch (IllegalArgumentException ex) {
    throw new IllegalArgumentException(pattern);
  }
  super.setMaximumFractionDigits(ndf.getMaximumFractionDigits());
  super.setMaximumIntegerDigits(ndf.getMaximumIntegerDigits());
  super.setMinimumFractionDigits(ndf.getMinimumFractionDigits());
  super.setMinimumIntegerDigits(ndf.getMinimumIntegerDigits());
}
origin: robovm/robovm

/**
 * Changes the pattern of this decimal format to the specified pattern which
 * uses localized pattern characters.
 *
 * @param pattern
 *            the localized pattern.
 * @throws IllegalArgumentException
 *            if the pattern cannot be parsed.
 */
public void applyLocalizedPattern(String pattern) {
  ndf.applyLocalizedPattern(pattern);
}
origin: robovm/robovm

  public NativeDecimalFormat update(LocaleData localeData, String pattern) {
    if (decimalFormat == null) {
      currentPattern = pattern;
      currentLocaleData = localeData;
      decimalFormat = new NativeDecimalFormat(currentPattern, currentLocaleData);
    }
    if (!pattern.equals(currentPattern)) {
      decimalFormat.applyPattern(pattern);
      currentPattern = pattern;
    }
    if (localeData != currentLocaleData) {
      decimalFormat.setDecimalFormatSymbols(localeData);
      currentLocaleData = localeData;
    }
    return decimalFormat;
  }
}
origin: robovm/robovm

@Override
public final StringBuffer format(Object number, StringBuffer buffer, FieldPosition position) {
  checkBufferAndFieldPosition(buffer, position);
  if (number instanceof BigInteger) {
    BigInteger bigInteger = (BigInteger) number;
    char[] chars = (bigInteger.bitLength() < 64)
        ? ndf.formatLong(bigInteger.longValue(), position)
        : ndf.formatBigInteger(bigInteger, position);
    buffer.append(chars);
    return buffer;
  } else if (number instanceof BigDecimal) {
    buffer.append(ndf.formatBigDecimal((BigDecimal) number, position));
    return buffer;
  }
  return super.format(number, buffer, position);
}
origin: robovm/robovm

char[] chars;
if (arg instanceof BigDecimal) {
  chars = nf.formatBigDecimal((BigDecimal) arg, null);
} else {
  chars = nf.formatDouble(((Number) arg).doubleValue(), null);
origin: robovm/robovm

/**
 * Changes the pattern of this decimal format to the specified pattern which
 * uses non-localized pattern characters.
 *
 * @param pattern
 *            the non-localized pattern.
 * @throws IllegalArgumentException
 *            if the pattern cannot be parsed.
 */
public void applyPattern(String pattern) {
  ndf.applyPattern(pattern);
}
origin: robovm/robovm

public synchronized void close() {
  if (address != 0) {
    close(address);
    address = 0;
  }
}
origin: robovm/robovm

private static void applyPattern(long addr, boolean localized, String pattern) {
  try {
    applyPatternImpl(addr, localized, pattern);
  } catch (NullPointerException npe) {
    throw npe;
  } catch (RuntimeException re) {
    throw new IllegalArgumentException("syntax error: " + re.getMessage() + ": " + pattern);
  }
}
origin: robovm/robovm

/**
 * Returns a new instance of {@code DecimalFormat} with the same pattern and
 * properties.
 */
@Override
public Object clone() {
  DecimalFormat clone = (DecimalFormat) super.clone();
  clone.ndf = (NativeDecimalFormat) ndf.clone();
  clone.symbols = (DecimalFormatSymbols) symbols.clone();
  return clone;
}
origin: robovm/robovm

@Override public Object clone() {
  try {
    NativeDecimalFormat clone = (NativeDecimalFormat) super.clone();
    clone.address = cloneImpl(address);
    clone.lastPattern = lastPattern;
    clone.negPrefNull = negPrefNull;
    clone.negSuffNull = negSuffNull;
    clone.posPrefNull = posPrefNull;
    clone.posSuffNull = posSuffNull;
    return clone;
  } catch (CloneNotSupportedException unexpected) {
    throw new AssertionError(unexpected);
  }
}
origin: robovm/robovm

/**
 * Compares the specified object to this decimal format and indicates if
 * they are equal. In order to be equal, {@code object} must be an instance
 * of {@code DecimalFormat} with the same pattern and properties.
 *
 * @param object
 *            the object to compare with this object.
 * @return {@code true} if the specified object is equal to this decimal
 *         format; {@code false} otherwise.
 * @see #hashCode
 */
@Override
public boolean equals(Object object) {
  if (this == object) {
    return true;
  }
  if (!(object instanceof DecimalFormat)) {
    return false;
  }
  DecimalFormat other = (DecimalFormat) object;
  return (this.ndf == null ? other.ndf == null : this.ndf.equals(other.ndf)) &&
      getDecimalFormatSymbols().equals(other.getDecimalFormatSymbols());
}
origin: MobiVM/robovm

@Override
public final StringBuffer format(Object number, StringBuffer buffer, FieldPosition position) {
  checkBufferAndFieldPosition(buffer, position);
  if (number instanceof BigInteger) {
    BigInteger bigInteger = (BigInteger) number;
    char[] chars = (bigInteger.bitLength() < 64)
        ? ndf.formatLong(bigInteger.longValue(), position)
        : ndf.formatBigInteger(bigInteger, position);
    buffer.append(chars);
    return buffer;
  } else if (number instanceof BigDecimal) {
    buffer.append(ndf.formatBigDecimal((BigDecimal) number, position));
    return buffer;
  }
  return super.format(number, buffer, position);
}
origin: robovm/robovm

  result.append(nf.formatBigDecimal((BigDecimal) arg, null));
} else {
  result.append(nf.formatDouble(((Number) arg).doubleValue(), null));
origin: robovm/robovm

public void applyLocalizedPattern(String pattern) {
  applyPattern(this.address, true, pattern);
  lastPattern = null;
}
origin: robovm/robovm

@Override protected void finalize() throws Throwable {
  try {
    close();
  } finally {
    super.finalize();
  }
}
origin: MobiVM/robovm

private static void applyPattern(long addr, boolean localized, String pattern) {
  try {
    applyPatternImpl(addr, localized, pattern);
  } catch (NullPointerException npe) {
    throw npe;
  } catch (RuntimeException re) {
    throw new IllegalArgumentException("syntax error: " + re.getMessage() + ": " + pattern);
  }
}
origin: MobiVM/robovm

/**
 * Returns a new instance of {@code DecimalFormat} with the same pattern and
 * properties.
 */
@Override
public Object clone() {
  DecimalFormat clone = (DecimalFormat) super.clone();
  clone.ndf = (NativeDecimalFormat) ndf.clone();
  clone.symbols = (DecimalFormatSymbols) symbols.clone();
  return clone;
}
origin: MobiVM/robovm

@Override public Object clone() {
  try {
    NativeDecimalFormat clone = (NativeDecimalFormat) super.clone();
    clone.address = cloneImpl(address);
    clone.lastPattern = lastPattern;
    clone.negPrefNull = negPrefNull;
    clone.negSuffNull = negSuffNull;
    clone.posPrefNull = posPrefNull;
    clone.posSuffNull = posSuffNull;
    return clone;
  } catch (CloneNotSupportedException unexpected) {
    throw new AssertionError(unexpected);
  }
}
origin: MobiVM/robovm

/**
 * Compares the specified object to this decimal format and indicates if
 * they are equal. In order to be equal, {@code object} must be an instance
 * of {@code DecimalFormat} with the same pattern and properties.
 *
 * @param object
 *            the object to compare with this object.
 * @return {@code true} if the specified object is equal to this decimal
 *         format; {@code false} otherwise.
 * @see #hashCode
 */
@Override
public boolean equals(Object object) {
  if (this == object) {
    return true;
  }
  if (!(object instanceof DecimalFormat)) {
    return false;
  }
  DecimalFormat other = (DecimalFormat) object;
  return (this.ndf == null ? other.ndf == null : this.ndf.equals(other.ndf)) &&
      getDecimalFormatSymbols().equals(other.getDecimalFormatSymbols());
}
origin: ibinti/bugvm

private void initNative(String pattern) {
  try {
    this.ndf = new NativeDecimalFormat(pattern, symbols);
  } catch (IllegalArgumentException ex) {
    throw new IllegalArgumentException(pattern);
  }
  super.setMaximumFractionDigits(ndf.getMaximumFractionDigits());
  super.setMaximumIntegerDigits(ndf.getMaximumIntegerDigits());
  super.setMinimumFractionDigits(ndf.getMinimumFractionDigits());
  super.setMinimumIntegerDigits(ndf.getMinimumIntegerDigits());
}
libcore.icuNativeDecimalFormat

Most used methods

  • <init>
  • applyLocalizedPattern
  • applyPattern
  • applyPatternImpl
  • clone
  • cloneImpl
  • close
  • equals
    Note: this doesn't check that the underlying native DecimalFormat objects' configured native Decimal
  • formatBigDecimal
  • formatBigInteger
  • formatDigitList
  • formatDouble
  • formatDigitList,
  • formatDouble,
  • formatLong,
  • formatToCharacterIterator,
  • getAttribute,
  • getGroupingSize,
  • getMaximumFractionDigits,
  • getMaximumIntegerDigits,
  • getMinimumFractionDigits,
  • getMinimumIntegerDigits

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • putExtra (Intent)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now