summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnits/unit/Unit.java
diff options
context:
space:
mode:
authorAdrien Hopkins <ahopk127@my.yorku.ca>2022-04-10 14:22:29 -0500
committerAdrien Hopkins <ahopk127@my.yorku.ca>2022-04-10 14:22:29 -0500
commitb1affe92460637211f560d70ee5c8770f3952822 (patch)
tree2fe58d9280794cd4c65e2f76e8068c9fd49bbc2c /src/main/java/sevenUnits/unit/Unit.java
parentc421e474a7b0d0d453e4a527907f327f2ddef320 (diff)
Created API for settings and unit/prefix viewing
Diffstat (limited to 'src/main/java/sevenUnits/unit/Unit.java')
-rw-r--r--src/main/java/sevenUnits/unit/Unit.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/sevenUnits/unit/Unit.java b/src/main/java/sevenUnits/unit/Unit.java
index b80ccbd..826b59b 100644
--- a/src/main/java/sevenUnits/unit/Unit.java
+++ b/src/main/java/sevenUnits/unit/Unit.java
@@ -24,7 +24,6 @@ import java.util.function.DoubleUnaryOperator;
import sevenUnits.utils.DecimalComparison;
import sevenUnits.utils.NameSymbol;
import sevenUnits.utils.Nameable;
-import sevenUnits.utils.NamedObjectProduct;
import sevenUnits.utils.ObjectProduct;
/**
@@ -191,7 +190,7 @@ public abstract class Unit implements Nameable {
*
* @implSpec This method is used by {@link #convertTo}, and its behaviour
* affects the behaviour of {@code convertTo}.
- *
+ *
* @param value value expressed in <b>base</b> unit
* @return value expressed in <b>this</b> unit
* @since 2018-12-22
@@ -207,7 +206,7 @@ public abstract class Unit implements Nameable {
* {@code other.convertFromBase(this.convertToBase(value))}.
* Therefore, overriding either of those methods will change the
* output of this method.
- *
+ *
* @param other unit to convert to
* @param value value to convert
* @return converted value
@@ -234,7 +233,7 @@ public abstract class Unit implements Nameable {
* {@code other.convertFromBase(this.convertToBase(value))}.
* Therefore, overriding either of those methods will change the
* output of this method.
- *
+ *
* @param other unitlike form to convert to
* @param value value to convert
* @param <W> type of value to convert to
@@ -269,7 +268,7 @@ public abstract class Unit implements Nameable {
*
* @implSpec This method is used by {@link #convertTo}, and its behaviour
* affects the behaviour of {@code convertTo}.
- *
+ *
* @param value value expressed in <b>this</b> unit
* @return value expressed in <b>base</b> unit
* @since 2018-12-22
@@ -355,9 +354,8 @@ public abstract class Unit implements Nameable {
* @since 2022-03-10
*/
public String toDefinitionString() {
- if (this.unitBase instanceof NamedObjectProduct)
- return "derived from "
- + ((NamedObjectProduct<?>) this.unitBase).getName();
+ if (this.unitBase instanceof Nameable)
+ return "derived from " + ((Nameable) this.unitBase).getName();
else
return "derived from "
+ this.getBase().toString(BaseUnit::getShortName);