summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnits/unit/Unit.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/sevenUnits/unit/Unit.java')
-rw-r--r--src/main/java/sevenUnits/unit/Unit.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/sevenUnits/unit/Unit.java b/src/main/java/sevenUnits/unit/Unit.java
index 5d67ed0..d651fe2 100644
--- a/src/main/java/sevenUnits/unit/Unit.java
+++ b/src/main/java/sevenUnits/unit/Unit.java
@@ -31,6 +31,7 @@ import sevenUnits.utils.ObjectProduct;
*
* @author Adrien Hopkins
* @since 2019-10-16
+ * @since v0.3.0
*/
public abstract class Unit implements Nameable {
/**
@@ -51,6 +52,7 @@ public abstract class Unit implements Nameable {
* and returns that value expressed in the unit's base.
* @return a unit that uses the provided functions to convert.
* @since 2019-05-22
+ * @since v0.3.0
* @throws NullPointerException if any argument is null
*/
public static final Unit fromConversionFunctions(
@@ -79,6 +81,7 @@ public abstract class Unit implements Nameable {
* @param ns names and symbol of unit
* @return a unit that uses the provided functions to convert.
* @since 2019-05-22
+ * @since v0.3.0
* @throws NullPointerException if any argument is null
*/
public static final Unit fromConversionFunctions(
@@ -92,6 +95,7 @@ public abstract class Unit implements Nameable {
* The combination of units that this unit is based on.
*
* @since 2019-10-16
+ * @since v0.3.0
*/
private final ObjectProduct<BaseUnit> unitBase;
@@ -99,6 +103,7 @@ public abstract class Unit implements Nameable {
* This unit's name(s) and symbol
*
* @since 2020-09-07
+ * @since v0.3.0
*/
private final NameSymbol nameSymbol;
@@ -106,6 +111,7 @@ public abstract class Unit implements Nameable {
* Cache storing the result of getDimension()
*
* @since 2019-10-16
+ * @since v0.3.0
*/
private transient ObjectProduct<BaseDimension> dimension = null;
@@ -113,6 +119,7 @@ public abstract class Unit implements Nameable {
* A constructor that constructs {@code BaseUnit} instances.
*
* @since 2019-10-16
+ * @since v0.3.0
*/
Unit(final NameSymbol nameSymbol) {
if (this instanceof BaseUnit) {
@@ -128,6 +135,7 @@ public abstract class Unit implements Nameable {
* @param unitBase base of unit
* @param ns names and symbol of unit
* @since 2019-10-16
+ * @since v0.3.0
* @throws NullPointerException if unitBase or ns is null
*/
protected Unit(ObjectProduct<BaseUnit> unitBase, NameSymbol ns) {
@@ -187,6 +195,7 @@ public abstract class Unit implements Nameable {
* @param value value to convert
* @return converted value
* @since 2019-05-22
+ * @since v0.3.0
* @throws IllegalArgumentException if {@code other} is incompatible for
* conversion with this unit (as tested by
* {@link Unit#canConvertTo}).
@@ -255,6 +264,7 @@ public abstract class Unit implements Nameable {
/**
* @return the nameSymbol
* @since 2020-09-07
+ * @since v0.3.0
*/
@Override
public final NameSymbol getNameSymbol() {
@@ -281,6 +291,7 @@ public abstract class Unit implements Nameable {
* @return true iff this unit is metric.
*
* @since 2020-08-27
+ * @since v0.3.0
*/
public final boolean isMetric() {
// first condition - check that it is a linear unit
@@ -302,6 +313,7 @@ public abstract class Unit implements Nameable {
/**
* @return a string representing this unit's definition
* @since 2022-03-10
+ * @since v0.3.0
*/
public String toDefinitionString() {
if (!this.unitBase.getNameSymbol().isEmpty())
@@ -314,6 +326,7 @@ public abstract class Unit implements Nameable {
/**
* @return a string containing both this unit's name and its definition
* @since 2022-03-10
+ * @since v0.3.0
*/
public final String toFullString() {
return this.toString() + " (" + this.toDefinitionString() + ")";
@@ -333,6 +346,7 @@ public abstract class Unit implements Nameable {
* @param ns name(s) and symbol to use
* @return a copy of this unit with provided name(s) and symbol
* @since 2019-10-21
+ * @since v0.3.0
* @throws NullPointerException if ns is null
*/
public Unit withName(final NameSymbol ns) {