APIdia Launch Partner
Top Inners Fields Constructors Methods
io.github.spannm.jackcess.impl.expr

public Class NumberFormatter

extends Object
Class Inheritance
Imports
java.math.BigDecimal, .MathContext, .RoundingMode, java.text.DecimalFormat, .DecimalFormatSymbols, .FieldPosition, .NumberFormat, .ParsePosition

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
NumberFormatter.NotationType

designates the format of exponent notation used by ScientificFormat

public static class
private static class

Field Summary

Modifier and TypeField and Description
public static final MathContext
private static final int
private final NumberFormatter.TypeFormatter
public static final MathContext
private static final int
private final NumberFormatter.TypeFormatter
public static final MathContext
private static final int
private final NumberFormatter.TypeFormatter
private static final String
private static final String
private static final String
public static final RoundingMode

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
format(float f)

public String
format(double d)

public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DBL_MATH_CONTEXTback to summary
public static final MathContext DBL_MATH_CONTEXT
DBL_SIG_DIGITSback to summary
private static final int DBL_SIG_DIGITS
dblFmtback to summary
private final NumberFormatter.TypeFormatter dblFmt
DEC_MATH_CONTEXTback to summary
public static final MathContext DEC_MATH_CONTEXT
DEC_SIG_DIGITSback to summary
private static final int DEC_SIG_DIGITS
decFmtback to summary
private final NumberFormatter.TypeFormatter decFmt
FLT_MATH_CONTEXTback to summary
public static final MathContext FLT_MATH_CONTEXT
FLT_SIG_DIGITSback to summary
private static final int FLT_SIG_DIGITS
fltFmtback to summary
private final NumberFormatter.TypeFormatter fltFmt
NAN_STRback to summary
private static final String NAN_STR
NEG_INF_STRback to summary
private static final String NEG_INF_STR
POS_INF_STRback to summary
private static final String POS_INF_STR
ROUND_MODEback to summary
public static final RoundingMode ROUND_MODE

Constructor Detail

NumberFormatterback to summary
public NumberFormatter(DecimalFormatSymbols syms)

Method Detail

formatback to summary
public String format(float f)
Annotations
@SuppressWarnings:PMD.AvoidDecimalLiteralsInBigDecimalConstructor
formatback to summary
public String format(double d)
Annotations
@SuppressWarnings:PMD.AvoidDecimalLiteralsInBigDecimalConstructor
formatback to summary
public String format(BigDecimal bd)
io.github.spannm.jackcess.impl.expr back to summary

public sealed Enum NumberFormatter.NotationType

extends Enum<NumberFormatter.NotationType>
Class Inheritance

designates the format of exponent notation used by ScientificFormat

Field Summary

Modifier and TypeField and Description
public static final NumberFormatter.NotationType
EXP_E_MINUS

Scientific notation "E", "E-" (default java behavior)

public static final NumberFormatter.NotationType
EXP_e_MINUS

Scientific notation "e", "e-"

public static final NumberFormatter.NotationType
EXP_E_PLUS

Scientific notation "E+", "E-"

public static final NumberFormatter.NotationType
EXP_e_PLUS

Scientific notation "e+", "e-"

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected abstract void
format(StringBuffer sb, int idx)

private static void
public static NumberFormatter.NotationType
public static NumberFormatter.NotationType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

EXP_E_MINUSback to summary
public static final NumberFormatter.NotationType EXP_E_MINUS

Scientific notation "E", "E-" (default java behavior)

EXP_e_MINUSback to summary
public static final NumberFormatter.NotationType EXP_e_MINUS

Scientific notation "e", "e-"

EXP_E_PLUSback to summary
public static final NumberFormatter.NotationType EXP_E_PLUS

Scientific notation "E+", "E-"

EXP_e_PLUSback to summary
public static final NumberFormatter.NotationType EXP_e_PLUS

Scientific notation "e+", "e-"

Constructor Detail

NotationTypeback to summary
private NotationType()

Method Detail

formatback to summary
protected abstract void format(StringBuffer sb, int idx)
maybeInsertExpPlusback to summary
private static void maybeInsertExpPlus(StringBuffer sb, int eIdx)
valueOfback to summary
public static NumberFormatter.NotationType valueOf(String name)
valuesback to summary
public static NumberFormatter.NotationType[] values()
io.github.spannm.jackcess.impl.expr back to summary

public Class NumberFormatter.ScientificFormat

extends NumberFormat
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final NumberFormat
private static final long
private final NumberFormatter.NotationType
Inherited from java.text.NumberFormat:
FRACTION_FIELDINTEGER_FIELD

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public StringBuffer
format(Object number, StringBuffer toAppendTo, FieldPosition pos)

Overrides java.text.NumberFormat.format.

Formats a number and appends the resulting text to the given string buffer.

public StringBuffer
format(double number, StringBuffer toAppendTo, FieldPosition pos)

Implements abstract java.text.NumberFormat.format.

Specialization of format.

public StringBuffer
format(long number, StringBuffer toAppendTo, FieldPosition pos)

Implements abstract java.text.NumberFormat.format.

