Class ScientificNotation.ScientificHandler

java.lang.Object
com.ibm.icu.number.ScientificNotation.ScientificHandler
All Implemented Interfaces:
MicroPropsGenerator, Modifier, MultiplierProducer
Enclosing class:
ScientificNotation

private static class ScientificNotation.ScientificHandler extends Object implements MicroPropsGenerator, MultiplierProducer, Modifier
  • Field Details

  • Constructor Details

  • Method Details

    • processQuantity

      public MicroProps processQuantity(DecimalQuantity quantity)
      Description copied from interface: MicroPropsGenerator
      Considers the given DecimalQuantity, optionally mutates it, and returns a MicroProps.
      Specified by:
      processQuantity in interface MicroPropsGenerator
      Parameters:
      quantity - The quantity for consideration and optional mutation.
      Returns:
      A MicroProps instance resolved for the quantity.
    • getMultiplier

      public int getMultiplier(int magnitude)
      Description copied from interface: MultiplierProducer
      Maps a magnitude to a multiplier in powers of ten. For example, in compact notation in English, a magnitude of 5 (e.g., 100,000) should return a multiplier of -3, since the number is displayed in thousands.
      Specified by:
      getMultiplier in interface MultiplierProducer
      Parameters:
      magnitude - The power of ten of the input number.
      Returns:
      The shift in powers of ten.
    • getPrefixLength

      public int getPrefixLength()
      Description copied from interface: Modifier
      Gets the length of the prefix. This information can be used in combination with Modifier.apply(com.ibm.icu.impl.FormattedStringBuilder, int, int) to extract the prefix and suffix strings.
      Specified by:
      getPrefixLength in interface Modifier
      Returns:
      The number of characters (UTF-16 code units) in the prefix.
    • getCodePointCount

      public int getCodePointCount()
      Description copied from interface: Modifier
      Returns the number of code points in the modifier, prefix plus suffix.
      Specified by:
      getCodePointCount in interface Modifier
    • isStrong

      public boolean isStrong()
      Description copied from interface: Modifier
      Whether this modifier is strong. If a modifier is strong, it should always be applied immediately and not allowed to bubble up. With regard to padding, strong modifiers are considered to be on the inside of the prefix and suffix.
      Specified by:
      isStrong in interface Modifier
      Returns:
      Whether the modifier is strong.
    • containsField

      public boolean containsField(Format.Field field)
      Description copied from interface: Modifier
      Whether the modifier contains at least one occurrence of the given field.
      Specified by:
      containsField in interface Modifier
    • getParameters

      public Modifier.Parameters getParameters()
      Description copied from interface: Modifier
      Gets a set of "parameters" for this Modifier.
      Specified by:
      getParameters in interface Modifier
    • semanticallyEquivalent

      public boolean semanticallyEquivalent(Modifier other)
      Description copied from interface: Modifier
      Returns whether this Modifier is *semantically equivalent* to the other Modifier; in many cases, this is the same as equal, but parameters should be ignored.
      Specified by:
      semanticallyEquivalent in interface Modifier
    • apply

      public int apply(FormattedStringBuilder output, int leftIndex, int rightIndex)
      Description copied from interface: Modifier
      Apply this Modifier to the string builder.
      Specified by:
      apply in interface Modifier
      Parameters:
      output - The string builder to which to apply this modifier.
      leftIndex - The left index of the string within the builder. Equal to 0 when only one number is being formatted.
      rightIndex - The right index of the string within the string builder. Equal to length when only one number is being formatted.
      Returns:
      The number of characters (UTF-16 code units) that were added to the string builder.
    • doApply

      private int doApply(int exponent, FormattedStringBuilder output, int rightIndex)