org.bitcoinj.utils.BtcAutoFormat.Style Java Examples

The following examples show how to use org.bitcoinj.utils.BtcAutoFormat.Style. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BtcFormat.java    From bcm-android with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Specify the new {@code BtcFormat} is to be automatically-denominating.
 * The argument determines which of either codes or symbols the new {@code BtcFormat}
 * will use by default to indicate the denominations it chooses when formatting values.
 * <p>
 * <p>Note that the {@code Style} argument specifies the
 * <em>default</em> style, which is overridden by invoking
 * either {@link #pattern(String)} or {@link #localizedPattern(String)}.
 *
 * @throws IllegalArgumentException if {@link #scale(int)} has
 *                                  previously been invoked on this instance.
 */
public Builder style(BtcAutoFormat.Style val) {
    if (variant == Variant.FIXED)
        throw new IllegalStateException("You cannot invoke both style() and scale()");
    variant = Variant.AUTO;
    style = val;
    return this;
}
 
Example #2
Source File: BtcFormat.java    From green_android with GNU General Public License v3.0 3 votes vote down vote up
/** Specify the new <code>BtcFormat</code> is to be automatically-denominating.
 * The argument determines which of either codes or symbols the new <code>BtcFormat</code>
 * will use by default to indicate the denominations it chooses when formatting values.
 *
 * <p>Note that the <code>Style</code> argument specifies the
 * <em>default</em> style, which is overridden by invoking
 * either {@link #pattern(String)} or {@link #localizedPattern(String)}.
 *
 * @throws IllegalArgumentException if {@link #scale(int)} has
 *         previously been invoked on this instance.*/
public Builder style(BtcAutoFormat.Style val) {
    if (variant == Variant.FIXED)
        throw new IllegalStateException("You cannot invoke both style() and scale()");
    variant = Variant.AUTO;
    style = val;
    return this;
}
 
Example #3
Source File: BtcFormat.java    From GreenBits with GNU General Public License v3.0 3 votes vote down vote up
/** Specify the new <code>BtcFormat</code> is to be automatically-denominating.
 * The argument determines which of either codes or symbols the new <code>BtcFormat</code>
 * will use by default to indicate the denominations it chooses when formatting values.
 *
 * <p>Note that the <code>Style</code> argument specifies the
 * <em>default</em> style, which is overridden by invoking
 * either {@link #pattern(String)} or {@link #localizedPattern(String)}.
 *
 * @throws IllegalArgumentException if {@link #scale(int)} has
 *         previously been invoked on this instance.*/
public Builder style(BtcAutoFormat.Style val) {
    if (variant == Variant.FIXED)
        throw new IllegalStateException("You cannot invoke both style() and scale()");
    variant = Variant.AUTO;
    style = val;
    return this;
}
 
Example #4
Source File: BtcFormat.java    From bcm-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 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 "฿"}, or code, such as {@code "mBTC"}, 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());
}
 
Example #5
Source File: BtcFormat.java    From bcm-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Return a new auto-denominating formatter with the given number of fractional decimal
 * places.  The returned object will indicate the denominational units of formatted values
 * using either a currency symbol, such as, {@code "฿"}, or code, such as
 * {@code "mBTC"}, depending on the value of the first argument.  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 getInstance(Style style, int fractionPlaces) {
    return getInstance(style, defaultLocale(), fractionPlaces);
}
 
Example #6
Source File: BtcFormat.java    From bcm-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Return a new auto-formatter with the given style for the given locale.
 * The returned object that will auto-denominate each formatted value, and
 * will indicate that denomination using either a currency code, such as
 * {@code "BTC"}, or symbol, such as {@code "฿"}, depending on the value
 * of the first argument.
 * <p>The number of fractional decimal places in formatted number will be two, or fewer
 * as necessary to avoid giving a place to fractional satoshis.
 */
public static BtcFormat getInstance(Style style, Locale locale) {
    return getInstance(style, locale, 2);
}
 
Example #7
Source File: BtcFormat.java    From bcm-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Return a new auto-formatter for the given locale with the given number of fraction places.
 * The returned object will automatically-denominate each formatted
 * value, and will indicate that denomination using either a currency code,
 * such as {@code "mBTC"}, or symbol, such as {@code "฿"},
 * according to the given style argument.  It will format each number
 * according to the given locale.
 * <p>
 * <p>The third parameter is the number of fractional decimal places to use for each
 * formatted number, reduced as neccesary when formatting to avoid giving a place to
 * fractional satoshis.
 */
