unitsofmeasurement / indriya

JSR 385 - Reference Implementation
Other
122 stars 42 forks source link

Adding the Mathematica/Wolfram examples showcasing 'Temperature Units'. #164

Closed andi-huber closed 5 years ago

andi-huber commented 5 years ago

It might help the discussion on 'AbsoluteVsRelative' [1] to actually have some Java code to play around with.

Note: there are 3 TODO markers, where Indryia does things differently than Mathematica does.

[1] https://github.com/unitsofmeasurement/unit-api/issues/140


This change is Reviewable

dautelle commented 5 years ago

Thank you andi-huber, the Wolfram article made me change my mind. It is elegant and makes senses mathematically (indeed Wolfram is a reference for that matter). For the user, it is quite simple, there can be a property in Unit (e.g. isDifference()) and a few additional units (e.g. CELSIUS_DIFF, FAHRENHEIT_DIFF). Of course, some quantity operations will not be allowed (e.g. adding quantity in CELSIUS and quantity in FAHRENHEIT not allowed, but adding quantity in CELSIUS_DIFF and quantity in FAHRENHEIT_DIFF allowed).