Skip to content

Commit

Permalink
97: Update CO2CarDemo based on CLDR
Browse files Browse the repository at this point in the history
Task-Url: #97
  • Loading branch information
keilw committed Dec 7, 2020
1 parent b156140 commit 42528aa
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 18 deletions.
30 changes: 15 additions & 15 deletions console/java13/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,21 @@
<target>${jdkVersion}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>tech.uom.demo.java13.format.UnitFormatDemo</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>tech.uom.demo.java13.format.UnitFormatDemo</mainClass>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
22 changes: 19 additions & 3 deletions console/systems/ucum-java12/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<version>2.1-SNAPSHOT</version>
</parent>
<artifactId>uom-console-demos-ucum-java12</artifactId>

<name>UCUM Console Demos for Java 12</name>

<!-- ======================================================= -->
<!-- Build Settings -->
<!-- ======================================================= -->
Expand All @@ -29,10 +30,9 @@
</dependency>
<dependency>
<groupId>systems.uom</groupId>
<artifactId>systems-common</artifactId>
<artifactId>systems-common</artifactId>
</dependency>
</dependencies>
<name>UCUM Console Demos for Java 12</name>

<build>
<plugins>
Expand Down Expand Up @@ -65,6 +65,22 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>tech.uom.demo.systems.ucum.UCUMFormatDemo</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@
*/
package tech.uom.demo.systems.ucum;

import static javax.measure.MetricPrefix.KILO;
import static systems.uom.ucum.UCUM.*;

import javax.measure.quantity.Force;
import javax.measure.quantity.Pressure;
import javax.measure.spi.ServiceProvider;

import systems.uom.ucum.UCUM;
import tech.units.indriya.format.SimpleUnitFormat;
import tech.units.indriya.format.EBNFUnitFormat;
import javax.measure.MetricPrefix;
import javax.measure.Unit;

import tech.units.indriya.unit.Units;

Expand Down Expand Up @@ -104,5 +108,13 @@ public static void main(String[] args) {
System.out.println("Formating (CI): " + ucumFormatCI.format(yd));
System.out.println("Formating (Print): " + ucumFormatCS.format(yd));
System.out.println("Formating: " + ucumFormatPrint.format(yd));

final var newton = KILO(UCUM.GRAM).multiply(UCUM.METER).divide(UCUM.SECOND).divide(UCUM.SECOND).asType(Force.class);
System.out.println("Formating (Print): " + ucumFormatCS.format(newton));
System.out.println("Is equivalent to NEWTON: " + Units.NEWTON.isEquivalentTo(newton));

final var u = UCUM.METER.divide(UCUM.SECOND).divide(UCUM.SECOND);
System.out.println(String.format("Formating (%s): %s",
ucumFormatCS.toString(), ucumFormatCS.format(u)));
}
}
1 change: 1 addition & 0 deletions src/etc/uom-console-demos-java13 exec.launch
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<stringAttribute key="M2_USER_SETTINGS" value=""/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" 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-13"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/uom-console-demos-java13}"/>
Expand Down

0 comments on commit 42528aa

Please sign in to comment.