diff --git a/console/systems/common-java12/pom.xml b/console/systems/common-java12/pom.xml index 176b3de5..d5ed43fb 100644 --- a/console/systems/common-java12/pom.xml +++ b/console/systems/common-java12/pom.xml @@ -45,7 +45,10 @@ tech.uom.lib uom-lib-common - + + tech.uom.domain + uom-weather + org.junit.jupiter junit-jupiter diff --git a/console/systems/common-java12/src/main/java/module-info.java b/console/systems/common-java12/src/main/java/module-info.java index db86d797..ca032b39 100644 --- a/console/systems/common-java12/src/main/java/module-info.java +++ b/console/systems/common-java12/src/main/java/module-info.java @@ -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. * @@ -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; diff --git a/console/systems/common-java12/src/main/java/tech/uom/demo/systems/common/ThePerfectStorm.java b/console/systems/common-java12/src/main/java/tech/uom/demo/systems/common/ThePerfectStorm.java index 11e8ec8c..3bb59804 100644 --- a/console/systems/common-java12/src/main/java/tech/uom/demo/systems/common/ThePerfectStorm.java +++ b/console/systems/common-java12/src/main/java/tech/uom/demo/systems/common/ThePerfectStorm.java @@ -27,13 +27,13 @@ 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; @@ -41,11 +41,11 @@ 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 { diff --git a/console/systems/common-java12/src/main/java/tech/uom/demo/systems/common/types/SaffirSimpsonHurricaneWindScale.java b/console/systems/common-java12/src/main/java/tech/uom/demo/systems/common/types/SaffirSimpsonHurricaneWindScale.java deleted file mode 100644 index bb056ddf..00000000 --- a/console/systems/common-java12/src/main/java/tech/uom/demo/systems/common/types/SaffirSimpsonHurricaneWindScale.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Units of Measurement Console Demos - * Copyright (c) 2005-2021, Werner Keil and others. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of JSR-385, Units of Measurement nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package tech.uom.demo.systems.common.types; - -import static tech.units.indriya.AbstractQuantity.NONE; -import static tech.uom.demo.systems.common.types.SaffirSimpsonHurricaneWindScale.Category.*; - -import javax.measure.Quantity; -import javax.measure.quantity.Speed; - -import tech.uom.lib.common.function.Nameable; -import tech.units.indriya.quantity.QuantityRange; - -/** - * @author Werner Keil - * @version 1.1 - * @see - * Wikipedia: Saffir–Simpson hurricane wind scale - * @deprecated Use uom-weather types - */ -public class SaffirSimpsonHurricaneWindScale extends QuantityRange - implements Nameable { - - /** - * The storm category - */ - public static enum Category { - UNKNOWN, TROPICAL_DEPRESSION, TROPICAL_STORM, ONE, TWO, THREE, FOUR, FIVE - } - - private final Category category; - - public Category getCategory() { - return category; - } - - /* - * (non-Javadoc) - * - * @see Range - */ - protected SaffirSimpsonHurricaneWindScale(Quantity min, - Quantity max, Category level) { - super(min, max); - this.category = level; - } - - /* - * (non-Javadoc) - * - * @see Range - */ - protected SaffirSimpsonHurricaneWindScale(Quantity min, - Quantity max) { - this(min, max, UNKNOWN); - } - - /** - * Returns an {@code SaffirSimpsonHurricaneWindScale} with the specified - * values. - * - * @param min - * The minimum value for the wind scale. - * @param max - * The maximum value for the wind scale. - * @param cat - * The {@link Category} of the wind scale. - * @return an {@code SaffirSimpsonHurricaneWindScale} with the values - * present - */ - public static final SaffirSimpsonHurricaneWindScale of(Quantity min, - Quantity max, Category cat) { - return new SaffirSimpsonHurricaneWindScale(min, max, cat); - } - - @Override - public boolean hasMinimum() { - return getMinimum() != null - && !NONE.equals(getMinimum()) - && !(getMinimum().getUnit() == null || getMinimum().getValue() == null); - } - - @Override - public boolean hasMaximum() { - return getMaximum() != null - && !NONE.equals(getMaximum()) - && !(getMaximum().getUnit() == null || getMaximum().getValue() == null); - } - - @Override - public String toString() { - return getName() + " [category=" + category + ", minimum=" - + getMinimum() + ", maximum=" + getMaximum() + "]"; - } - - @Override - public String getName() { - return "Saffir–Simpson hurricane wind scale"; - } -} diff --git a/console/systems/common-java12/src/main/resources/tech/uom/demo/systems/common/messages_fr.properties b/console/systems/common-java12/src/main/resources/tech/uom/demo/systems/common/messages_fr.properties new file mode 100644 index 00000000..203abcd3 --- /dev/null +++ b/console/systems/common-java12/src/main/resources/tech/uom/demo/systems/common/messages_fr.properties @@ -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 \ No newline at end of file diff --git a/console/systems/common-java16/pom.xml b/console/systems/common-java16/pom.xml index 1504bd8e..e4f2878d 100644 --- a/console/systems/common-java16/pom.xml +++ b/console/systems/common-java16/pom.xml @@ -45,6 +45,12 @@ tech.uom.lib uom-lib-common + + tech.uom.domain + uom-weather + + + org.junit.jupiter junit-jupiter diff --git a/console/systems/common-java16/src/main/java/module-info.java b/console/systems/common-java16/src/main/java/module-info.java index 5b718bcf..b975ded6 100644 --- a/console/systems/common-java16/src/main/java/module-info.java +++ b/console/systems/common-java16/src/main/java/module-info.java @@ -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; } \ No newline at end of file diff --git a/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/AirplaneDemo.java b/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/AirplaneDemo.java index 52e02a22..e495cffe 100644 --- a/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/AirplaneDemo.java +++ b/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/AirplaneDemo.java @@ -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; @@ -42,13 +40,11 @@ * * @author Werner Keil * @see Wikipedia: In-flight entertainment + * @version 1.2 */ public class AirplaneDemo { public static void main(String[] args) { - List emptyList = List.of(); - emptyList.add("Test"); - final String model; double dist; if (args != null && args.length > 0) { diff --git a/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/ThePerfectStorm.java b/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/ThePerfectStorm.java index 51a86f3c..80c0e18a 100644 --- a/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/ThePerfectStorm.java +++ b/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/ThePerfectStorm.java @@ -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 { diff --git a/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/types/Airplane.java b/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/types/Airplane.java index 310e495e..b4d3ef92 100644 --- a/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/types/Airplane.java +++ b/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/types/Airplane.java @@ -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. * @@ -35,7 +35,7 @@ import tech.units.indriya.quantity.Quantities; /** - * This is a demonstrator for the Java 14 {@link Record} preview and the new switch expression. + * This is a demonstrator for the Java 17 {@link Record} preview and the new switch expression. * @author Werner Keil * */ @@ -44,6 +44,7 @@ public record Airplane( String model) { public final Quantity 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); diff --git a/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/types/SaffirSimpsonHurricaneWindScale.java b/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/types/SaffirSimpsonHurricaneWindScale.java deleted file mode 100644 index 0c9f62d1..00000000 --- a/console/systems/common-java16/src/main/java/tech/uom/demo/systems/common16/types/SaffirSimpsonHurricaneWindScale.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Units of Measurement Console Demos - * Copyright (c) 2005-2020, Werner Keil and others. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of JSR-385, Units of Measurement nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package tech.uom.demo.systems.common16.types; - -import static tech.units.indriya.AbstractQuantity.NONE; -import static tech.uom.demo.systems.common16.types.SaffirSimpsonHurricaneWindScale.Category.*; - -import javax.measure.Quantity; -import javax.measure.quantity.Speed; - -import tech.uom.lib.common.function.Nameable; -import tech.units.indriya.quantity.QuantityRange; - -/** - * @author Werner Keil - * @version 1.2 - * @see - * Wikipedia: Saffir–Simpson hurricane wind scale - * @deprecated Use uom-weather types - */ -public class SaffirSimpsonHurricaneWindScale extends QuantityRange - implements Nameable { - - /** - * The storm category - */ - public static enum Category { - UNKNOWN, TROPICAL_DEPRESSION, TROPICAL_STORM, ONE, TWO, THREE, FOUR, FIVE - } - - private final Category category; - - public Category getCategory() { - return category; - } - - /* - * (non-Javadoc) - * - * @see Range - */ - protected SaffirSimpsonHurricaneWindScale(Quantity min, - Quantity max, Category level) { - super(min, max); - this.category = level; - } - - /* - * (non-Javadoc) - * - * @see Range - */ - protected SaffirSimpsonHurricaneWindScale(Quantity min, - Quantity max) { - this(min, max, UNKNOWN); - } - - /** - * Returns an {@code SaffirSimpsonHurricaneWindScale} with the specified - * values. - * - * @param min - * The minimum value for the wind scale. - * @param max - * The maximum value for the wind scale. - * @param cat - * The {@link Category} of the wind scale. - * @return an {@code SaffirSimpsonHurricaneWindScale} with the values - * present - */ - public static final SaffirSimpsonHurricaneWindScale of(Quantity min, - Quantity max, Category cat) { - return new SaffirSimpsonHurricaneWindScale(min, max, cat); - } - - @Override - public boolean hasMinimum() { - return getMinimum() != null - && !NONE.equals(getMinimum()) - && !(getMinimum().getUnit() == null || getMinimum().getValue() == null); - } - - @Override - public boolean hasMaximum() { - return getMaximum() != null - && !NONE.equals(getMaximum()) - && !(getMaximum().getUnit() == null || getMaximum().getValue() == null); - } - - @Override - public String toString () { - return getName() + " [category=" + category + ", minimum=" - + getMinimum() + ", maximum=" + getMaximum() + "]"; - } - - @Override - public String getName() { - return "Saffir–Simpson hurricane wind scale"; - } -} diff --git a/console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common14/messages.properties b/console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common16/messages.properties similarity index 100% rename from console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common14/messages.properties rename to console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common16/messages.properties diff --git a/console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common14/messages_de.properties b/console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common16/messages_de.properties similarity index 100% rename from console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common14/messages_de.properties rename to console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common16/messages_de.properties diff --git a/console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common14/messages_es.properties b/console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common16/messages_es.properties similarity index 100% rename from console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common14/messages_es.properties rename to console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common16/messages_es.properties diff --git a/console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common16/messages_fr.properties b/console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common16/messages_fr.properties new file mode 100644 index 00000000..203abcd3 --- /dev/null +++ b/console/systems/common-java16/src/main/resources/tech/uom/demo/systems/common16/messages_fr.properties @@ -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 \ No newline at end of file diff --git a/desktop/javafx/fxlib/README.md b/desktop/javafx/fxlib/README.md index 75b94f94..cef2a86c 100644 --- a/desktop/javafx/fxlib/README.md +++ b/desktop/javafx/fxlib/README.md @@ -2,6 +2,6 @@ A Java FX port of [Flib](http://www.phonearena.com/news/Flib-is-a-simple-elegant-smart-unit-converter-app-for-Android_id51881) -**This version (2.x) requires Java 11 because of [OpenJFX](https://openjfx.io/)**. +**This version (2.x) requires Java 17 because of [OpenJFX](https://openjfx.io/)**. -For Java SE 8, please use the [1.x branch](https://github.com/unitsofmeasurement/uom-demos/tree/1.0/javafx/fxlib). +For Java SE 8, please use the [1.x branch](https://github.com/unitsofmeasurement/uom-demos/tree/1.0/javafx/fxlib). \ No newline at end of file