Comments (3)
Dimension.getBaseDimensions() returns a Map<Unit,Integer>; (3) Dimension.pow() and Unit.pow() accept only int as argument.
This is not really a problem because either Integer.intValue()
or a cast between Integer
and int
should both work.
@SebHess Was this the only concern, or are there significant examples for e.g. floating-point dimensions?
from unit-api.
This is not really a problem because either
Integer.intValue()
or a cast betweenInteger
andint
should both work. Was this the only concern, or are there significant examples for e.g. floating-point dimensions?
In my understanding, he wished that Map<Unit,Integer>
would have been something like Map<Unit,Fraction>
instead (Fraction
does not exist in the JDK, I'm using that only for expressing the intend). The example given is spectral densities with units of s^−½.
Map<Unit,Integer>
cannot be changed without compatibility break. Furthermore there is no clear alternative to Integer
in the standard JDK: Fraction
does not exist, and Float
or Double
may be too flexible. While this issue is not impossible to resolve, it is not an easy one neither.
from unit-api.
@desruisseaux Yes, that is exactly what I had in mind. Note that there are empirical laws in physics and chemisty that are expressed as an arbitrary (real) power of a quantity, thus implying real power of units.
An example is the electron emission from a metal by electric and thermal effects: if the metal is cold, the current is given by the Fowler-Nordheim law and implies fractional powers of the field, while for warmer metal, the empirical thermo-field law applies, with real powers of the temperature and field.
Thus for completeness, Integer should be replaced by either Float or Double.
It is true that this issue breaks the existing API, but one solution could be replacing Map<Unit, Integer>
by Map<Unit, ? extends Number>
? This would be OK API-wise and should not break existing implementation, although it would allow them to evolve toward non-integer powers of unit.
from unit-api.
Related Issues (20)
- Improve code coverage of ServiceProvider HOT 3
- Fix problem with maven-javadoc-plugin
- MR 1 Spec Review
- Could Quantity use a symbol, too? HOT 1
- Upgrade JDK to Java 11 or higher
- Replace Bintray/JCenter in API build settings
- Enable discovery of prefix classes via SPI HOT 1
- Improve the JavaDoc of UnitFormat
- Remove unnecessary OSGI imports
- Convert Quantity to most fitting Prefix HOT 7
- improve interoperability of Quantity with Hibernate JPA HOT 7
- Should not cache the ServiceProvider implementation HOT 8
- Incorporate the new SI Prefixes
- Upgrade CI JDK to Java 17 or higher
- Update module-info
- Replace tabulations by 4 spaces HOT 2
- Should we deprecate MetricPrefix.DEKA()? HOT 4
- Update Spec Document for MR2 HOT 5
- enum missing in javax.measure.MetricPrefix HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unit-api.