Package com.ibm.icu.number
Class ScientificNotation.ScientificHandler
java.lang.Object
com.ibm.icu.number.ScientificNotation.ScientificHandler
- All Implemented Interfaces:
MicroPropsGenerator,Modifier,MultiplierProducer
- Enclosing class:
ScientificNotation
private static class ScientificNotation.ScientificHandler
extends Object
implements MicroPropsGenerator, MultiplierProducer, Modifier
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.ibm.icu.impl.number.Modifier
Modifier.Parameters, Modifier.Signum -
Field Summary
FieldsModifier and TypeFieldDescription(package private) int(package private) final ScientificNotation(package private) final MicroPropsGenerator(package private) final ScientificNotation.ScientificModifier[](package private) final DecimalFormatSymbols -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateScientificHandler(ScientificNotation notation, DecimalFormatSymbols symbols, boolean safe, MicroPropsGenerator parent) -
Method Summary
Modifier and TypeMethodDescriptionintapply(FormattedStringBuilder output, int leftIndex, int rightIndex) Apply this Modifier to the string builder.booleancontainsField(Format.Field field) Whether the modifier contains at least one occurrence of the given field.private intdoApply(int exponent, FormattedStringBuilder output, int rightIndex) intReturns the number of code points in the modifier, prefix plus suffix.intgetMultiplier(int magnitude) Maps a magnitude to a multiplier in powers of ten.Gets a set of "parameters" for this Modifier.intGets the length of the prefix.booleanisStrong()Whether this modifier is strong.processQuantity(DecimalQuantity quantity) Considers the givenDecimalQuantity, optionally mutates it, and returns aMicroProps.booleanstrictEquals(Modifier other) Returns whether this Modifier equals another Modifier.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.ibm.icu.impl.number.Modifier
semanticallyEquivalent
-
Field Details
-
notation
-
symbols
-
precomputedMods
-
parent
-
exponent
int exponent
-
-
Constructor Details
-
ScientificHandler
private ScientificHandler(ScientificNotation notation, DecimalFormatSymbols symbols, boolean safe, MicroPropsGenerator parent)
-
-
Method Details
-
processQuantity
Description copied from interface:MicroPropsGeneratorConsiders the givenDecimalQuantity, optionally mutates it, and returns aMicroProps.- Specified by:
processQuantityin interfaceMicroPropsGenerator- Parameters:
quantity- The quantity for consideration and optional mutation.- Returns:
- A MicroProps instance resolved for the quantity.
-
getMultiplier
public int getMultiplier(int magnitude) Description copied from interface:MultiplierProducerMaps a magnitude to a multiplier in powers of ten. For example, in compact notation in English, a magnitude of 5 (e.g., 100,000) should return a multiplier of -3, since the number is displayed in thousands.- Specified by:
getMultiplierin interfaceMultiplierProducer- Parameters:
magnitude- The power of ten of the input number.- Returns:
- The shift in powers of ten.
-
getPrefixLength
public int getPrefixLength()Description copied from interface:ModifierGets the length of the prefix. This information can be used in combination withModifier.apply(com.ibm.icu.impl.FormattedStringBuilder, int, int)to extract the prefix and suffix strings.- Specified by:
getPrefixLengthin interfaceModifier- Returns:
- The number of characters (UTF-16 code units) in the prefix.
-
getCodePointCount
public int getCodePointCount()Description copied from interface:ModifierReturns the number of code points in the modifier, prefix plus suffix.- Specified by:
getCodePointCountin interfaceModifier
-
isStrong
public boolean isStrong()Description copied from interface:ModifierWhether this modifier is strong. If a modifier is strong, it should always be applied immediately and not allowed to bubble up. With regard to padding, strong modifiers are considered to be on the inside of the prefix and suffix. -
containsField
Description copied from interface:ModifierWhether the modifier contains at least one occurrence of the given field.- Specified by:
containsFieldin interfaceModifier
-
getParameters
Description copied from interface:ModifierGets a set of "parameters" for this Modifier.- Specified by:
getParametersin interfaceModifier
-
strictEquals
Description copied from interface:ModifierReturns whether this Modifier equals another Modifier.- Specified by:
strictEqualsin interfaceModifier
-
apply
Description copied from interface:ModifierApply this Modifier to the string builder.- Specified by:
applyin interfaceModifier- Parameters:
output- The string builder to which to apply this modifier.leftIndex- The left index of the string within the builder. Equal to 0 when only one number is being formatted.rightIndex- The right index of the string within the string builder. Equal to length when only one number is being formatted.- Returns:
- The number of characters (UTF-16 code units) that were added to the string builder.
-
doApply
-