Package com.ibm.icu.text
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.
-
-
Field Summary
-
Fields inherited from class com.ibm.icu.text.NFSubstitution
numberFormat, pos, ruleSet
-
-
Constructor Summary
Constructors Constructor Description AbsoluteValueSubstitution(int pos, NFRuleSet ruleSet, java.lang.String description)
Constructs an AbsoluteValueSubstitution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
calcUpperBound(double oldUpperBound)
Sets the upper bound beck up to consider all rulesdouble
composeRuleValue(double newRuleValue, double oldRuleValue)
Returns the additive inverse of the result of parsing the substitution (this supersedes the earlier partial result)(package private) char
tokenChar()
The token character for an AbsoluteValueSubstitution is >double
transformNumber(double number)
Returns the absolute value of the number.long
transformNumber(long number)
Returns the absolute value of the number.-
Methods inherited from class com.ibm.icu.text.NFSubstitution
doParse, doSubstitution, doSubstitution, equals, getPos, hashCode, isModulusSubstitution, makeSubstitution, setDecimalFormatSymbols, setDivisor, toString
-
-
-
-
Constructor Detail
-
AbsoluteValueSubstitution
AbsoluteValueSubstitution(int pos, NFRuleSet ruleSet, java.lang.String description)
Constructs an AbsoluteValueSubstitution. This just uses the superclass constructor.
-
-
Method Detail
-
transformNumber
public long transformNumber(long number)
Returns the absolute value of the number.- Specified by:
transformNumber
in classNFSubstitution
- 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 classNFSubstitution
- 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 classNFSubstitution
- Parameters:
newRuleValue
- The result of parsing the substitutionoldRuleValue
- 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 classNFSubstitution
- Parameters:
oldUpperBound
- Ignored.- Returns:
- Double.MAX_VALUE
-
tokenChar
char tokenChar()
The token character for an AbsoluteValueSubstitution is >- Specified by:
tokenChar
in classNFSubstitution
- Returns:
- '>'
-
-