Open cdwivedi opened 5 years ago
It could potentially be something on the SPI, we'll check it but probably for a new version.
I think this one asks the wrong question, or do you have a code example (at least a snippet) how this would be required?
We have a SystemOfUnits
method getUnits()
that takes a Dimension
, e.g. sou.getUnits(UnitDimension.TIME)
returning 7 units in the RI unit system.
On the other hand there's a getUnit()
method that takes the class of a Quantity
type like Length
returning the system-wide base unit for that quantity type: sou.getUnit(Length.class)
.
These could be combined:
Unit<?> result = sou.getUnit(Length.class);
Dimension dim = result.getDimension();
Set<? extends Unit<?>> units = sou.getUnits(dim);
So you can have multiple units for a given dimension, a convenience method returning the set of units would be no big deal, but there is just one dimension for a given quantity type like Volume
: "[L]³". There are no multiple dimensions. You can decompose the dimension via getBaseDimensions()
.
Does this help you @cdwivedi, or could you show, why you think there would be multiple dimensions for a single quantity type? The mentioned convenience method is easy to apply, I am not sure, if we should add it to the API at this point, because the MR1 is planned in less than a month, but adding it to Indriya would not be a problem.
There should be mechanism to get a list of all valid Dimension for a Quantity LENGTH and other quantity too.