Class AbsoluteValueSubstitution
java.lang.Object
com.ibm.icu.text.NFSubstitution
com.ibm.icu.text.AbsoluteValueSubstitution
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 NFSubstitution
numberFormat, pos, ruleSet -
Constructor Summary
ConstructorsConstructorDescriptionAbsoluteValueSubstitution(int pos, NFRuleSet ruleSet, String description) Constructs an AbsoluteValueSubstitution. -
Method Summary
Modifier and TypeMethodDescriptiondoublecalcUpperBound(double oldUpperBound) Sets the upper bound beck up to consider all rulesdoublecomposeRuleValue(double newRuleValue, double oldRuleValue) Returns the additive inverse of the result of parsing the substitution (this supersedes the earlier partial result)(package private) charThe token character for an AbsoluteValueSubstitution is >doubletransformNumber(double number) Returns the absolute value of the number.longtransformNumber(long number) Returns the absolute value of the number.Methods inherited from class NFSubstitution
doParse, doSubstitution, doSubstitution, equals, getPos, hashCode, isModulusSubstitution, makeSubstitution, setDecimalFormatSymbols, setDivisor, toString
-
Constructor Details
-
AbsoluteValueSubstitution
-
-
Method Details
-
transformNumber
public long transformNumber(long number) Returns the absolute value of the number.- Specified by:
transformNumberin 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:
transformNumberin 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:
composeRuleValuein 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:
calcUpperBoundin classNFSubstitution- Parameters:
oldUpperBound- Ignored.- Returns:
- Double.MAX_VALUE
-
tokenChar
char tokenChar()The token character for an AbsoluteValueSubstitution is >- Specified by:
tokenCharin classNFSubstitution- Returns:
- '>'
-