Class IntegralPartSubstitution

java.lang.Object
com.ibm.icu.text.NFSubstitution
com.ibm.icu.text.IntegralPartSubstitution

class IntegralPartSubstitution extends NFSubstitution
A substitution that formats the number's integral part. This is represented by << in a fraction rule.
  • Constructor Details

    • IntegralPartSubstitution

      IntegralPartSubstitution(int pos, NFRuleSet ruleSet, String description)
      Constructs an IntegralPartSubstitution. This just calls the superclass constructor.
  • Method Details

    • transformNumber

      public long transformNumber(long number)
      Returns the number's integral part. (For a long, that's just the number unchanged.)
      Specified by:
      transformNumber in class NFSubstitution
      Parameters:
      number - The number being formatted
      Returns:
      "number" unchanged
    • transformNumber

      public double transformNumber(double number)
      Returns the number's integral part.
      Specified by:
      transformNumber in class NFSubstitution
      Parameters:
      number - The integral part of the number being formatted
      Returns:
      floor(number)
    • composeRuleValue

      public double composeRuleValue(double newRuleValue, double oldRuleValue)
      Returns the sum of the result of parsing the substitution and the owning rule's base value. (The owning rule, at best, has an integral-part substitution and a fractional-part substitution, so we can safely just add them.)
      Specified by:
      composeRuleValue in class NFSubstitution
      Parameters:
      newRuleValue - The result of matching the substitution
      oldRuleValue - The partial result of the parse prior to calling this function
      Returns:
      oldRuleValue + newRuleValue
    • calcUpperBound

      public double calcUpperBound(double oldUpperBound)
      An IntegralPartSubstitution sets the upper bound back up so all potentially matching rules are considered.
      Specified by:
      calcUpperBound in class NFSubstitution
      Parameters:
      oldUpperBound - Ignored
      Returns:
      Double.MAX_VALUE
    • tokenChar

      char tokenChar()
      An IntegralPartSubstitution's token character is <
      Specified by:
      tokenChar in class NFSubstitution
      Returns:
      '<'