/** * Parse a human readable fiat value to a {@link org.bitcoinj.utils.Fiat} instance. * * @throws NumberFormatException * if the string cannot be parsed for some reason */ public Fiat parseFiat(String currencyCode, String str) throws NumberFormatException { return Fiat.valueOf(currencyCode, parseValue(str, Fiat.SMALLEST_UNIT_EXPONENT)); }
/** * Removes the given event listener object. Returns true if the listener was removed, false if that listener * was never added. */ public boolean removeEventListener(ConnectionEventListener listener) { return ListenerRegistration.removeFromList(listener, eventListeners); }
/** * Return a new symbol-style auto-formatter with the given number of fractional decimal * places. Denominational units will be indicated using a currency symbol, for example, * <code>"฿"</code>. The returned object will format the fraction-part of numbers using * the given number of decimal places, or fewer as necessary to avoid giving a place to * fractional satoshis. Formatting and parsing will be done according to the default * locale. */ public static BtcFormat getSymbolInstance(int fractionPlaces) { return getSymbolInstance(defaultLocale(), fractionPlaces); }
/** * Return a new code-style auto-formatter with the given number of fractional decimal * places. Denominational units will be indicated using a currency code, for example, * <code>"BTC"</code>. The returned object will format the fraction-part of numbers using * the given number of decimal places, or fewer as necessary to avoid giving a place to * fractional satoshis. Formatting and parsing will be done according to the default * locale. */ public static BtcFormat getCodeInstance(int minDecimals) { return getCodeInstance(defaultLocale(), minDecimals); }
/** * Return a new auto-denominating formatter. The returned object will indicate the * denominational units of formatted values using either a currency symbol, such as, * <code>"฿"</code>, or code, such as <code>"mBTC"</code>, depending on the value of * the argument. Formatting and parsing will be done according to the default locale. */ public static BtcFormat getInstance(Style style) { return getInstance(style, defaultLocale()); }
/** * Return a new millicoin-denominated formatter. The returned object will format and * parse values for the default locale, and will format the fractional part of numbers with * two decimal places, rounding as necessary. */ public static BtcFormat getMilliInstance() { return getMilliInstance(defaultLocale()); }
/** * Return a new code-style auto-formatter for the given locale with the given number of * fraction places. The returned object will select denominational units based on each * value being formatted, and will indicate those units using a currency code, for example, * <code>"mBTC"</code>. The returned object will format the fraction-part of numbers using * the given number of decimal places, or fewer as necessary to avoid giving a place to * fractional satoshis. */ public static BtcFormat getCodeInstance(Locale locale, int minDecimals) { return getInstance(CODE, locale, minDecimals); }
/** Specify the number of decimal places in the fraction part of formatted numbers. * This is equivalent to the {@link #minimumFractionDigits(int)} method, but named * appropriately for the context of generating {@link BtcAutoFormat} instances. * * <p>If neither this method nor <code>minimumFactionDigits()</code> is invoked, the default value * will be <code>2</code>. */ public Builder fractionDigits(int val) { return minimumFractionDigits(val); }
/** * Parse a <code>String</code> representation of a Bitcoin monetary value. Returns a * {@link org.bitcoinj.core.Coin} object that represents the parsed value. * @see java.text.NumberFormat */ @Override public final Object parseObject(String source, ParsePosition pos) { return parse(source, pos); }
/** * Returns true if and only if this instance represents a monetary value greater than zero, otherwise false. */ public boolean isPositive() { return signum() == 1; }
/** * Returns true if the monetary value represented by this instance is less than that of the given other Fiat, * otherwise false. */ public boolean isLessThan(Fiat other) { return compareTo(other) < 0; }
/** * Postfix formatted output with currency code. This configuration is not relevant for parsing. */ public MonetaryFormat postfixCode() { if (!codePrefixed) return this; else return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups, shift, roundingMode, codes, codeSeparator, false); }
/** * Parse a human readable fiat value to a {@link org.bitcoinj.utils.Fiat} instance. * * @throws NumberFormatException * if the string cannot be parsed for some reason */ public Fiat parseFiat(String currencyCode, String str) throws NumberFormatException { return Fiat.valueOf(currencyCode, parseValue(str, Fiat.SMALLEST_UNIT_EXPONENT)); }
/** * Return a new coin-denominated formatter for the given locale. The returned object will * format the fractional part of numbers with two decimal places, rounding as necessary. */ public static BtcFormat getCoinInstance(Locale locale) { return getInstance(COIN_SCALE, locale, 2); }
/** * Removes the given event listener object. Returns true if the listener was removed, false if that listener * was never added. */ public boolean removeCoinsReceivedEventListener(WalletCoinsReceivedEventListener listener) { return ListenerRegistration.removeFromList(listener, coinsReceivedListeners); }
/** * Parse a human readable fiat value to a {@link org.bitcoinj.utils.Fiat} instance. * * @throws NumberFormatException * if the string cannot be parsed for some reason */ public Fiat parseFiat(String currencyCode, String str) throws NumberFormatException { return Fiat.valueOf(currencyCode, parseValue(str, Fiat.SMALLEST_UNIT_EXPONENT)); }
/** * Return a new fixeed-denomination formatter for the given locale. The first argument * specifies the denomination as the size of the shift from coin-denomination in * increasingly-precise decimal places. The returned object will format and parse values * according to the locale specified by the second argument, and will format the fractional * part of numbers with two decimal places, or fewer as necessary to avoid giving a place * to fractional satoshis. */ public static BtcFormat getInstance(int scale, Locale locale) { return getInstance(scale, locale, 2); }
/** * Removes the given event listener object. Returns true if the listener was removed, false if that listener * was never added. */ public boolean removeReorganizeEventListener(WalletReorganizeEventListener listener) { return ListenerRegistration.removeFromList(listener, reorganizeListeners); }
/** * Parse a human readable fiat value to a {@link org.bitcoinj.utils.Fiat} instance. * * @throws NumberFormatException * if the string cannot be parsed for some reason */ public Fiat parseFiat(String currencyCode, String str) throws NumberFormatException { return Fiat.valueOf(currencyCode, parseValue(str, Fiat.SMALLEST_UNIT_EXPONENT)); }
/** * Removes the given event listener object. Returns true if the listener was removed, false if that listener * was never added. */ public boolean removeScriptChangeEventListener(ScriptsChangeEventListener listener) { return ListenerRegistration.removeFromList(listener, scriptChangeListeners); }