Package tech.units.indriya.function
Class MixedRadix<Q extends Quantity<Q>>
- java.lang.Object
-
- tech.units.indriya.function.MixedRadix<Q>
-
public final class MixedRadix<Q extends Quantity<Q>> extends Object
Immutable class that represents mixed-radix units (like "hour:min:sec" or "ft, in")- Since:
- 2.0
- Version:
- 2.4, September 30, 2024
- Author:
- Andi Huber, Werner Keil
- See Also:
- Wikipedia: Mixed
radix,
Wolfram
Language & System: MixedUnit,
Wikipedia:
Metrication,
MixedQuantity
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMixedRadix.PrimaryUnitPick
-
Field Summary
Fields Modifier and Type Field Description static MixedRadix.PrimaryUnitPickPRIMARY_UNIT_PICKstatic MixedRadix.PrimaryUnitPickPRIMARY_UNIT_PICK_DEFAULT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MixedQuantity<Q>createMixedQuantity(Number... values)MixedQuantity<Q>createMixedQuantity(Number[] values, Quantity.Scale scale)Quantity<Q>createQuantity(Number... values)Quantity<Q>createQuantity(Number[] values, Quantity.Scale scale)Number[]extractValues(Quantity<Q> quantity)Number[]extractValuesInto(Quantity<Q> quantity, Number[] target)Unit<Q>getPrimaryUnit()List<Unit<Q>>getUnits()MixedRadix<Q>mix(Unit<Q> mixedRadixUnit)static <X extends Quantity<X>>
MixedRadix<X>of(Collection<Unit<X>> units)static <X extends Quantity<X>>
MixedRadix<X>of(Unit<X> leadingUnit)static <X extends Quantity<X>>
MixedRadix<X>of(Unit<X>... units)static <X extends Quantity<X>>
MixedRadix<X>ofPrimary(Unit<X> primaryUnit)StringtoString()
-
-
-
Field Detail
-
PRIMARY_UNIT_PICK_DEFAULT
public static final MixedRadix.PrimaryUnitPick PRIMARY_UNIT_PICK_DEFAULT
-
PRIMARY_UNIT_PICK
public static MixedRadix.PrimaryUnitPick PRIMARY_UNIT_PICK
-
-
Method Detail
-
of
public static <X extends Quantity<X>> MixedRadix<X> of(Unit<X> leadingUnit)
-
of
@SafeVarargs public static <X extends Quantity<X>> MixedRadix<X> of(Unit<X>... units)
-
of
public static <X extends Quantity<X>> MixedRadix<X> of(Collection<Unit<X>> units)
-
ofPrimary
public static <X extends Quantity<X>> MixedRadix<X> ofPrimary(Unit<X> primaryUnit)
-
mix
public MixedRadix<Q> mix(Unit<Q> mixedRadixUnit)
-
getPrimaryUnit
public Unit<Q> getPrimaryUnit()
-
createQuantity
public Quantity<Q> createQuantity(Number[] values, Quantity.Scale scale)
- Parameters:
values- - numbers corresponding to the radices in most significant first order, allowed to be of shorter length than the total count of radices of thisMixedRadixinstancescale- - theQuantity.Scaleto be used for the returnedQuantity
-
createQuantity
public Quantity<Q> createQuantity(Number... values)
-
createMixedQuantity
public MixedQuantity<Q> createMixedQuantity(Number[] values, Quantity.Scale scale)
Creates aMixedQuantityfrom givenvaluesandscale.Note: Not every
MixedQuantitycan be represented by aMixedRadix.MixedRadixstrictly requires its coefficients to be in decreasing order of significance, while aMixedQuantityin principle does not.- Parameters:
values- - numbers corresponding to the radix coefficients in most significant first order, allowed to be of shorter length than the total count of radix coefficients of thisMixedRadixinstancescale- - theQuantity.Scaleto be used for the elements of the returnedMixedQuantity
-
createMixedQuantity
public MixedQuantity<Q> createMixedQuantity(Number... values)
-
extractValues
public Number[] extractValues(Quantity<Q> quantity)
-
extractValuesInto
public Number[] extractValuesInto(Quantity<Q> quantity, Number[] target)
-
-