Package tech.units.indriya.format
Class ConverterFormatter
java.lang.Object
tech.units.indriya.format.ConverterFormatter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
additionPrecedence
(AddConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) private static int
exponentPrecedenceExpConveter
(ExpConverter converter, int unitPrecedence, StringBuilder buffer) private static int
exponentPrecedenceLogConveter
(LogConverter converter, StringBuilder buffer) (package private) static int
formatConverter
(javax.measure.UnitConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer, SymbolMap symbolMap) Formats the given converter to the given StringBuilder and returns the operator precedence of the converter's mathematical operation.private static int
formatFormattable
(Formattable f, int unitPrecedence, StringBuilder buffer) Formats the givenFormattable
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
(MultiplyConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) private static int
productPrecedence
(PowersOfIntConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) private static int
productPrecedence
(RationalConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer)
-
Field Details
-
LOCAL_FORMAT_PATTERN
- See Also:
-
-
Constructor Details
-
ConverterFormatter
ConverterFormatter()
-
-
Method Details
-
formatConverter
static int formatConverter(javax.measure.UnitConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer, 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 aCompound
converter.- Parameters:
converter
- the converter to be formattedcontinued
-true
if the converter expression should begin with an operator, otherwisefalse
.unitPrecedence
- the operator precedence of the operation expressed by the unit being modified by the given converter.buffer
- theStringBuffer
to append to.- Returns:
- the operator precedence of the given UnitConverter
-
productPrecedence
private static int productPrecedence(PowersOfIntConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) -
productPrecedence
private static int productPrecedence(RationalConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) -
productPrecedence
private static int productPrecedence(MultiplyConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) -
exponentPrecedenceExpConveter
private static int exponentPrecedenceExpConveter(ExpConverter converter, int unitPrecedence, StringBuilder buffer) -
exponentPrecedenceLogConveter
-
additionPrecedence
private static int additionPrecedence(AddConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) -
noopPrecedence
-
formatFormattable
Formats the givenFormattable
to the given StringBuffer and returns the given precedence of the converter's mathematical operation.- Parameters:
f
- the formattable to be formattedunitPrecedence
- the operator precedence of the operation expressed by the unit being modified by the given converter.buffer
- theStringBuffer
to append to.- Returns:
- the given operator precedence
-