Skip to content

Commit

Permalink
Translate Hurricane Demo
Browse files Browse the repository at this point in the history
  • Loading branch information
keilw committed Dec 9, 2022
1 parent fd1010c commit 2eef460
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 272 deletions.
5 changes: 4 additions & 1 deletion console/systems/common-java12/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
<groupId>tech.uom.lib</groupId>
<artifactId>uom-lib-common</artifactId>
</dependency>

<dependency>
<groupId>tech.uom.domain</groupId>
<artifactId>uom-weather</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion console/systems/common-java12/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Units of Measurement Console Demos
* Copyright (c) 2005-2020, Werner Keil and others.
* Copyright (c) 2005-2022, Werner Keil and others.
*
* All rights reserved.
*
Expand Down Expand Up @@ -30,6 +30,7 @@
requires transitive tech.units.indriya;
requires transitive systems.uom.quantity;
requires systems.uom.common;
requires tech.uom.domain.weather;

exports tech.uom.demo.systems.common;
exports tech.uom.demo.systems.common.types;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@

import static javax.measure.MetricPrefix.KILO;
import static tech.units.indriya.unit.Units.METRE;
import static tech.uom.demo.systems.common.types.SaffirSimpsonHurricaneWindScale.Category.FIVE;
import static tech.uom.demo.systems.common.types.SaffirSimpsonHurricaneWindScale.Category.FOUR;
import static tech.uom.demo.systems.common.types.SaffirSimpsonHurricaneWindScale.Category.ONE;
import static tech.uom.demo.systems.common.types.SaffirSimpsonHurricaneWindScale.Category.THREE;
import static tech.uom.demo.systems.common.types.SaffirSimpsonHurricaneWindScale.Category.TROPICAL_DEPRESSION;
import static tech.uom.demo.systems.common.types.SaffirSimpsonHurricaneWindScale.Category.TROPICAL_STORM;
import static tech.uom.demo.systems.common.types.SaffirSimpsonHurricaneWindScale.Category.TWO;
import static tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale.Category.FIVE;
import static tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale.Category.FOUR;
import static tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale.Category.ONE;
import static tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale.Category.THREE;
import static tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale.Category.TROPICAL_DEPRESSION;
import static tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale.Category.TROPICAL_STORM;
import static tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale.Category.TWO;
import static systems.uom.common.USCustomary.MILE_PER_HOUR;
import static tech.units.indriya.quantity.Quantities.getQuantity;
import static tech.units.indriya.unit.Units.KILOMETRE_PER_HOUR;

import javax.measure.quantity.Time;

import tech.units.indriya.format.SimpleUnitFormat;
import tech.uom.demo.systems.common.types.SaffirSimpsonHurricaneWindScale;
import tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale;

/**
* @author Werner Keil
* @version 1.2
* @version 2.2
* @see {@link SaffirSimpsonHurricaneWindScale}
*/
public class ThePerfectStorm {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ThePerfectStorm.3=Le temps d'évacuer: %s
ThePerfectStorm.4=Pas d'échelle donnée.
SaffirSimpsonHurricaneWindScale.TROPICAL_DEPRESSION=Dépression tropicale
SaffirSimpsonHurricaneWindScale.TROPICAL_STORM=Tempête tropicale
SaffirSimpsonHurricaneWindScale.ONE=Catégorie 1
SaffirSimpsonHurricaneWindScale.TWO=Catégorie 2
SaffirSimpsonHurricaneWindScale.THREE=Catégorie 3
SaffirSimpsonHurricaneWindScale.FOUR=Catégorie 4
SaffirSimpsonHurricaneWindScale.FIVE=Catégorie 5
SaffirSimpsonHurricaneWindScale.UNKNOWN=Inconnue
6 changes: 6 additions & 0 deletions console/systems/common-java16/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
<groupId>tech.uom.lib</groupId>
<artifactId>uom-lib-common</artifactId>
</dependency>
<dependency>
<groupId>tech.uom.domain</groupId>
<artifactId>uom-weather</artifactId>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion console/systems/common-java16/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
requires transitive tech.units.indriya;
requires tech.uom.lib.common;
requires systems.uom.common;

requires tech.uom.domain.weather;

exports tech.uom.demo.systems.common16;
exports tech.uom.demo.systems.common16.types;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import static systems.uom.common.USCustomary.MILE;
import static tech.units.indriya.unit.Units.HOUR;
import java.time.Duration;
import java.util.List;

import javax.measure.quantity.Time;

import tech.units.indriya.quantity.Quantities;
Expand All @@ -42,13 +40,11 @@
*
* @author Werner Keil
* @see <a href="https://en.wikipedia.org/wiki/In-flight_entertainment">Wikipedia: In-flight entertainment</a>
* @version 1.2
*/
public class AirplaneDemo {

public static void main(String[] args) {
List<String> emptyList = List.of();
emptyList.add("Test");

final String model;
double dist;
if (args != null && args.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
import static tech.units.indriya.quantity.Quantities.getQuantity;
import static tech.units.indriya.unit.Units.KILOMETRE_PER_HOUR;
import static tech.units.indriya.unit.Units.METRE;
import static tech.uom.demo.systems.common16.types.SaffirSimpsonHurricaneWindScale.Category.*;
import static tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale.Category.*;

import tech.units.indriya.format.SimpleUnitFormat;
import tech.uom.demo.systems.common16.types.SaffirSimpsonHurricaneWindScale;
import tech.uom.domain.weather.wind.SaffirSimpsonHurricaneWindScale;

import javax.measure.quantity.Time;
import java.util.regex.Pattern;

/**
* @author Werner Keil
* @version 1.3
* @version 2.3
* @see {@link SaffirSimpsonHurricaneWindScale}
*/
public class ThePerfectStorm {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Units of Measurement Console Demos
* Copyright (c) 2005-2021, Werner Keil and others.
* Copyright (c) 2005-2022, Werner Keil and others.
*
* All rights reserved.
*
Expand Down Expand Up @@ -35,7 +35,7 @@
import tech.units.indriya.quantity.Quantities;

/**
* This is a demonstrator for the Java 14 {@link Record} preview and the new <code>switch</code> expression.
* This is a demonstrator for the Java 17 {@link Record} preview and the new <code>switch</code> expression.
* @author Werner Keil
*
*/
Expand All @@ -44,6 +44,7 @@ public record Airplane( String model) {
public final Quantity<Speed> getSpeed() {
return switch (model) {
case "A380" -> Quantities.getQuantity(945, KILOMETRE_PER_HOUR); // Airbus A 380 Cruise speed
case "B747" -> Quantities.getQuantity(933, KILOMETRE_PER_HOUR); // Jumbo Cruise speed
case "B777" -> Quantities.getQuantity(892, KILOMETRE_PER_HOUR);
// Boeing 777 Cruise speed, see https://en.wikipedia.org/wiki/Boeing_777#Specifications
case "B787" -> Quantities.getQuantity(903, KILOMETRE_PER_HOUR);
Expand Down
Loading

0 comments on commit 2eef460

Please sign in to comment.