summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnits/unit/UnitType.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/sevenUnits/unit/UnitType.java')
-rw-r--r--src/main/java/sevenUnits/unit/UnitType.java16
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;
}
}