Top Description Fields Constructors Methods
tech.units.indriya.format

pack-priv Class ConverterFormatter

extends Object
Class Inheritance
Annotations
@API
status:INTERNAL
Static Imports
java.lang.StrictMath.E, org.apiguardian.api.API.Status.INTERNAL, tech.units.indriya.format.FormatConstants.ADDITION_PRECEDENCE, .FormatConstants.EXPONENT_PRECEDENCE, .FormatConstants.MIDDLE_DOT, .FormatConstants.NOOP_PRECEDENCE, .FormatConstants.PRODUCT_PRECEDENCE

Helper class that handles internals of formatting UnitConverter instances.
Authors
otaviojava, keilw

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static int
additionPrecedence(AddConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer)

private static int
exponentPrecedenceExpConveter(ExpConverter converter, int unitPrecedence, StringBuilder buffer)

private static int
pack-priv static int

Returns:

the operator precedence of the given UnitConverter
formatConverter
(UnitConverter
the converter to be formatted
converter
,
boolean
true if the converter expression should begin with an operator, otherwise false.
continued
,
int
the operator precedence of the operation expressed by the unit being modified by the given converter.
unitPrecedence
,
StringBuilder
the StringBuffer to append to.
buffer
,
final SymbolMap symbolMap)

Formats the given converter to the given StringBuilder and returns the operator precedence of the converter's mathematical operation.

pack-priv static int

Returns:

the operator precedence of the given UnitConverter
formatConverterLocal
(UnitConverter
the converter to be formatted
converter
,
boolean
true if the converter expression should begin with an operator, otherwise false.
continued
,
int
the operator precedence of the operation expressed by the unit being modified by the given converter.
unitPrecedence
,
StringBuilder
the StringBuffer to append to.
buffer
,
final SymbolMap symbolMap)

Formats the given converter to the given StringBuffer and returns the operator precedence of the converter's mathematical operation.

private static int

Returns:

the given operator precedence
formatFormattable
(Formattable
the formattable to be formatted
f
,
int
the operator precedence of the operation expressed by the unit being modified by the given converter.
unitPrecedence
,
StringBuilder
the StringBuffer to append to.
buffer
)

Formats the given Formattable to the given StringBuffer and returns the given precedence of the converter's mathematical operation.

private static int
noopPrecedence(StringBuilder buffer, SymbolMap symbolMap, Prefix prefix)

private static int
productPrecedence(PowerOfIntConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer)

private static int
productPrecedence(MultiplyConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOCAL_FORMAT_PATTERNback to summary
private static final String LOCAL_FORMAT_PATTERN

Constructor Detail

ConverterFormatterback to summary
pack-priv ConverterFormatter()

Method Detail

additionPrecedenceback to summary
private static int additionPrecedence(AddConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer)
exponentPrecedenceExpConveterback to summary
private static int exponentPrecedenceExpConveter(ExpConverter converter, int unitPrecedence, StringBuilder buffer)
exponentPrecedenceLogConveterback to summary
private static int exponentPrecedenceLogConveter(LogConverter converter, StringBuilder buffer)
formatConverterback to summary
pack-priv static int formatConverter(UnitConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer, final SymbolMap symbolMap)

Formats the given converter to the given StringBuilder and returns the operator precedence of the converter's mathematical operation. This is the default implementation, which supports all built-in UnitConverter implementations. Note that it recursively calls itself in the case of a pair converter.

Parameters
converter:UnitConverter

the converter to be formatted

continued:boolean

true if the converter expression should begin with an operator, otherwise false.

unitPrecedence:int

the operator precedence of the operation expressed by the unit being modified by the given converter.

buffer:StringBuilder

the StringBuffer to append to.

Returns:int

the operator precedence of the given UnitConverter

formatConverterLocalback to summary
pack-priv static int formatConverterLocal(UnitConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer, final SymbolMap symbolMap)

Formats the given converter to the given StringBuffer and returns the operator precedence of the converter's mathematical operation. This is the default implementation, which supports all built-in UnitConverter implementations. Note that it recursively calls itself in the case of a pair converter.

Parameters
converter:UnitConverter

the converter to be formatted

continued:boolean

true if the converter expression should begin with an operator, otherwise false.

unitPrecedence:int

the operator precedence of the operation expressed by the unit being modified by the given converter.

buffer:StringBuilder

the StringBuffer to append to.

Returns:int

the operator precedence of the given UnitConverter

formatFormattableback to summary
private static int formatFormattable(Formattable f, int unitPrecedence, StringBuilder buffer)

Formats the given Formattable to the given StringBuffer and returns the given precedence of the converter's mathematical operation.

Parameters
f:Formattable

the formattable to be formatted

unitPrecedence:int

the operator precedence of the operation expressed by the unit being modified by the given converter.

buffer:StringBuilder

the StringBuffer to append to.

Returns:int

the given operator precedence

noopPrecedenceback to summary
private static int noopPrecedence(StringBuilder buffer, SymbolMap symbolMap, Prefix prefix)
productPrecedenceback to summary
private static int productPrecedence(PowerOfIntConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer)
productPrecedenceback to summary
private static int productPrecedence(MultiplyConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer)