SlideShare une entreprise Scribd logo
1  sur  40
Eclipse UOMo
Units of Measurement Support for
Java and OSGi
                                             Werner Keil

                          Eclipse Birthday DemoCamp Kaiserslautern
                                            November 24th, 2011




 © 2007-2011 Creative Arts & Technologies
Emphasis
Most of today‟s technologies including the Java
 Language so far lack support for common non-
 trivial Arithmetic problems like Unit Conversions.




3   © 2007-2011 Creative Arts & Technologies
Overview
• Present Situation
       • Historic IT Errors and Bugs
       • Cause of Conversion Errors

• Proposed Changes
       • Type Safety

• Unit Frameworks
       • History
       • Features, Pros and Cons

• UOMo
       • Overview, UCUM, Business

• Demo
• Q&A
4   © 2007-2011 Creative Arts & Technologies
What do these disasters have in common?
• Patriot Missile
  The cause was an inaccurate calculation of the
  time since boot due to a computer arithmetic error.
• Ariane 5 Explosion
  The floating point number which a value was
  converted from had a value greater than what
  would be represented by a 16 bit signed integer.



5   © 2007-2011 Creative Arts & Technologies
What do these disasters have in common?
• Gimli Glider (near disaster)
    Fuel loading was miscalculated through misunderstanding of the
    recently adopted Metric System, replacing the Imperial System
• Mars Orbiter
    Preliminary findings indicate that one team used English units (e.g. inches,
    feet and pounds) while the other used metric units for a key spacecraft
    operation.
       • NASA lost a $125 million Mars orbiter because a Lockheed Martin engineering team used
         English units of measurement while the agency's team used the more conventional metric
         system for a key spacecraft operation
       • This also underlines the added risk when 3 rd party contractors are involved or projects are
         developed Offshore




6   © 2007-2011 Creative Arts & Technologies
NASA “Star Wars” Initiative, 1983
                      23rd March 1983. Ronald Reagan
                      announces SDI (or “Star Wars”): ground-
                      based and space-based systems to
                      protect the US from attack by strategic
                      nuclear ballistic missiles.
1985




  Mirror on underside of   SDI Experiment:
          shuttle
                           The Plan



  Big mountain in Hawaii
1985




       SDI Experiment:
       What really
       happened
1985: What happened?
NASA Mars Climate Orbiter, 1999
Unit Tests wouldn„t find these…
  Despite their name
• All previous example illustrate three categories of
  errors difficult to find through Unit Testing:
       • Interface Errors (e.g. millisecond/second, radian/degree, meters/feet).
       • Arithmetic Errors (e.g. overflow).
       • Conversion Errors.




13   © 2007-2011 Creative Arts & Technologies
Causes of Conversion Errors
• Ambiguity on the unit
       • Gallon Dry / Gallon Liquid
       • Gallon US / Gallon UK
       • Day Sidereal / Day Calendar
       • ...


• Wrong conversion factors:
       static final double PIXEL_TO_INCH = 1 / 72;
       double pixels = inches * PIXEL_TO_INCH




14   © 2007-2011 Creative Arts & Technologies
Present Situation
• Java does not have strongly typed primitive types
  (like e.g. Ada language).
• For performance reasons most developer prefer
  primitive types over objects in their interface.
• Primitives type arguments often lead to name
  clashes (methods with the same signature)




15   © 2007-2011 Creative Arts & Technologies
JSR-275

          Base Classes and Packages
          • Namespace: javax.measure.*
          • Only one interface and one abstract class
                    • Measurable<Q extends Quantity> (interface)
                    • Measure<V, Q extends Quantity> (abstract class)

          • Three sub-packages
                    • unit (holds the SI and NonSI units)
                    • quantity (holds dimensions mass, length)
                    • converter (holds unit converters)

