summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnits/unit/Metric.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/sevenUnits/unit/Metric.java')
-rw-r--r--src/main/java/sevenUnits/unit/Metric.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/main/java/sevenUnits/unit/Metric.java b/src/main/java/sevenUnits/unit/Metric.java
index 7841987..e712dc3 100644
--- a/src/main/java/sevenUnits/unit/Metric.java
+++ b/src/main/java/sevenUnits/unit/Metric.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2018 Adrien Hopkins
+ * Copyright (C) 2018, 2021, 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
@@ -24,19 +24,23 @@ import sevenUnits.utils.ObjectProduct;
/**
* All of the units, prefixes and dimensions that are used by the SI, as well as
* some outside the SI.
- *
+ *
* <p>
* This class does not include prefixed units. To obtain prefixed units, use
* {@link LinearUnit#withPrefix}:
- *
+ *
* <pre>
* LinearUnit KILOMETRE = SI.METRE.withPrefix(SI.KILO);
* </pre>
- *
- *
+ *
+ *
* @author Adrien Hopkins
* @since 2019-10-16
+ * @since v0.3.0
*/
+// this class is just constants, most of which are obvious from the variable name
+// so no need to check for missing values
+@SuppressWarnings("javadoc")
public final class Metric {
/// dimensions used by SI units
// base dimensions, as BaseDimensions
@@ -67,8 +71,10 @@ public final class Metric {
}
/// base units of the SI
- // suppressing warnings since these are the same object, but in a different
- /// form (class)
+ // suppressing warnings since these are the same object,
+ // but in a different form (class)
+ // and because these objects are only used outside this class,
+ // where hiding is not a problem.
@SuppressWarnings("hiding")
public static final class BaseUnits {
public static final BaseUnit METRE = BaseUnit
@@ -101,9 +107,10 @@ public final class Metric {
/**
* Constants that relate to the SI or other systems.
- *
+ *
* @author Adrien Hopkins
* @since 2019-11-08
+ * @since v0.3.0
*/
public static final class Constants {
public static final LinearUnit EARTH_GRAVITY = METRE.dividedBy(SECOND)
@@ -343,7 +350,7 @@ public final class Metric {
pr -> 0.5 * Math.log(pr), Np -> Math.exp(2 * Np))
.withName(NameSymbol.of("neper", "Np"));
public static final Unit BEL = Unit.fromConversionFunctions(ONE.getBase(),
- pr -> Math.log10(pr), dB -> Math.pow(10, dB))
+ Math::log10, dB -> Math.pow(10, dB))
.withName(NameSymbol.of("bel", "B"));
public static final Unit DECIBEL = Unit
.fromConversionFunctions(ONE.getBase(), pr -> 10 * Math.log10(pr),