Class ConverterFormatter


  • class ConverterFormatter
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String LOCAL_FORMAT_PATTERN  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static int additionPrecedence​(AddConverter converter, boolean continued, int unitPrecedence, java.lang.StringBuilder buffer)  
      private static int exponentPrecedenceExpConveter​(ExpConverter converter, int unitPrecedence, java.lang.StringBuilder buffer)  
      private static int exponentPrecedenceLogConveter​(LogConverter converter, java.lang.StringBuilder buffer)  
      (package private) static int formatConverter​(javax.measure.UnitConverter converter, boolean continued, int unitPrecedence, java.lang.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​(java.util.Formattable f, int unitPrecedence, java.lang.StringBuilder buffer)
      Formats the given Formattable to the given StringBuffer and returns the given precedence of the converter's mathematical operation.
      private static int noopPrecedence​(java.lang.StringBuilder buffer, SymbolMap symbolMap, Prefix prefix)  
      private static int productPrecedence​(MultiplyConverter converter, boolean continued, int unitPrecedence, java.lang.StringBuilder buffer)  
      private static int productPrecedence​(PowersOfIntConverter converter, boolean continued, int unitPrecedence, java.lang.StringBuilder buffer)  
      private static int productPrecedence​(RationalConverter converter, boolean continued, int unitPrecedence, java.lang.StringBuilder buffer)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOCAL_FORMAT_PATTERN

        private static final java.lang.String LOCAL_FORMAT_PATTERN
        See Also:
        Constant Field Values
    • Constructor Detail

      • ConverterFormatter

        ConverterFormatter()
    • Method Detail

      • formatConverter

        static int formatConverter​(javax.measure.UnitConverter converter,
                                   boolean continued,
                                   int unitPrecedence,
                                   java.lang.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,
                                             java.lang.StringBuilder buffer)
      • productPrecedence

        private static int productPrecedence​(RationalConverter converter,
                                             boolean continued,
                                             int unitPrecedence,
                                             java.lang.StringBuilder buffer)
      • productPrecedence

        private static int productPrecedence​(MultiplyConverter converter,
                                             boolean continued,
                                             int unitPrecedence,
                                             java.lang.StringBuilder buffer)
      • exponentPrecedenceExpConveter

        private static int exponentPrecedenceExpConveter​(ExpConverter converter,
                                                         int unitPrecedence,
                                                         java.lang.StringBuilder buffer)
      • exponentPrecedenceLogConveter

        private static int exponentPrecedenceLogConveter​(LogConverter converter,
                                                         java.lang.StringBuilder buffer)
      • additionPrecedence

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

        private static int noopPrecedence​(java.lang.StringBuilder buffer,
                                          SymbolMap symbolMap,
                                          Prefix prefix)
      • formatFormattable

        private static int formatFormattable​(java.util.Formattable f,
                                             int unitPrecedence,
                                             java.lang.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