Top Description Fields Constructors Methods
com.ibm.icu.text

pack-priv Class MultiplierSubstitution

Located in compilation unit of com.ibm.icu.text.NFSubstitution.

extends NFSubstitution
Class Inheritance

A substitution that divides the number being formatted by the rule's divisor and formats the quotient. Represented by << in normal rules.

Field Summary

Modifier and TypeField and Description
pack-priv long
divisor

The divisor of the rule that owns this substitution.

Inherited from com.ibm.icu.text.NFSubstitution:
numberFormatposruleSet

Constructor Summary

AccessConstructor and Description
pack-priv
MultiplierSubstitution(int
The substitution's position in its rule's rule text
pos
,
NFRule
The rule that owns this substitution
rule
,
NFRuleSet
The ruleSet this substitution uses to format its result
ruleSet
,
String
The description describing this substitution
description
)

Constructs a MultiplierSubstitution.

Method Summary

Modifier and TypeMethod and Description
public double

Returns:

The rule's divisor.
calcUpperBound
(double
Ignored.
oldUpperBound
)

Implements abstract com.ibm.icu.text.NFSubstitution.calcUpperBound.

Sets the upper bound down to the rule's divisor.
public double

Returns:

newRuleValue * divisor
composeRuleValue
(double
The result of matching the substitution
newRuleValue
,
double
The base value of the rule containing the substitution
oldRuleValue
)

Implements abstract com.ibm.icu.text.NFSubstitution.composeRuleValue.

Returns newRuleValue times the divisor.
public boolean

Returns:

true if the two substitutions are functionally equal
equals
(Object
The other substitution
that
)

Overrides com.ibm.icu.text.NFSubstitution.equals.

Augments the superclass's equals() function by comparing divisors.
public void
setDivisor(int
The radix of the divisor.
radix
,
short
The exponent of the divisor.
exponent
)

Overrides com.ibm.icu.text.NFSubstitution.setDivisor.

Sets the substitution's divisor based on the values passed in.
pack-priv char

Returns:

'<'
tokenChar
()

Implements abstract com.ibm.icu.text.NFSubstitution.tokenChar.

The token character for a multiplier substitution is <.
public long

Returns:

"number" divided by the rule's divisor
transformNumber
(long
The number being formatted.
number
)

Implements abstract com.ibm.icu.text.NFSubstitution.transformNumber.

Divides the number by the rule's divisor and returns the quotient.
public double

Returns:

"number" divided by the rule's divisor
transformNumber
(double
The number being formatted
number
)

Implements abstract com.ibm.icu.text.NFSubstitution.transformNumber.

Divides the number by the rule's divisor and returns the quotient.
Inherited from com.ibm.icu.text.NFSubstitution:
doParsedoSubstitutiondoSubstitutiongetPoshashCodeisModulusSubstitutionmakeSubstitutionsetDecimalFormatSymbolstoString

Field Detail

divisorback to summary
pack-priv long divisor

The divisor of the rule that owns this substitution.

Constructor Detail

MultiplierSubstitutionback to summary
pack-priv MultiplierSubstitution(int pos, NFRule rule, NFRuleSet ruleSet, String description)

Constructs a MultiplierSubstitution. This uses the superclass constructor to initialize most members, but this substitution also maintains its own copy of its rule's divisor.

Parameters
pos:int

The substitution's position in its rule's rule text

rule:NFRule

The rule that owns this substitution

ruleSet:NFRuleSet

The ruleSet this substitution uses to format its result

description:String

The description describing this substitution

Method Detail

calcUpperBoundback to summary
public double calcUpperBound(double oldUpperBound)

Implements abstract com.ibm.icu.text.NFSubstitution.calcUpperBound.

Sets the upper bound down to the rule's divisor.

Parameters
oldUpperBound:double

Ignored.

Returns:double

The rule's divisor.

Annotations
@Override
composeRuleValueback to summary
public double composeRuleValue(double newRuleValue, double oldRuleValue)

Implements abstract com.ibm.icu.text.NFSubstitution.composeRuleValue.

Returns newRuleValue times the divisor. Ignores oldRuleValue. (The result of matching a << substitution supersedes the base value of the rule that contains it.)

Parameters
newRuleValue:double

The result of matching the substitution

oldRuleValue:double

The base value of the rule containing the substitution

Returns:double

newRuleValue * divisor

Annotations
@Override
equalsback to summary
public boolean equals(Object that)

Overrides com.ibm.icu.text.NFSubstitution.equals.

Augments the superclass's equals() function by comparing divisors.

Parameters
that:Object

The other substitution

Returns:boolean

true if the two substitutions are functionally equal

Annotations
@Override
setDivisorback to summary
public void setDivisor(int radix, short exponent)

Overrides com.ibm.icu.text.NFSubstitution.setDivisor.

Sets the substitution's divisor based on the values passed in.

Parameters
radix:int

The radix of the divisor.

exponent:short

The exponent of the divisor.

Annotations
@Override
tokenCharback to summary
pack-priv char tokenChar()

Implements abstract com.ibm.icu.text.NFSubstitution.tokenChar.

The token character for a multiplier substitution is <.

Returns:char

'<'

Annotations
@Override
transformNumberback to summary
public long transformNumber(long number)

Implements abstract com.ibm.icu.text.NFSubstitution.transformNumber.

Divides the number by the rule's divisor and returns the quotient.

Parameters
number:long

The number being formatted.

Returns:long

"number" divided by the rule's divisor

Annotations
@Override
transformNumberback to summary
public double transformNumber(double number)

Implements abstract com.ibm.icu.text.NFSubstitution.transformNumber.

Divides the number by the rule's divisor and returns the quotient. This is an integral quotient if we're filling in the substitution using another rule set, but it's the full quotient (integral and fractional parts) if we're filling in the substitution using a DecimalFormat. (This allows things such as "1.2 million".)

Parameters
number:double

The number being formatted

Returns:double

"number" divided by the rule's divisor

Annotations
@Override