Class AbsoluteValueSubstitution

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

class AbsoluteValueSubstitution extends NFSubstitution
A substitution that formats the absolute value of the number. This substitution is represented by >> in a negative-number rule.
  • Constructor Details

    • AbsoluteValueSubstitution

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

    • transformNumber

      public long transformNumber(long number)
      Returns the absolute value of the number.
      Specified by:
      transformNumber in class NFSubstitution
      Parameters:
      number - The number being formatted.
      Returns:
      abs(number)
    • transformNumber

      public double transformNumber(double number)
      Returns the absolute value of the number.
      Specified by:
      transformNumber in class NFSubstitution
      Parameters:
      number - The number being formatted.
      Returns:
      abs(number)
    • composeRuleValue

      public double composeRuleValue(double newRuleValue, double oldRuleValue)
      Returns the additive inverse of the result of parsing the substitution (this supersedes the earlier partial result)
      Specified by:
      composeRuleValue in class NFSubstitution
      Parameters:
      newRuleValue - The result of parsing the substitution
      oldRuleValue - The partial parse result prior to calling this function
      Returns:
      -newRuleValue
    • calcUpperBound

      public double calcUpperBound(double oldUpperBound)
      Sets the upper bound beck up to consider all rules
      Specified by:
      calcUpperBound in class NFSubstitution
      Parameters:
      oldUpperBound - Ignored.
      Returns:
      Double.MAX_VALUE
    • tokenChar

      char tokenChar()
      The token character for an AbsoluteValueSubstitution is >
      Specified by:
      tokenChar in class NFSubstitution
      Returns:
      '>'