Skip to main content

[jsr363-experts] Re: Request for clarification on Unit commensurability

  • From: Werner Keil < >
  • To: " " < >
  • Subject: [jsr363-experts] Re: Request for clarification on Unit commensurability
  • Date: Mon, 15 Dec 2014 12:04:35 +0100

According to this API interface
https://github.com/unitsofmeasurement/unit-api/blob/master/src/main/java/javax/measure/quantity/Torque.java
it doesn't, and since there are two different classes, Java would not
consider them equal either;-)

We have a real life use case (currently just a subset of a whole heating
efficiency scenario, see this page:
http://www.dagego.de/info_waermebedarf.html I couldn't find a proper, not
too "geeky" and out worldly example for this in English yet) where
Quantity<Energy> energy = (Quantity<Energy>) volume.multiply(temperature);
(see
https://github.com/unitsofmeasurement/uom-demos/blob/master/console/ri/src/main/java/tec/uom/demo/SmartHomeDemo.java
)

The demo requires an explicit cast to Quantity<Energy> since asType() would
not recognize the result of this operation as Energy, but the formula
clearly states, the result was kWh (
http://en.wikipedia.org/wiki/Kilowatt_hour)

Werner

On Mon, Dec 15, 2014 at 5:12 AM, Martin Desruisseaux <
>
 wrote:
>
>  The specification and the javadoc contains in different places the
> following sentence:
>
> Two units *u1* and *u2* are compatible if and only if
> u1.getDimension().equals(u2.getDimension()).
>
> This discussion said nothing about the case of unit having the same
> dimension, but still being different units. Examples:
>
>    - *Angular degrees* and *concentration* (e.g. of a product in water)
>     - *Energy* and *Torque*
>
> I'm not asking for a change in the reference implementation, but I would
> request at least a clarification of those cases. Does the RI consider
> Energy and Torque as compatible units? Are Unit.asType(Class) and
> Quantity.asType(Class) capable to differentiate those two cases?
>
>     Martin
>
>


[jsr363-experts] Request for clarification on Unit commensurability

Martin Desruisseaux 12/15/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Werner Keil 12/15/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Martin Desruisseaux 12/16/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Werner Keil 12/16/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Martin Desruisseaux 12/16/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Werner Keil 12/16/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Werner Keil 12/16/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Martin Desruisseaux 12/16/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Werner Keil 12/16/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Werner Keil 12/16/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Martin Desruisseaux 12/16/2014

[jsr363-experts] Re: Request for clarification on Unit commensurability

Werner Keil 12/16/2014
 
 
Close
loading
Please Confirm
Close