16   © 2007-2011 Creative Arts & Technologies
The King is Dead…

          Units of Measurement API
          • Namespace: org.unitsofmeasurement.*
          • Only interfaces (and exception classes)
                    • public interface Quantity<Q extends Quantity<Q>>
                    • public interface Unit<Q extends Quantity<Q>>

          • Three sub-packages
                    • quantity (holds dimensions mass, length)
                    • unit(holds units)
                    • service (OSGi services)

17   © 2007-2011 Creative Arts & Technologies
Unit-API | Operations


   Results with
   Same Dimension               Different Dimension

   Binary Operations            Binary Operations

   add(double) or (long)        root(int)

   multiply(double) or (long)   power(int)

   divide(double) or (long)     multiply(Unit)

   compound(Unit)               divide(Unit)

   Unary Operations

   inverse()
JSR-256

          Mobile Sensor API
          • Namespace: javax.microediton.sensor*
          • Focusing on Sensors, but it got a minimalistic Unit
            API “in the closet”
                    • Unit
                      Essentially an SI singleton holding relevant unit constants, too.
                    • ChannelInfo
                      Holding name, accuracy, data type,measurement ranges, scale and unit
                    • MeasurementRange
                      Range of possible values from minimum to maximum

19   © 2007-2011 Creative Arts & Technologies
JSR-256

          Sensor States




20   © 2007-2011 Creative Arts & Technologies
JSR-256

          Sensor Groups
          • Context types categorize sensors into three groups:
                    1.        ambient, sensors measuring some ambient property of the environment
                    2.        device, sensors measuring properties related to the device
                    3.        user, sensors measuring some function of the user



          • By using context types, it is possible to find, for example, user-
            related sensors for fitness, or ambient sensors for smart home
            controlling. Although the granularity of this level does not qualify
            the sensors very precisely, still in some cases it provides the
            way to make the distinction, for example, cf. air thermometer
            (ambient) / clinical thermometer (user).


21   © 2007-2011 Creative Arts & Technologies
JSR-256

          Quantity
          • The quantity provides a more precise qualifier. The unit
            and the quantity has a close relation. Some quantities are
            listed in tables of Unit class. When the quantity and context
            type is known, it is often easy to guess the full purpose of
            the sensor. Some examples are given here:
          Quantity: electric_current + context type:
           ambient = sensor measuring electric current,
           amperemeter
          Quantity: catalytic_activity + contex type:
           ambient = sensor measuring catalytic activity

22   © 2007-2011 Creative Arts & Technologies
OSGi

          Measurement Package
          • Namespace: org.osgi.util.measurement
          • SI only Unit API “in the closet”
                    • Unit
                      Essentially an SI singleton holding relevant unit constants, too.
                    • Measurement
                      Represents a value with an error, a unit and a time-stamp.
                    • State
                      Groups a state name, value and timestamp.



23   © 2007-2011 Creative Arts & Technologies
Unit Frameworks




DEMO
Eclipse UOMo

  One Small Step…
Eclipse UOMo

          One Unit Framework to Measure them All
          • Namespace: org.eclipse.uomo.*
          • Two main areas
                    • Static Type Safe Units of Measure Support
                              • Based on Units of Measurement API
                              • On top of ICU4J, the Globalization standard at Eclipse and
                                others (Android, GWT, Google Financial, etc.)
                    • Prime UCUM Implementation
                              • Successor to Eclipse OHF UCUM Bundle

26   © 2007-2011 Creative Arts & Technologies
Eclipse UOMo

          Bundles
          • UOMo currently consists of
                    • UOMo Core
                              • General parts of the framework, reusable components
                    • UOMo Util
                              • Utility classes, Formatting, Date/Time and other ICU4J or Unicode
                                related items
                    • UOMo XML
                              • XMLPull and support for Markup Languages like UnitsML, MathML
                                or SensorML

