summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnits/unit/BaseUnit.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/sevenUnits/unit/BaseUnit.java')
-rw-r--r--src/main/java/sevenUnits/unit/BaseUnit.java31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/main/java/sevenUnits/unit/BaseUnit.java b/src/main/java/sevenUnits/unit/BaseUnit.java
index fe85a7b..13e76d9 100644
--- a/src/main/java/sevenUnits/unit/BaseUnit.java
+++ b/src/main/java/sevenUnits/unit/BaseUnit.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2019 Adrien Hopkins
+ * Copyright (C) 2019, 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
@@ -28,19 +28,21 @@ import sevenUnits.utils.NameSymbol;
* Note that BaseUnits <b>must</b> have names and symbols. This is because they
* are used for toString code. Therefore, the Optionals provided by
* {@link #getPrimaryName} and {@link #getSymbol} will always contain a value.
- *
+ *
* @author Adrien Hopkins
* @since 2019-10-16
+ * @since v0.3.0
*/
public final class BaseUnit extends Unit {
/**
* Gets a base unit from the dimension it measures, its name and its symbol.
- *
+ *
* @param dimension dimension measured by this unit
* @param name name of unit
* @param symbol symbol of unit
* @return base unit
* @since 2019-10-16
+ * @since v0.3.0
*/
public static BaseUnit valueOf(final BaseDimension dimension,
final String name, final String symbol) {
@@ -49,31 +51,32 @@ public final class BaseUnit extends Unit {
/**
* Gets a base unit from the dimension it measures, its name and its symbol.
- *
- * @param dimension dimension measured by this unit
- * @param name name of unit
- * @param symbol symbol of unit
+ *
+ * @param dimension dimension measured by this unit
+ * @param name name of unit
+ * @param symbol symbol of unit
+ * @param otherNames other possible names of unit
* @return base unit
* @since 2019-10-21
+ * @since v0.3.0
*/
public static BaseUnit valueOf(final BaseDimension dimension,
final String name, final String symbol, final Set<String> otherNames) {
return new BaseUnit(dimension, name, symbol, otherNames);
}
- /**
- * The dimension measured by this base unit.
- */
+ /** The dimension measured by this base unit. */
private final BaseDimension dimension;
/**
* Creates the {@code BaseUnit}.
- *
+ *
* @param dimension dimension of unit
* @param primaryName name of unit
* @param symbol symbol of unit
* @throws NullPointerException if any argument is null
* @since 2019-10-16
+ * @since v0.3.0
*/
private BaseUnit(final BaseDimension dimension, final String primaryName,
final String symbol, final Set<String> otherNames) {
@@ -86,9 +89,10 @@ public final class BaseUnit extends Unit {
* Returns a {@code LinearUnit} with this unit as a base and a conversion
* factor of 1. This operation must be done in order to allow units to be
* created with operations.
- *
+ *
* @return this unit as a {@code LinearUnit}
* @since 2019-10-16
+ * @since v0.3.0
*/
public LinearUnit asLinearUnit() {
return LinearUnit.valueOf(this.getBase(), 1);
@@ -107,8 +111,9 @@ public final class BaseUnit extends Unit {
/**
* @return dimension
* @since 2019-10-16
+ * @since v0.3.0
*/
- public final BaseDimension getBaseDimension() {
+ public BaseDimension getBaseDimension() {
return this.dimension;
}