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 intadditionPrecedence(AddConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) private static intexponentPrecedenceExpConveter(ExpConverter converter, int unitPrecedence, StringBuilder buffer) private static intexponentPrecedenceLogConveter(LogConverter converter, StringBuilder buffer) (package private) static intformatConverter(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 intformatFormattable(Formattable f, int unitPrecedence, StringBuilder buffer) Formats the givenFormattableto the given StringBuffer and returns the given precedence of the converter's mathematical operation.private static intnoopPrecedence(StringBuilder buffer, SymbolMap symbolMap, Prefix prefix) private static intproductPrecedence(MultiplyConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) private static intproductPrecedence(PowersOfIntConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer) private static intproductPrecedence(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 aconverter.invalid reference
Compound- Parameters:
converter- the converter to be formattedcontinued-trueif 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- theStringBufferto 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 givenFormattableto 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- theStringBufferto append to.- Returns:
- the given operator precedence
-