From a1df3c6c62e538d317794bb4cdf8a04d079f415e Mon Sep 17 00:00:00 2001 From: Werner Keil Date: Sun, 18 Aug 2024 19:25:16 +0200 Subject: [PATCH] 200: Update UCUM formatting of new SI prefixes Task-Url: https://github.com/unitsofmeasurement/uom-systems/issues/200 --- LICENSE | 2 +- ci-toolchains.xml | 18 ++++++++++++++++++ .../config/uom-systems clean install.launch | 2 +- .../uom/ucum/format/UCUMFormat_CI.properties | 4 ++++ .../uom/ucum/format/UCUMFormat_CS.properties | 6 +++++- .../ucum/format/UCUMFormat_Print.properties | 7 +++++-- .../uom/ucum/format/ext/messages.properties | 2 ++ .../test/java/systems/uom/ucum/PrefixTest.java | 6 ++++++ .../uom/ucum/format/UnitFormatPrefixTest.java | 16 ++++++++++++++++ 9 files changed, 58 insertions(+), 5 deletions(-) diff --git a/LICENSE b/LICENSE index 9d5141f4..e3397efb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2005-2021, Jean-Marie Dautelle, Werner Keil and others +Copyright (c) 2005-2024, Jean-Marie Dautelle, Werner Keil and others All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/ci-toolchains.xml b/ci-toolchains.xml index 61f4e04c..7fe7b8ed 100644 --- a/ci-toolchains.xml +++ b/ci-toolchains.xml @@ -44,4 +44,22 @@ JDK_home + + jdk + + 17 + + + JDK_home + + + + jdk + + 21 + + + JDK_home + + \ No newline at end of file diff --git a/src/main/config/uom-systems clean install.launch b/src/main/config/uom-systems clean install.launch index a554cbaa..2c329372 100644 --- a/src/main/config/uom-systems clean install.launch +++ b/src/main/config/uom-systems clean install.launch @@ -21,6 +21,6 @@ - + diff --git a/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_CI.properties b/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_CI.properties index 01bb1c4b..4dd38e1c 100644 --- a/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_CI.properties +++ b/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_CI.properties @@ -301,6 +301,10 @@ javax.measure.MetricPrefix.FEMTO = F javax.measure.MetricPrefix.ATTO = A javax.measure.MetricPrefix.ZEPTO = ZO javax.measure.MetricPrefix.YOCTO = YO +javax.measure.MetricPrefix.QUETTA = QA +javax.measure.MetricPrefix.RONNA = RA +javax.measure.MetricPrefix.QUECTO = QO +javax.measure.MetricPrefix.RONTO = RO # Binary Prefixes javax.measure.BinaryPrefix.KIBI = KI diff --git a/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_CS.properties b/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_CS.properties index 0ba1bfa8..6e9014c5 100644 --- a/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_CS.properties +++ b/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_CS.properties @@ -1,6 +1,6 @@ # # Unit-API - Units of Measurement API for Java -# Copyright (c) 2005-2020, Jean-Marie Dautelle, Werner Keil and others. +# Copyright (c) 2005-2024, Jean-Marie Dautelle, Werner Keil and others. # # All rights reserved. # @@ -302,6 +302,10 @@ javax.measure.MetricPrefix.FEMTO = f javax.measure.MetricPrefix.ATTO = a javax.measure.MetricPrefix.ZEPTO = z javax.measure.MetricPrefix.YOCTO = y +javax.measure.MetricPrefix.QUETTA = Q +javax.measure.MetricPrefix.RONNA = R +javax.measure.MetricPrefix.QUECTO = q +javax.measure.MetricPrefix.RONTO = r # Binary Prefixes javax.measure.BinaryPrefix.KIBI = Ki diff --git a/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_Print.properties b/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_Print.properties index ccc22db7..6b2a5e3a 100644 --- a/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_Print.properties +++ b/ucum/src/main/resources/systems/uom/ucum/format/UCUMFormat_Print.properties @@ -1,6 +1,6 @@ # # Units of Measurement Systems for Java -# Copyright (c) 2005-2020, Jean-Marie Dautelle, Werner Keil and others. +# Copyright (c) 2005-2024, Jean-Marie Dautelle, Werner Keil and others. # # All rights reserved. # @@ -302,7 +302,10 @@ javax.measure.MetricPrefix.FEMTO = f javax.measure.MetricPrefix.ATTO = a javax.measure.MetricPrefix.ZEPTO = z javax.measure.MetricPrefix.YOCTO = y - +javax.measure.MetricPrefix.QUETTA = Q +javax.measure.MetricPrefix.RONNA = R +javax.measure.MetricPrefix.QUECTO = q +javax.measure.MetricPrefix.RONTO = r # Binary Prefixes javax.measure.BinaryPrefix.KIBI = Ki javax.measure.BinaryPrefix.MEBI = Mi diff --git a/ucum/src/main/resources/systems/uom/ucum/format/ext/messages.properties b/ucum/src/main/resources/systems/uom/ucum/format/ext/messages.properties index 6cc82211..5718b9ce 100644 --- a/ucum/src/main/resources/systems/uom/ucum/format/ext/messages.properties +++ b/ucum/src/main/resources/systems/uom/ucum/format/ext/messages.properties @@ -258,4 +258,6 @@ systems.uom.ucum.UCUM.PH=pH systems.uom.ucum.UCUM.GRAM_PERCENT=g% systems.uom.ucum.UCUM.PERIPHERAL_VASCULAR_RESISTANCE=P.R.U. +# Common Units (defined by implementation) +tech.units.indriya.unit.Units.KILOMETRE_PER_HOUR = kph tech.units.indriya.unit.Units.YEAR.1 = year \ No newline at end of file diff --git a/ucum/src/test/java/systems/uom/ucum/PrefixTest.java b/ucum/src/test/java/systems/uom/ucum/PrefixTest.java index 84404422..b01dfb61 100644 --- a/ucum/src/test/java/systems/uom/ucum/PrefixTest.java +++ b/ucum/src/test/java/systems/uom/ucum/PrefixTest.java @@ -52,4 +52,10 @@ public void testBetweenPrefixes2() { UnitConverter conv = KILO(METER).getConverterTo(GIGA(METER)); assertEquals(MultiplyConverter.ofTenExponent(-6), conv); } + + @Test + public void testBetweenPrefixes3() { + UnitConverter conv = QUETTA(METER).getConverterTo(RONNA(METER)); + assertEquals(MultiplyConverter.ofTenExponent(3), conv); + } } diff --git a/ucum/src/test/java/systems/uom/ucum/format/UnitFormatPrefixTest.java b/ucum/src/test/java/systems/uom/ucum/format/UnitFormatPrefixTest.java index 2f577928..a72bf093 100644 --- a/ucum/src/test/java/systems/uom/ucum/format/UnitFormatPrefixTest.java +++ b/ucum/src/test/java/systems/uom/ucum/format/UnitFormatPrefixTest.java @@ -45,6 +45,8 @@ public class UnitFormatPrefixTest extends UCUMFormatTestBase { + // Metric Prefixes + @Test public void testKiloMeter() { Unit m1 = KILO(METER); @@ -75,7 +77,21 @@ public void testNanoGram() { Unit m1 = NANO(GRAM); assertEquals("ng", FORMAT_PRINT.format(m1)); } + + @Test + public void testQuettabit() { + Unit i1 = QUETTA(BIT); + assertEquals("Qbit", FORMAT_PRINT.format(i1)); + } + + @Test + public void testRontoGram() { + Unit m1 = RONTO(GRAM); + assertEquals("rg", FORMAT_PRINT.format(m1)); + } + // Binary Prefixes + @Test public void testGibiMeter() { Unit m1 = GIBI(METER);