Class ConverterFormatter

java.lang.Object
tech.units.indriya.format.ConverterFormatter

class ConverterFormatter extends Object
  • Field Details

  • 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 a Compound converter.
      Parameters:
      converter - the converter to be formatted
      continued - true if the converter expression should begin with an operator, otherwise false.
      unitPrecedence - the operator precedence of the operation expressed by the unit being modified by the given converter.
      buffer - the StringBuffer 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

      private static int exponentPrecedenceLogConveter(LogConverter converter, StringBuilder buffer)
    • additionPrecedence

      private static int additionPrecedence(AddConverter converter, boolean continued, int unitPrecedence, StringBuilder buffer)
    • noopPrecedence

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

      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 - the formattable to be formatted
      unitPrecedence - the operator precedence of the operation expressed by the unit being modified by the given converter.
      buffer - the StringBuffer to append to.
      Returns:
      the given operator precedence