ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Apples and Oranges (and the Java Units Specification)
Subject:   Additional information on JADE
Date:   2004-01-08 07:12:18
From:   anonymous2
This article is an excellent overview of the JSR-108/units package specification.
Here are additional information regarding JADE’s examples which might be of interest to the readers:
- The digit length of standard quantity output (e.g. 0.1839991624733684 hp•s2/Didot) may surprise some. JADE’s quantities embed automatic error calculations and all digits guaranteed to be exact are written. As quantities lose precision (e.g. due to numeric errors), less digits are written.


- Compatibility between units is based upon the current physical model. The standard model (default) does not allows for conversion between
SI.METER and SI.SECOND but such conversion is allowed with the relativistic model. JADE’s provides five predefined models: Standard, Relativistic, High-Energy, Quantum and Natural. Users may also create their own.


- JADE’ dimension-checking is done in the form of class-type checking (the unit determinates the class of a quantity). In the calcAcceleration example, the return value could also have been written:
return (Acceleration) finalVelocity.subtract(initialVelocity).divide(duration));


- For money, JADE’s provide a sub-class of Unit called Currency for which the exchange rate can be set dynamically.


- Regarding the future, a new version of JADE coming up this week-end will allow a quantity amount to be any “Operable” element. This includes integer values (e.g. LargeInteger) but also vectors (Matrix), complex numbers (Complex), a function (Function) or any class implementing the Operable interface.


Regards.
Jean-Marie Dautelle.


1 to 4 of 4
  1. Additional information on JADE
    2004-03-29 22:58:23  _j_j-solveig [View]

  2. Additional information on JADE
    2004-01-11 09:38:16  anonymous2 [View]

  3. JADE
    2004-01-08 14:20:00  orik [View]

  4. Additional information on JADE
    2004-01-08 13:53:41  anonymous2 [View]

1 to 4 of 4