Skip to content

Commit

Permalink
200: Update UCUM formatting of new SI prefixes
Browse files Browse the repository at this point in the history
Task-Url: #200
  • Loading branch information
keilw committed Aug 18, 2024
1 parent 71b8fa5 commit a1df3c6
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 18 additions & 0 deletions ci-toolchains.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,22 @@
<jdkHome>JDK_home</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
</provides>
<configuration>
<jdkHome>JDK_home</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>21</version>
</provides>
<configuration>
<jdkHome>JDK_home</jdkHome>
</configuration>
</toolchain>
</toolchains>
2 changes: 1 addition & 1 deletion src/main/config/uom-systems clean install.launch
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:systems-parent}"/>
</launchConfiguration>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
#
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
#
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions ucum/src/test/java/systems/uom/ucum/PrefixTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

public class UnitFormatPrefixTest extends UCUMFormatTestBase {

// Metric Prefixes

@Test
public void testKiloMeter() {
Unit<Length> m1 = KILO(METER);
Expand Down Expand Up @@ -75,7 +77,21 @@ public void testNanoGram() {
Unit<Mass> m1 = NANO(GRAM);
assertEquals("ng", FORMAT_PRINT.format(m1));
}

@Test
public void testQuettabit() {
Unit<Information> i1 = QUETTA(BIT);
assertEquals("Qbit", FORMAT_PRINT.format(i1));
}

@Test
public void testRontoGram() {
Unit<Mass> m1 = RONTO(GRAM);
assertEquals("rg", FORMAT_PRINT.format(m1));
}

// Binary Prefixes

@Test
public void testGibiMeter() {
Unit<Length> m1 = GIBI(METER);
Expand Down

0 comments on commit a1df3c6

Please sign in to comment.