Class IntegralPartSubstitution
java.lang.Object
com.ibm.icu.text.NFSubstitution
com.ibm.icu.text.IntegralPartSubstitution
A substitution that formats the number's integral part. This is
represented by << in a fraction rule.
-
Field Summary
Fields inherited from class NFSubstitution
numberFormat, pos, ruleSet -
Constructor Summary
ConstructorsConstructorDescriptionIntegralPartSubstitution(int pos, NFRuleSet ruleSet, String description) Constructs an IntegralPartSubstitution. -
Method Summary
Modifier and TypeMethodDescriptiondoublecalcUpperBound(double oldUpperBound) An IntegralPartSubstitution sets the upper bound back up so all potentially matching rules are considered.doublecomposeRuleValue(double newRuleValue, double oldRuleValue) Returns the sum of the result of parsing the substitution and the owning rule's base value.(package private) charAn IntegralPartSubstitution's token character is <doubletransformNumber(double number) Returns the number's integral part.longtransformNumber(long number) Returns the number's integral part.Methods inherited from class NFSubstitution
doParse, doSubstitution, doSubstitution, equals, getPos, hashCode, isModulusSubstitution, makeSubstitution, setDecimalFormatSymbols, setDivisor, toString
-
Constructor Details
-
IntegralPartSubstitution
-
-
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:
transformNumberin classNFSubstitution- Parameters:
number- The number being formatted- Returns:
- "number" unchanged
-
transformNumber
public double transformNumber(double number) Returns the number's integral part.- Specified by:
transformNumberin classNFSubstitution- 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:
composeRuleValuein classNFSubstitution- Parameters:
newRuleValue- The result of matching the substitutionoldRuleValue- 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:
calcUpperBoundin classNFSubstitution- Parameters:
oldUpperBound- Ignored- Returns:
- Double.MAX_VALUE
-
tokenChar
char tokenChar()An IntegralPartSubstitution's token character is <- Specified by:
tokenCharin classNFSubstitution- Returns:
- '<'
-