diff options
author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2025-06-15 19:42:01 -0500 |
---|---|---|
committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2025-06-15 19:42:01 -0500 |
commit | 2fdbc084fd1d78f0b7633db34460b1195de264f3 (patch) | |
tree | 4c908950d9b049394f8160b8159b498aec586ecc /src/main/java/sevenUnits/unit/UnitType.java | |
parent | ed53492243ecad8d975401a97f5b634328ad2c71 (diff) | |
parent | bccb5b5e3452421c81c1fb58f83391ba6584807c (diff) |
See the tag 'v1.0.0' or the changelog for more information about this
release.
Diffstat (limited to 'src/main/java/sevenUnits/unit/UnitType.java')
-rw-r--r-- | src/main/java/sevenUnits/unit/UnitType.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/sevenUnits/unit/UnitType.java b/src/main/java/sevenUnits/unit/UnitType.java index 9a87288..b195f13 100644 --- a/src/main/java/sevenUnits/unit/UnitType.java +++ b/src/main/java/sevenUnits/unit/UnitType.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2022 Adrien Hopkins + * Copyright (C) 2022, 2024, 2025 Adrien Hopkins * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -30,9 +30,15 @@ import java.util.function.Predicate; * </ul> * * @since 2022-04-10 + * @since v0.4.0 */ public enum UnitType { - METRIC, SEMI_METRIC, NON_METRIC; + /** Units that pass {@link Unit#isMetric} */ + METRIC, + /** certain exceptions like the degree Celsius */ + SEMI_METRIC, + /** Non-metric, non-excepted units */ + NON_METRIC; /** * Determines which type a unit is. The type will be: @@ -46,13 +52,13 @@ public enum UnitType { * @param isSemiMetric predicate to determine if a unit is semi-metric * @return type of unit * @since 2022-04-18 + * @since v0.4.0 */ public static final UnitType getType(Unit u, Predicate<Unit> isSemiMetric) { if (isSemiMetric.test(u)) return SEMI_METRIC; - else if (u.isMetric()) + if (u.isMetric()) return METRIC; - else - return NON_METRIC; + return NON_METRIC; } } |