27   © 2007-2011 Creative Arts & Technologies
Eclipse UOMo

          Bundles (2)
                    • UOMo Units
                              • Based on Units of Measurement API
                    • UOMo UCUM
                              • Unified Code for Units of Measure support
                    • UOMo Business
                              • Business Types and Monetary System



28   © 2007-2011 Creative Arts & Technologies
UOMo Units | System of Units




29   © 2007-2011 Creative Arts & Technologies
UOMo UCUM

          Unified Code for Units of Measure
          • The Unified Code for Units of Measure is a code system
            intended to include all units of measures being
            contemporarily used in international science, engineering,
            and business. The purpose is to facilitate unambiguous
            electronic communication of quantities together with their
            units. The focus is on electronic communication, as
            opposed to communication between humans. A typical
            application of The Unified Code for Units of Measure are
            electronic data interchange (EDI) protocols, but there is
            nothing that prevents it from being used in other types of
            machine communication. How does it relate?

30   © 2007-2011 Creative Arts & Technologies
UOMo UCUM

          Unified Code for Units of Measure
          The Unified Code for Units of Measure is inspired by and
           heavily based on
          • ISO 2955-1983
          • ANSI X3.50-1986
          • HL7's extensions called ISO+



31   © 2007-2011 Creative Arts & Technologies
Eclipse UOMo




  DEMO
UOMo Business | Monetary System


          Monetary systems are part of UOMo Business. This
          illustrates, how easily the Units bundle and underlying Unit-
          API can be extended beyond physical or scientific quantities.
          Such extension can be valuable by leveraging the
          framework‟s capabilities (formatting, conversion,…)
          and applying its usefulness beyond what e.g.
          java.util.Currency now has to offer.




33   © 2007-2011 Creative Arts & Technologies
UOMo Business | Monetary Types




34   © 2007-2011 Creative Arts & Technologies
UOMo Business | Money Demo (1)

          We‟ll extend MoneyDemo to show fuel costs in Indian Rupees.
          First by adding a new currency to MonetarySystem.

         // Use currency not defined as constant (Indian Rupee).
         public static final DerivedUnit<Money> INR = monetary(
         new Currency(„INR„));


         Then add this line to MoneyDemo.
         (also change static import to MonetarySystem.*;   )

         UnitFormat.getInstance().label(INR, „Rp");


35   © 2007-2011 Creative Arts & Technologies
UOMo Business | Money Demo (2)

            Next set the Exchange Rate for Rp.
          ((Currency) INR).setExchangeRate(0.022); // 1.0Rp = ~0.022 $

          Note, the explicit cast is required here, because getUnits() in
          SystemOfUnits currently requires a neutral <?> generic
          collection type.




36   © 2007-2011 Creative Arts & Technologies
UOMo Business | Money Demo (3)

          Then we add the following line to the “Display
          cost.” section of MoneyDemo
         System.out.println("Trip cost = " + tripCost + " (" +
         tripCost.to(INR) + ")");



         Resulting in the additional output:
         Trip cost = 87.50 $ (3977.26 Rp)




37   © 2007-2011 Creative Arts & Technologies
UOMo Business | Trading Example
           What happens, if we use built in java.util.Currency and Standard JSP formats




38   © 2007-2011 Creative Arts & Technologies
UOMo Business




  DEMO
Links

   Eclipse – Project UOMo
   http://www.eclipse.org/uomo/


   Units of Measurement API
   http://www.unitsofmeasurement.org


   UCUM
   http://www.unitsofmeasure.org
Let„s talk

Q&A
Contact

          werner@catmedia.us
                   or
          uomo@catmedia.us


          Twitter: @wernerkeil
          Hashtag #EclipseUOMo

Contenu connexe

Similaire à Eclipse UOMo

M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)Werner Keil
 
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013Werner Keil
 
Mr. Keil Werner - UOMO 2011
Mr. Keil Werner - UOMO 2011Mr. Keil Werner - UOMO 2011
Mr. Keil Werner - UOMO 2011beloslab
 
