Package com.ibm.icu.text
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.
-
-
Field Summary
-
Fields inherited from class com.ibm.icu.text.NFSubstitution
numberFormat, pos, ruleSet
-
-
Constructor Summary
Constructors Constructor Description IntegralPartSubstitution(int pos, NFRuleSet ruleSet, java.lang.String description)
Constructs an IntegralPartSubstitution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
calcUpperBound(double oldUpperBound)
An IntegralPartSubstitution sets the upper bound back up so all potentially matching rules are considered.double
composeRuleValue(double newRuleValue, double oldRuleValue)
Returns the sum of the result of parsing the substitution and the owning rule's base value.(package private) char
tokenChar()
An IntegralPartSubstitution's token character is <double
transformNumber(double number)
Returns the number's integral part.long
transformNumber(long number)
Returns the number's integral part.-
Methods inherited from class com.ibm.icu.text.NFSubstitution
doParse, doSubstitution, doSubstitution, equals, getPos, hashCode, isModulusSubstitution, makeSubstitution, setDecimalFormatSymbols, setDivisor, toString
-
-
-
-
Constructor Detail
-
IntegralPartSubstitution
IntegralPartSubstitution(int pos, NFRuleSet ruleSet, java.lang.String description)
Constructs an IntegralPartSubstitution. This just calls the superclass constructor.
-
-
Method Detail
-
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 classNFSubstitution
- 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 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:
composeRuleValue
in 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:
calcUpperBound
in classNFSubstitution
- Parameters:
oldUpperBound
- Ignored- Returns:
- Double.MAX_VALUE
-
tokenChar
char tokenChar()
An IntegralPartSubstitution's token character is <- Specified by:
tokenChar
in classNFSubstitution
- Returns:
- '<'
-
-