Class EBNFHelper

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

class EBNFHelper extends Object
Helper class that handles internals of formatting in EBNFUnitFormat
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final int
    Operator precedence for the addition and subtraction operations
    private static final char
    Exponent 1 character
    private static final char
    Exponent 2 character
    (package private) static final int
    Operator precedence for the exponentiation and logarithm operations
    (package private) static final char
     
    (package private) static final int
    Operator precedence for a unit identifier containing no mathematical operations (i.e., consisting exclusively of an identifier and possibly a prefix).
    (package private) static final int
    Operator precedence for the multiplication and division operations
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    formatExponent(javax.measure.Unit<?> unit, int pow, int root, boolean continued, Appendable buffer, SymbolMap symbolMap)
    Format the given unit raised to the given fractional power to the given StringBuffer.
    (package private) static int
    formatInternal(javax.measure.Unit<?> unit, Appendable buffer, SymbolMap symbolMap)
    Format the given unit to the given StringBuffer, then return the operator precedence of the outermost operator in the unit expression that was formatted.
    private static int
     
    private static int
    productPrecedenceInternal(javax.measure.Unit<?> unit, Appendable buffer, SymbolMap symbolMap)
     

    Methods inherited from class java.lang.Object

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

    • ADDITION_PRECEDENCE

      static final int ADDITION_PRECEDENCE
      Operator precedence for the addition and subtraction operations
      See Also:
    • PRODUCT_PRECEDENCE

      static final int PRODUCT_PRECEDENCE
      Operator precedence for the multiplication and division operations
      See Also:
    • EXPONENT_PRECEDENCE

      static final int EXPONENT_PRECEDENCE
      Operator precedence for the exponentiation and logarithm operations
      See Also:
    • MIDDLE_DOT

      static final char MIDDLE_DOT
      See Also:
    • EXPONENT_1

      private static final char EXPONENT_1
      Exponent 1 character
      See Also:
    • EXPONENT_2

      private static final char EXPONENT_2
      Exponent 2 character
      See Also:
    • NOOP_PRECEDENCE

      static final int NOOP_PRECEDENCE
      Operator precedence for a unit identifier containing no mathematical operations (i.e., consisting exclusively of an identifier and possibly a prefix). Defined to be Integer.MAX_VALUE so that no operator can have a higher precedence.
      See Also:
  • Constructor Details

    • EBNFHelper

      EBNFHelper()
  • Method Details

    • formatInternal

      static int formatInternal(javax.measure.Unit<?> unit, Appendable buffer, SymbolMap symbolMap) throws IOException
      Format the given unit to the given StringBuffer, then return the operator precedence of the outermost operator in the unit expression that was formatted. See
      invalid reference
      ConverterFormat
      for the constants that define the various precedence values.
      Parameters:
      unit - the unit to be formatted
      buffer - the StringBuffer to be written to
      Returns:
      the operator precedence of the outermost operator in the unit expression that was output
      Throws:
      IOException
    • formatExponent

      private static void formatExponent(javax.measure.Unit<?> unit, int pow, int root, boolean continued, Appendable buffer, SymbolMap symbolMap) throws IOException
      Format the given unit raised to the given fractional power to the given StringBuffer.
      Parameters:
      unit - Unit the unit to be formatted
      pow - int the numerator of the fractional power
      root - int the denominator of the fractional power
      continued - boolean true if the converter expression should begin with an operator, otherwise false. This will always be true unless the unit being modified is equal to Unit.ONE.
      buffer - StringBuffer the buffer to append to. No assumptions should be made about its content.
      Throws:
      IOException
    • noopPrecedenceInternal

      private static int noopPrecedenceInternal(Appendable buffer, String symbol) throws IOException
      Throws:
      IOException
    • productPrecedenceInternal

      private static int productPrecedenceInternal(javax.measure.Unit<?> unit, Appendable buffer, SymbolMap symbolMap) throws IOException
      Throws:
      IOException