Specialization of format.

public int
getMaximumFractionDigits()

Overrides java.text.NumberFormat.getMaximumFractionDigits.

Returns the maximum number of digits allowed in the fraction portion of a number during formatting.

public int
getMinimumFractionDigits()

Overrides java.text.NumberFormat.getMinimumFractionDigits.

Returns the minimum number of digits allowed in the fraction portion of a number during formatting.

public Number
parse(String source, ParsePosition parsePosition)

Implements abstract java.text.NumberFormat.parse.

Parses text from the beginning of the given string to produce a Number.

Inherited from java.text.NumberFormat:
cloneequalsformatformatgetAvailableLocalesgetCompactNumberInstancegetCompactNumberInstancegetCurrencygetCurrencyInstancegetCurrencyInstancegetInstancegetInstancegetIntegerInstancegetIntegerInstancegetMaximumIntegerDigitsgetMinimumIntegerDigitsgetNumberInstancegetNumberInstancegetPercentInstancegetPercentInstancegetRoundingModehashCodeisGroupingUsedisParseIntegerOnlyisStrictparseparseObjectsetCurrencysetGroupingUsedsetMaximumFractionDigitssetMaximumIntegerDigitssetMinimumFractionDigitssetMinimumIntegerDigitssetParseIntegerOnlysetRoundingModesetStrict

Field Detail

dfback to summary
private final NumberFormat df
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.text.NumberFormat.serialVersionUID.

typeback to summary
private final NumberFormatter.NotationType type

Constructor Detail

ScientificFormatback to summary
public ScientificFormat(NumberFormat df)
ScientificFormatback to summary
public ScientificFormat(NumberFormat df, NumberFormatter.NotationType type)

Method Detail

formatback to summary
public StringBuffer format(Object number, StringBuffer toAppendTo, FieldPosition pos)

Overrides java.text.NumberFormat.format.

Doc from java.text.NumberFormat.format.

Formats a number and appends the resulting text to the given string buffer. The number can be of any subclass of java.lang.Number.

This implementation extracts the number's value using java.lang.Number#longValue() for all integral type values that can be converted to long without loss of information, including BigInteger values with a bit length of less than 64, and java.lang.Number#doubleValue() for all other types. It then calls format(long, java.lang.StringBuffer, java.text.FieldPosition) or format(double, java.lang.StringBuffer, java.text.FieldPosition). This may result in loss of magnitude information and precision for BigInteger and BigDecimal values.

Annotations
@Override
formatback to summary
public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)

Implements abstract java.text.NumberFormat.format.

Doc from java.text.NumberFormat.format.

Specialization of format.

Annotations
@Override
formatback to summary
public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)

Implements abstract java.text.NumberFormat.format.

Doc from java.text.NumberFormat.format.

Specialization of format.

Annotations
@Override
getMaximumFractionDigitsback to summary
public int getMaximumFractionDigits()

Overrides java.text.NumberFormat.getMaximumFractionDigits.

Doc from java.text.NumberFormat.getMaximumFractionDigits.

Returns the maximum number of digits allowed in the fraction portion of a number during formatting.

Annotations
@Override
getMinimumFractionDigitsback to summary
public int getMinimumFractionDigits()

Overrides java.text.NumberFormat.getMinimumFractionDigits.

Doc from java.text.NumberFormat.getMinimumFractionDigits.

Returns the minimum number of digits allowed in the fraction portion of a number during formatting.

Annotations
@Override
parseback to summary
public Number parse(String source, ParsePosition parsePosition)

Implements abstract java.text.NumberFormat.parse.

Doc from java.text.NumberFormat.parse.

Parses text from the beginning of the given string to produce a Number.

This method attempts to parse text starting at the index given by the ParsePosition. If parsing succeeds, then the index of the ParsePosition is updated to the index after the last character used (parsing does not necessarily use all characters up to the end of the string), and the parsed number is returned. The updated ParsePosition can be used to indicate the starting point for the next call to this method. If an error occurs, then the index of the ParsePosition is not changed, the error index of the ParsePosition is set to the index of the character where the error occurred, and null is returned.

This method will return a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals), otherwise a Double.

Annotations
@Override
io.github.spannm.jackcess.impl.expr back to summary

private final Class NumberFormatter.TypeFormatter

extends Object
Class Inheritance
  • java.lang.Object
  • io.github.spannm.jackcess.impl.expr.NumberFormatter.TypeFormatter

Field Summary

Modifier and TypeField and Description
private final DecimalFormat
private final NumberFormatter.ScientificFormat
private final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static NumberFormatter.ScientificFormat
public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dfback to summary
private final DecimalFormat df
dfSback to summary
private final NumberFormatter.ScientificFormat dfS
precback to summary
private final int prec

Constructor Detail

TypeFormatterback to summary
private TypeFormatter(int prec, DecimalFormatSymbols syms)

Method Detail

createScientificFormatback to summary
private static NumberFormatter.ScientificFormat createScientificFormat(int prec, DecimalFormatSymbols syms)
formatback to summary
public String format(BigDecimal bd)