M2M, Sensor Web, Observations and Measurements
M2M, Sensor Web, Observations and MeasurementsM2M, Sensor Web, Observations and Measurements
M2M, Sensor Web, Observations and MeasurementsWerner Keil
 
The Quantified UOMo - Eclipse DemoCamp Trondheim 2015
The Quantified UOMo - Eclipse DemoCamp Trondheim 2015The Quantified UOMo - Eclipse DemoCamp Trondheim 2015
The Quantified UOMo - Eclipse DemoCamp Trondheim 2015Werner Keil
 
ETSI TC MTS Contribution to Testing in IoT and Edge Computing
ETSI TC MTS Contribution to Testing in IoT and Edge ComputingETSI TC MTS Contribution to Testing in IoT and Edge Computing
ETSI TC MTS Contribution to Testing in IoT and Edge ComputingAxel Rennoch
 
Module 1 Lec 1-6- WSN-EC6128.pdf
Module 1 Lec 1-6- WSN-EC6128.pdfModule 1 Lec 1-6- WSN-EC6128.pdf
Module 1 Lec 1-6- WSN-EC6128.pdfShreyaPandey184291
 
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...Laurent Lefort
 
Technology Insertion: A Well-Grounded Approach to Implementing Out of this Wo...
Technology Insertion: A Well-Grounded Approach to Implementing Out of this Wo...Technology Insertion: A Well-Grounded Approach to Implementing Out of this Wo...
Technology Insertion: A Well-Grounded Approach to Implementing Out of this Wo...Society of Women Engineers
 
Opees Presentation May 2011
Opees Presentation May 2011Opees Presentation May 2011
Opees Presentation May 2011Gaël Blondelle
 
OpenSees: Future Directions
OpenSees: Future DirectionsOpenSees: Future Directions
OpenSees: Future Directionsopenseesdays
 
Emerging standards and support organizations within engineering simulation
Emerging standards and support organizations within engineering simulation Emerging standards and support organizations within engineering simulation
Emerging standards and support organizations within engineering simulation Modelon
 
Michael_K_Bartosewcz_September_2015_resume
Michael_K_Bartosewcz_September_2015_resumeMichael_K_Bartosewcz_September_2015_resume
Michael_K_Bartosewcz_September_2015_resumeMike (Bart) Bartosewcz
 
200923 01en
200923 01en200923 01en
200923 01enopenrtm
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in developmentMartin Toshev
 
DSL, Gfast and Wireless Test Software: Test Sentinel
DSL, Gfast and Wireless Test Software: Test SentinelDSL, Gfast and Wireless Test Software: Test Sentinel
DSL, Gfast and Wireless Test Software: Test SentinelUNH InterOperability Lab
 
Modeling and Simulation of Electrical Power Systems using OpenIPSL.org and Gr...
Modeling and Simulation of Electrical Power Systems using OpenIPSL.org and Gr...Modeling and Simulation of Electrical Power Systems using OpenIPSL.org and Gr...
Modeling and Simulation of Electrical Power Systems using OpenIPSL.org and Gr...Luigi Vanfretti
 
Introducing the Civil Infrastructure Platform
Introducing the Civil Infrastructure PlatformIntroducing the Civil Infrastructure Platform
Introducing the Civil Infrastructure PlatformYoshitake Kobayashi
 

Similaire à Eclipse UOMo (20)

M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
M4M 2 the Rescue of M2M (Eclipse DemoCamp Trondheim)
 
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
M4M 2 the Rescue of M2M - Eclipse DemoCamps Fall 2013
 
Mr. Keil Werner - UOMO 2011
Mr. Keil Werner - UOMO 2011Mr. Keil Werner - UOMO 2011
Mr. Keil Werner - UOMO 2011
 
The OHF Legacy
The OHF LegacyThe OHF Legacy
The OHF Legacy
 
