meter
to foot+inch.
DESIGN: This class uses UnitsConverter in order to perform the single converter (i.e. converters from
a single unit to another single unit). Therefore, ComplexUnitsConverter class contains multiple
instances of the UnitsConverter to perform the conversion.
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final BigDecimal | |
| public static final BigDecimal | |
| private MeasureUnitImpl | |
| public List | units_
Individual units of mixed units, sorted big to small, with indices indicating the requested output mixed unit order. |
| public ArrayList |
| Access | Constructor and Description |
|---|---|
| public | ComplexUnitsConverter(MeasureUnitImpl
represents the input unit. could be any type. (single, compound or mixed). targetUnit, ConversionRates conversionRates)Constructs |
| public | ComplexUnitsConverter(String
represents the source unit identifier. (should be single or compound unit). inputUnitIdentifier, String represents the output unit identifier. could be any type. (single, compound or mixed). outputUnitsIdentifier)Constructs |
| public | ComplexUnitsConverter(MeasureUnitImpl
represents the source unit. (should be single or compound unit). inputUnit, MeasureUnitImpl represents the output unit. could be any type. (single, compound or mixed). outputUnits, ConversionRates a ConversionRates instance containing the unit conversion rates. conversionRates)Constructs |
| Modifier and Type | Method and Description |
|---|---|
| private BigDecimal | Returns: the rounded quantityApplies the rounder to the quantity (last element) and bubble up any carried value to all the intValues. |
| public ComplexUnitsConverter. | convert(BigDecimal quantity, Precision rounder)
Returns outputMeasures which is an array with the corresponding values. |
| public boolean | greaterThanOrEqual(BigDecimal quantity, BigDecimal limit)
Returns true if the specified |
| private void | init(ConversionRates conversionRates)
Sorts units_, which must be populated before calling this, and populates unitsConverters_. |
| public String |
| EPSILON | back to summary |
|---|---|
| public static final BigDecimal EPSILON | |
| EPSILON_MULTIPLIER | back to summary |
|---|---|
| public static final BigDecimal EPSILON_MULTIPLIER | |
| inputUnit_ | back to summary |
|---|---|
| private MeasureUnitImpl inputUnit_ | |
| units_ | back to summary |
|---|---|
| public List<MeasureUnitImpl. Individual units of mixed units, sorted big to small, with indices indicating the requested output mixed unit order. | |
| unitsConverters_ | back to summary |
|---|---|
| public ArrayList<UnitsConverter> unitsConverters_ | |
| ComplexUnitsConverter | back to summary |
|---|---|
| public ComplexUnitsConverter(MeasureUnitImpl targetUnit, ConversionRates conversionRates) Constructs
| |
| ComplexUnitsConverter | back to summary |
|---|---|
| public ComplexUnitsConverter(String inputUnitIdentifier, String outputUnitsIdentifier) Constructs | |
| ComplexUnitsConverter | back to summary |
|---|---|
| public ComplexUnitsConverter(MeasureUnitImpl inputUnit, MeasureUnitImpl outputUnits, ConversionRates conversionRates) Constructs
| |
| applyRounder | back to summary |
|---|---|
| private BigDecimal applyRounder(List<BigInteger> intValues, BigDecimal quantity, Precision rounder) Applies the rounder to the quantity (last element) and bubble up any carried value to all the intValues.
| |
| convert | back to summary |
|---|---|
| public ComplexUnitsConverter. Returns outputMeasures which is an array with the corresponding values. - E.g. converting meters to feet and inches. 1 meter --> 3 feet, 3.3701 inches Note the smallest element is the only element that could have fractional values. And all other elements are floored to the nearest integer | |
| greaterThanOrEqual | back to summary |
|---|---|
| public boolean greaterThanOrEqual(BigDecimal quantity, BigDecimal limit) Returns true if the specified
For example, if the input unit is | |
| init | back to summary |
|---|---|
| private void init(ConversionRates conversionRates) Sorts units_, which must be populated before calling this, and populates unitsConverters_. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| indexOfQuantity | back to summary |
|---|---|
| public final int indexOfQuantity | |
| measures | back to summary |
|---|---|
| public final List<Measure> measures | |
| ComplexConverterResult | back to summary |
|---|---|
| pack-priv ComplexConverterResult(int indexOfQuantity, List<Measure> measures) | |