From 0bbf37caaadfe5bbbb33b49e673d8badd44d7dfe Mon Sep 17 00:00:00 2001 From: Werner Keil Date: Wed, 18 Nov 2020 22:00:32 +0100 Subject: [PATCH] # WARNING: head commit changed in the meantime 98: Update JUnit Task-Url: https://github.com/unitsofmeasurement/uom-demos/issues/98 --- .../basic/src/main/java/tech/uom/demo/basic/UnitDemo.java | 2 ++ .../java/tech/uom/demo/systems/ucum/UCUMServiceDemo.java | 8 +++++--- pom.xml | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/console/basic/src/main/java/tech/uom/demo/basic/UnitDemo.java b/console/basic/src/main/java/tech/uom/demo/basic/UnitDemo.java index 3c57977d..e703c086 100644 --- a/console/basic/src/main/java/tech/uom/demo/basic/UnitDemo.java +++ b/console/basic/src/main/java/tech/uom/demo/basic/UnitDemo.java @@ -33,6 +33,7 @@ import javax.measure.quantity.Speed; import javax.measure.quantity.Volume; +import tech.units.indriya.AbstractUnit; import tech.units.indriya.quantity.Quantities; import javax.measure.MetricPrefix; import javax.measure.Quantity; @@ -55,6 +56,7 @@ public static void main(String[] args) { // System.out.println(UCUM.POUND.getName()); System.out.println(Units.KILOGRAM); + //System.out.println(Units.KILOGRAM.isEquivalentTo(AbstractUnit.ONE)); doesn't compile System.out.println(Units.KILOGRAM.getSymbol()); System.out.println(Units.KILOGRAM.getName()); diff --git a/console/systems/ucum/src/main/java/tech/uom/demo/systems/ucum/UCUMServiceDemo.java b/console/systems/ucum/src/main/java/tech/uom/demo/systems/ucum/UCUMServiceDemo.java index 252dc79e..54c73b90 100644 --- a/console/systems/ucum/src/main/java/tech/uom/demo/systems/ucum/UCUMServiceDemo.java +++ b/console/systems/ucum/src/main/java/tech/uom/demo/systems/ucum/UCUMServiceDemo.java @@ -25,12 +25,14 @@ */ package tech.uom.demo.systems.ucum; +import static javax.measure.spi.FormatService.FormatType.UNIT_FORMAT; + import java.util.List; import javax.measure.Unit; import javax.measure.format.UnitFormat; import javax.measure.spi.ServiceProvider; -import javax.measure.spi.UnitFormatService; +import javax.measure.spi.FormatService; public class UCUMServiceDemo { @@ -42,7 +44,7 @@ public static void main(String[] args) { System.out.println(); System.out.println(ServiceProvider.current()); - for (String formatName : ServiceProvider.current().getFormatService().getAvailableFormatNames()) { + for (String formatName : ServiceProvider.current().getFormatService().getAvailableFormatNames(UNIT_FORMAT)) { System.out.println(formatName); } @@ -67,7 +69,7 @@ public static void main(String[] args) { List providers = ServiceProvider.available(); ServiceProvider ucumProvider = providers.get(0); - UnitFormatService ucumFormatService = ucumProvider.getFormatService(); + FormatService ucumFormatService = ucumProvider.getFormatService(); UnitFormat ucumFormatter = ucumFormatService.getUnitFormat("CS"); System.out.println("m3 dimension =" + ucumFormatter.parse("m3").getDimension()); System.out.println("ft3 (wrong) dimension =" + ucumFormatter.parse("ft3").getDimension()); diff --git a/pom.xml b/pom.xml index b19b5066..1d7a3d97 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ tech.uom uom-parent - 2.1-SNAPSHOT + 2.1 tech.uom.demo uom-demos @@ -32,8 +32,8 @@ ${jdkVersion} ${jdkVersion} ${jdkVersion} - 2.1-SNAPSHOT - 2.1-SNAPSHOT + 2.1 + 2.1 2.1-SNAPSHOT 2.1-SNAPSHOT