public static BtcFormat getInstance(Style style, Locale locale, int fractionPlaces) {
    return new BtcAutoFormat(locale, style, fractionPlaces);
}
 
Example #8
Source File: BtcFormat.java    From green_android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 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()); }
 
Example #9
Source File: BtcFormat.java    From green_android with GNU General Public License v3.0 2 votes vote down vote up
/**
    * Return a new auto-denominating formatter with the given number of fractional decimal
    * places.  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 first argument.  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 getInstance(Style style, int fractionPlaces) {
return getInstance(style, defaultLocale(), fractionPlaces);
   }
 
Example #10
Source File: BtcFormat.java    From green_android with GNU General Public License v3.0 2 votes vote down vote up
/**
    * Return a new auto-formatter with the given style for the given locale.
    * The returned object that will auto-denominate each formatted value, and
    * will indicate that denomination using either a currency code, such as
    * "<code>BTC</code>", or symbol, such as "<code>฿</code>", depending on the value
    * of the first argument. 
    * <p>The number of fractional decimal places in formatted number will be two, or fewer
    * as necessary to avoid giving a place to fractional satoshis.
    */
   public static BtcFormat getInstance(Style style, Locale locale) {
return getInstance(style, locale, 2);
   }
 
Example #11
Source File: BtcFormat.java    From green_android with GNU General Public License v3.0 2 votes vote down vote up
/**
    * Return a new auto-formatter for the given locale with the given number of fraction places.
    * The returned object will automatically-denominate each formatted
    * value, and will indicate that denomination using either a currency code,
    * such as <code>"mBTC"</code>, or symbol, such as "<code>฿</code>",
    * according to the given style argument.  It will format each number
    * according to the given locale.
    *
    * <p>The third parameter is the number of fractional decimal places to use for each
    * formatted number, reduced as neccesary when formatting to avoid giving a place to
    * fractional satoshis.
    */
   public static BtcFormat getInstance(Style style, Locale locale, int fractionPlaces) {
return new BtcAutoFormat(locale, style, fractionPlaces);
   }
 
Example #12
Source File: BtcFormat.java    From GreenBits with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 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()); }
 
Example #13
Source File: BtcFormat.java    From GreenBits with GNU General Public License v3.0 2 votes vote down vote up
/**
    * Return a new auto-denominating formatter with the given number of fractional decimal
    * places.  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 first argument.  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 getInstance(Style style, int fractionPlaces) {
return getInstance(style, defaultLocale(), fractionPlaces);
   }
 
Example #14
Source File: BtcFormat.java    From GreenBits with GNU General Public License v3.0 2 votes vote down vote up
/**
    * Return a new auto-formatter with the given style for the given locale.
    * The returned object that will auto-denominate each formatted value, and
    * will indicate that denomination using either a currency code, such as
    * "<code>BTC</code>", or symbol, such as "<code>฿</code>", depending on the value
    * of the first argument. 
    * <p>The number of fractional decimal places in formatted number will be two, or fewer
    * as necessary to avoid giving a place to fractional satoshis.
    */
   public static BtcFormat getInstance(Style style, Locale locale) {
return getInstance(style, locale, 2);
   }
 
Example #15
Source File: BtcFormat.java    From GreenBits with GNU General Public License v3.0 2 votes vote down vote up
/**
    * Return a new auto-formatter for the given locale with the given number of fraction places.
    * The returned object will automatically-denominate each formatted
    * value, and will indicate that denomination using either a currency code,
    * such as <code>"mBTC"</code>, or symbol, such as "<code>฿</code>",
    * according to the given style argument.  It will format each number
    * according to the given locale.
    *
    * <p>The third parameter is the number of fractional decimal places to use for each
    * formatted number, reduced as neccesary when formatting to avoid giving a place to
    * fractional satoshis.
    */
   public static BtcFormat getInstance(Style style, Locale locale, int fractionPlaces) {
return new BtcAutoFormat(locale, style, fractionPlaces);
   }