public final class BtcFixedFormat extends BtcFormat
This class, a concrete extension of BtcFormat
, is distinguished in that each
instance formats and by-default parses all Bitcoin monetary values in units of a single
denomination that is specified at the time that instance is constructed.
By default, neither currency codes nor symbols are included in formatted values as
output, nor recognized in parsed values as input. The can be overridden by applying a
custom pattern using either the BtcFormat.Builder.localizedPattern
or BtcFormat.Builder#localizedPattern()
methods, as described in the documentation for the BtcFormat.Builder
class.
Format
,
NumberFormat
,
DecimalFormat
,
Coin
,
Serialized FormBtcFormat.Builder
Format.Field
Modifier and Type | Field and Description |
---|---|
static int[] |
REPEATING_DOUBLETS
A constant specifying the use of as many optional groups of two
decimal places in the fraction part of a formatted number as are useful for expressing
precision.
|
static int[] |
REPEATING_PLACES
A constant specifying the use of as many optional decimal places in the fraction part
of a formatted number as are useful for expressing precision.
|
static int[] |
REPEATING_TRIPLETS
A constant specifying the use of as many optional groups of three
decimal places in the fraction part of a formatted number as are useful for expressing
precision.
|
COIN_SCALE, COIN_SYMBOL_ALT, decimalGroups, MICROCOIN_SCALE, MILLICOIN_SCALE, minimumFractionDigits, numberFormat
Modifier | Constructor and Description |
---|---|
protected |
BtcFixedFormat(Locale locale,
int scale,
int minDecimals,
List<Integer> groups)
Constructor
|
Modifier and Type | Method and Description |
---|---|
String |
code()
Return the currency code that identifies the units in which values formatted and
(by-default) parsed by this instance are denominated.
|
boolean |
equals(Object o)
Return true if the given object is equivalent to this one.
|
int[] |
fractionPlaceGroups()
Return the fractional decimal-placing used when formatting.
|
int |
hashCode()
Return a hash code value for this instance.
|
int |
scale()
Return the decimal-place shift for this object's fixed unit-denomination.
|
protected int |
scale(BigInteger satoshis,
int fractionPlaces)
Return the decimal-place shift for this object's unit-denomination.
|
String |
symbol()
Return the currency symbol that identifies the units in which values formatted by this
instance are denominated.
|
String |
toString()
Returns a brief description of this formatter.
|
builder, coinCode, coinSymbol, format, format, format, formatToCharacterIterator, getAvailableLocales, getCodeInstance, getCodeInstance, getCodeInstance, getCodeInstance, getCoinInstance, getCoinInstance, getCoinInstance, getCoinInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getMicroInstance, getMicroInstance, getMicroInstance, getMicroInstance, getMilliInstance, getMilliInstance, getMilliInstance, getMilliInstance, getSymbolInstance, getSymbolInstance, getSymbolInstance, getSymbolInstance, negify, parse, parse, parseObject, pattern, prefixCode, prefixSymbol, prefixUnitsIndicator, symbols
clone, format, parseObject
public static final int[] REPEATING_PLACES
BtcFormat.format(Object, int, int...)
.public static final int[] REPEATING_DOUBLETS
BtcFormat.format(Object, int, int...)
.public static final int[] REPEATING_TRIPLETS
BtcFormat.format(Object, int, int...)
.protected int scale(BigInteger satoshis, int fractionPlaces)
3
. As
a side-effect, prefixes the currency signs of the underlying NumberFormat object. This
method is invoked by the superclass when formatting. The arguments are ignored because
the denomination is fixed regardless of the value being formatted.scale
in class BtcFormat
satoshis
- The number of satoshis having the value for which the shift is calculatedfractionPlaces
- The number of decimal places available for displaying the
fractional part of the denominated valuepublic int scale()
3
.public String code()
"mBTC"
,
assuming the default base currency-code is not overridden using a
BtcFormat.Builder
.public String symbol()
"₥฿"
, depending on the
locale.public int[] fractionPlaceGroups()
int
array. The value of the first element is the minimum number of
decimal places to be used in all cases, limited to a precision of satoshis. The value
of each successive element is the size of an optional place-group that will be applied,
possibly partially, if useful for expressing precision. The actual size of each group
is limited to, and may be reduced to the limit of, a precision of no smaller than
satoshis.public boolean equals(Object o)
public int hashCode()
hashCode
in class BtcFormat
Object.hashCode()
public String toString()
Copyright © 2014. All rights reserved.