M2M, Sensor Web, Observations and Measurements
M2M, Sensor Web, Observations and MeasurementsM2M, Sensor Web, Observations and Measurements
M2M, Sensor Web, Observations and Measurements
 
Type-safe DSLs
Type-safe DSLsType-safe DSLs
Type-safe DSLs
 
The Quantified UOMo - Eclipse DemoCamp Trondheim 2015
The Quantified UOMo - Eclipse DemoCamp Trondheim 2015The Quantified UOMo - Eclipse DemoCamp Trondheim 2015
The Quantified UOMo - Eclipse DemoCamp Trondheim 2015
 
ETSI TC MTS Contribution to Testing in IoT and Edge Computing
ETSI TC MTS Contribution to Testing in IoT and Edge ComputingETSI TC MTS Contribution to Testing in IoT and Edge Computing
ETSI TC MTS Contribution to Testing in IoT and Edge Computing
 
Module 1 Lec 1-6- WSN-EC6128.pdf
Module 1 Lec 1-6- WSN-EC6128.pdfModule 1 Lec 1-6- WSN-EC6128.pdf
Module 1 Lec 1-6- WSN-EC6128.pdf
 
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
Semantically-Enabling the Web of Things: The W3C Semantic Sensor Network Onto...
 
Technology Insertion: A Well-Grounded Approach to Implementing Out of this Wo...
Technology Insertion: A Well-Grounded Approach to Implementing Out of this Wo...Technology Insertion: A Well-Grounded Approach to Implementing Out of this Wo...
Technology Insertion: A Well-Grounded Approach to Implementing Out of this Wo...
 
Opees Presentation May 2011
Opees Presentation May 2011Opees Presentation May 2011
Opees Presentation May 2011
 
OpenSees: Future Directions
OpenSees: Future DirectionsOpenSees: Future Directions
OpenSees: Future Directions
 
Emerging standards and support organizations within engineering simulation
Emerging standards and support organizations within engineering simulation Emerging standards and support organizations within engineering simulation
Emerging standards and support organizations within engineering simulation
 
Michael_K_Bartosewcz_September_2015_resume
Michael_K_Bartosewcz_September_2015_resumeMichael_K_Bartosewcz_September_2015_resume
Michael_K_Bartosewcz_September_2015_resume
 
200923 01en
200923 01en200923 01en
200923 01en
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in development
 
DSL, Gfast and Wireless Test Software: Test Sentinel
DSL, Gfast and Wireless Test Software: Test SentinelDSL, Gfast and Wireless Test Software: Test Sentinel
DSL, Gfast and Wireless Test Software: Test Sentinel
 
Modeling and Simulation of Electrical Power Systems using OpenIPSL.org and Gr...
Modeling and Simulation of Electrical Power Systems using OpenIPSL.org and Gr...Modeling and Simulation of Electrical Power Systems using OpenIPSL.org and Gr...
Modeling and Simulation of Electrical Power Systems using OpenIPSL.org and Gr...
 
Introducing the Civil Infrastructure Platform
Introducing the Civil Infrastructure PlatformIntroducing the Civil Infrastructure Platform
Introducing the Civil Infrastructure Platform
 

Plus de Werner Keil

Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21Werner Keil
 
OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021Werner Keil
 
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021Werner Keil
 
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 VirtualOpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 VirtualWerner Keil
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualWerner Keil
 
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDRJCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDRWerner Keil
 
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020Werner Keil
 
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)Werner Keil
 
Money, Money, Money, can be funny with JSR 354 (DWX 2019)
Money, Money, Money, can be funny with JSR 354 (DWX 2019)Money, Money, Money, can be funny with JSR 354 (DWX 2019)
Money, Money, Money, can be funny with JSR 354 (DWX 2019)Werner Keil
 
NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)Werner Keil
 
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR DayHow JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR DayWerner Keil
 
JNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesJNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesWerner Keil
 
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL DatabasesEclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL DatabasesWerner Keil
 
Physikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG MunichPhysikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG MunichWerner Keil
 
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017Werner Keil
 
Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Werner Keil
 
Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Werner Keil
 
Java2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the CloudJava2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the CloudWerner Keil
 
Apache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartApache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartWerner Keil
 
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-BrandenburgThe First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-BrandenburgWerner Keil
 

Plus de Werner Keil (20)

Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21
 
OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021
 
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
 
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 VirtualOpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 Virtual
 
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDRJCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
 
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
 
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
Money, Money, Money, can be funny with JSR 354 (Devoxx BE)
 
Money, Money, Money, can be funny with JSR 354 (DWX 2019)
Money, Money, Money, can be funny with JSR 354 (DWX 2019)Money, Money, Money, can be funny with JSR 354 (DWX 2019)
Money, Money, Money, can be funny with JSR 354 (DWX 2019)
 
NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)
 
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR DayHow JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
 
JNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesJNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL Databases
 
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL DatabasesEclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
 
Physikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG MunichPhysikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG Munich
 
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
 
Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017
 
Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363
 
Java2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the CloudJava2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the Cloud
 
Apache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartApache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ Stuttgart
 
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-BrandenburgThe First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
 

Dernier

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Dernier (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Eclipse UOMo

  • 1. Eclipse UOMo Units of Measurement Support for Java and OSGi Werner Keil Eclipse Birthday DemoCamp Kaiserslautern November 24th, 2011 © 2007-2011 Creative Arts & Technologies
  • 2. Emphasis Most of today‟s technologies including the Java Language so far lack support for common non- trivial Arithmetic problems like Unit Conversions. 3 © 2007-2011 Creative Arts & Technologies
  • 3. Overview • Present Situation • Historic IT Errors and Bugs • Cause of Conversion Errors • Proposed Changes • Type Safety • Unit Frameworks • History • Features, Pros and Cons • UOMo • Overview, UCUM, Business • Demo • Q&A 4 © 2007-2011 Creative Arts & Technologies
  • 4. What do these disasters have in common? • Patriot Missile The cause was an inaccurate calculation of the time since boot due to a computer arithmetic error. • Ariane 5 Explosion The floating point number which a value was converted from had a value greater than what would be represented by a 16 bit signed integer. 5 © 2007-2011 Creative Arts & Technologies
  • 5. What do these disasters have in common? • Gimli Glider (near disaster) Fuel loading was miscalculated through misunderstanding of the recently adopted Metric System, replacing the Imperial System • Mars Orbiter Preliminary findings indicate that one team used English units (e.g. inches, feet and pounds) while the other used metric units for a key spacecraft operation. • NASA lost a $125 million Mars orbiter because a Lockheed Martin engineering team used English units of measurement while the agency's team used the more conventional metric system for a key spacecraft operation • This also underlines the added risk when 3 rd party contractors are involved or projects are developed Offshore 6 © 2007-2011 Creative Arts & Technologies
  • 6. NASA “Star Wars” Initiative, 1983 23rd March 1983. Ronald Reagan announces SDI (or “Star Wars”): ground- based and space-based systems to protect the US from attack by strategic nuclear ballistic missiles.
  • 7. 1985 Mirror on underside of SDI Experiment: shuttle The Plan Big mountain in Hawaii
  • 8. 1985 SDI Experiment: What really happened
  • 10. NASA Mars Climate Orbiter, 1999
  • 11. Unit Tests wouldn„t find these… Despite their name • All previous example illustrate three categories of errors difficult to find through Unit Testing: • Interface Errors (e.g. millisecond/second, radian/degree, meters/feet). • Arithmetic Errors (e.g. overflow). • Conversion Errors. 13 © 2007-2011 Creative Arts & Technologies
  • 12. Causes of Conversion Errors • Ambiguity on the unit • Gallon Dry / Gallon Liquid • Gallon US / Gallon UK • Day Sidereal / Day Calendar • ... • Wrong conversion factors: static final double PIXEL_TO_INCH = 1 / 72; double pixels = inches * PIXEL_TO_INCH 14 © 2007-2011 Creative Arts & Technologies
  • 13. Present Situation • Java does not have strongly typed primitive types (like e.g. Ada language). • For performance reasons most developer prefer primitive types over objects in their interface. • Primitives type arguments often lead to name clashes (methods with the same signature) 15 © 2007-2011 Creative Arts & Technologies
  • 14. JSR-275 Base Classes and Packages • Namespace: javax.measure.* • Only one interface and one abstract class • Measurable<Q extends Quantity> (interface) • Measure<V, Q extends Quantity> (abstract class) • Three sub-packages • unit (holds the SI and NonSI units) • quantity (holds dimensions mass, length) • converter (holds unit converters) 16 © 2007-2011 Creative Arts & Technologies
  • 15. The King is Dead… Units of Measurement API • Namespace: org.unitsofmeasurement.* • Only interfaces (and exception classes) • public interface Quantity<Q extends Quantity<Q>> • public interface Unit<Q extends Quantity<Q>> • Three sub-packages • quantity (holds dimensions mass, length) • unit(holds units) • service (OSGi services) 17 © 2007-2011 Creative Arts & Technologies
  • 16. Unit-API | Operations Results with Same Dimension Different Dimension Binary Operations Binary Operations add(double) or (long) root(int) multiply(double) or (long) power(int) divide(double) or (long) multiply(Unit) compound(Unit) divide(Unit) Unary Operations inverse()
  • 17. JSR-256 Mobile Sensor API • Namespace: javax.microediton.sensor* • Focusing on Sensors, but it got a minimalistic Unit API “in the closet” • Unit Essentially an SI singleton holding relevant unit constants, too. • ChannelInfo Holding name, accuracy, data type,measurement ranges, scale and unit • MeasurementRange Range of possible values from minimum to maximum 19 © 2007-2011 Creative Arts & Technologies
  • 18. JSR-256 Sensor States 20 © 2007-2011 Creative Arts & Technologies
  • 19. JSR-256 Sensor Groups • Context types categorize sensors into three groups: 1. ambient, sensors measuring some ambient property of the environment 2. device, sensors measuring properties related to the device 3. user, sensors measuring some function of the user • By using context types, it is possible to find, for example, user- related sensors for fitness, or ambient sensors for smart home controlling. Although the granularity of this level does not qualify the sensors very precisely, still in some cases it provides the way to make the distinction, for example, cf. air thermometer (ambient) / clinical thermometer (user). 21 © 2007-2011 Creative Arts & Technologies
  • 20. JSR-256 Quantity • The quantity provides a more precise qualifier. The unit and the quantity has a close relation. Some quantities are listed in tables of Unit class. When the quantity and context type is known, it is often easy to guess the full purpose of the sensor. Some examples are given here: Quantity: electric_current + context type: ambient = sensor measuring electric current, amperemeter Quantity: catalytic_activity + contex type: ambient = sensor measuring catalytic activity 22 © 2007-2011 Creative Arts & Technologies
  • 21. OSGi Measurement Package • Namespace: org.osgi.util.measurement • SI only Unit API “in the closet” • Unit Essentially an SI singleton holding relevant unit constants, too. • Measurement Represents a value with an error, a unit and a time-stamp. • State Groups a state name, value and timestamp. 23 © 2007-2011 Creative Arts & Technologies
  • 23. Eclipse UOMo One Small Step…
  • 24. Eclipse UOMo One Unit Framework to Measure them All • Namespace: org.eclipse.uomo.* • Two main areas • Static Type Safe Units of Measure Support • Based on Units of Measurement API • On top of ICU4J, the Globalization standard at Eclipse and others (Android, GWT, Google Financial, etc.) • Prime UCUM Implementation • Successor to Eclipse OHF UCUM Bundle 26 © 2007-2011 Creative Arts & Technologies
  • 25. Eclipse UOMo Bundles • UOMo currently consists of • UOMo Core • General parts of the framework, reusable components • UOMo Util • Utility classes, Formatting, Date/Time and other ICU4J or Unicode related items • UOMo XML • XMLPull and support for Markup Languages like UnitsML, MathML or SensorML 27 © 2007-2011 Creative Arts & Technologies
  • 26. Eclipse UOMo Bundles (2) • UOMo Units • Based on Units of Measurement API • UOMo UCUM • Unified Code for Units of Measure support • UOMo Business • Business Types and Monetary System 28 © 2007-2011 Creative Arts & Technologies
  • 27. UOMo Units | System of Units 29 © 2007-2011 Creative Arts & Technologies
  • 28. UOMo UCUM Unified Code for Units of Measure • The Unified Code for Units of Measure is a code system intended to include all units of measures being contemporarily used in international science, engineering, and business. The purpose is to facilitate unambiguous electronic communication of quantities together with their units. The focus is on electronic communication, as opposed to communication between humans. A typical application of The Unified Code for Units of Measure are electronic data interchange (EDI) protocols, but there is nothing that prevents it from being used in other types of machine communication. How does it relate? 30 © 2007-2011 Creative Arts & Technologies
  • 29. UOMo UCUM Unified Code for Units of Measure The Unified Code for Units of Measure is inspired by and heavily based on • ISO 2955-1983 • ANSI X3.50-1986 • HL7's extensions called ISO+ 31 © 2007-2011 Creative Arts & Technologies
  • 30. Eclipse UOMo DEMO
  • 31. UOMo Business | Monetary System Monetary systems are part of UOMo Business. This illustrates, how easily the Units bundle and underlying Unit- API can be extended beyond physical or scientific quantities. Such extension can be valuable by leveraging the framework‟s capabilities (formatting, conversion,…) and applying its usefulness beyond what e.g. java.util.Currency now has to offer. 33 © 2007-2011 Creative Arts & Technologies
  • 32. UOMo Business | Monetary Types 34 © 2007-2011 Creative Arts & Technologies
  • 33. UOMo Business | Money Demo (1) We‟ll extend MoneyDemo to show fuel costs in Indian Rupees. First by adding a new currency to MonetarySystem. // Use currency not defined as constant (Indian Rupee). public static final DerivedUnit<Money> INR = monetary( new Currency(„INR„)); Then add this line to MoneyDemo. (also change static import to MonetarySystem.*; ) UnitFormat.getInstance().label(INR, „Rp"); 35 © 2007-2011 Creative Arts & Technologies
  • 34. UOMo Business | Money Demo (2) Next set the Exchange Rate for Rp. ((Currency) INR).setExchangeRate(0.022); // 1.0Rp = ~0.022 $ Note, the explicit cast is required here, because getUnits() in SystemOfUnits currently requires a neutral <?> generic collection type. 36 © 2007-2011 Creative Arts & Technologies
  • 35. UOMo Business | Money Demo (3) Then we add the following line to the “Display cost.” section of MoneyDemo System.out.println("Trip cost = " + tripCost + " (" + tripCost.to(INR) + ")"); Resulting in the additional output: Trip cost = 87.50 $ (3977.26 Rp) 37 © 2007-2011 Creative Arts & Technologies
  • 36. UOMo Business | Trading Example What happens, if we use built in java.util.Currency and Standard JSP formats 38 © 2007-2011 Creative Arts & Technologies
  • 38. Links Eclipse – Project UOMo http://www.eclipse.org/uomo/ Units of Measurement API http://www.unitsofmeasurement.org UCUM http://www.unitsofmeasure.org
  • 40. Contact werner@catmedia.us or uomo@catmedia.us Twitter: @wernerkeil Hashtag #EclipseUOMo