Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Provide a mechanism to get list of all Dimension for given quantity #224

Open
cdwivedi opened this issue Jun 1, 2019 · 2 comments

Comments

@cdwivedi
Copy link

cdwivedi commented Jun 1, 2019

There should be mechanism to get a list of all valid Dimension for a Quantity LENGTH and other quantity too.

@keilw keilw added the analysis label Jun 3, 2019
@keilw
Copy link
Member

keilw commented Jun 3, 2019

It could potentially be something on the SPI, we'll check it but probably for a new version.

@keilw
Copy link
Member

keilw commented Oct 25, 2020

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.

keilw added a commit that referenced this issue Nov 4, 2020
@keilw keilw removed this from the 2.1 milestone Dec 3, 2020
@keilw keilw added the deferred label Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants