diff options
author | Adrien Hopkins <masterofnumbers17@gmail.com> | 2019-10-21 15:17:50 -0400 |
---|---|---|
committer | Adrien Hopkins <masterofnumbers17@gmail.com> | 2019-10-21 15:17:50 -0400 |
commit | 1bf43ad95e70019a69e91e09ff74f677082ed6f5 (patch) | |
tree | 14c381f280ed3a5c2f15eda201ba1204ccf43fc7 /src/org/unitConverter/unit/Unit.java | |
parent | e28907d4bf4234cb988a5e76ebf7122c7c1ff6cb (diff) |
Made improvements and corrections to the documentation.
Diffstat (limited to 'src/org/unitConverter/unit/Unit.java')
-rw-r--r-- | src/org/unitConverter/unit/Unit.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/org/unitConverter/unit/Unit.java b/src/org/unitConverter/unit/Unit.java index d4eb86e..7971a41 100644 --- a/src/org/unitConverter/unit/Unit.java +++ b/src/org/unitConverter/unit/Unit.java @@ -52,7 +52,7 @@ public abstract class Unit { * @throws NullPointerException * if any argument is null */ - public static Unit fromConversionFunctions(final ObjectProduct<BaseUnit> base, + public static final Unit fromConversionFunctions(final ObjectProduct<BaseUnit> base, final DoubleUnaryOperator converterFrom, final DoubleUnaryOperator converterTo) { return FunctionalUnit.valueOf(base, converterFrom, converterTo); } @@ -121,6 +121,9 @@ public abstract class Unit { * If this unit <i>is</i> a base unit, this method should return {@code value}. * </p> * + * @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 @@ -132,6 +135,10 @@ public abstract class Unit { /** * Converts a value expressed in this unit to a value expressed in {@code other}. * + * @implSpec If unit conversion is possible, this implementation returns + * {@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 @@ -140,7 +147,7 @@ public abstract class Unit { * @since 2019-05-22 * @throws IllegalArgumentException * if {@code other} is incompatible for conversion with this unit (as tested by - * {@link IUnit#canConvertTo}). + * {@link Unit#canConvertTo}). * @throws NullPointerException * if other is null */ @@ -162,6 +169,9 @@ public abstract class Unit { * If this unit <i>is</i> a base unit, this method should return {@code value}. * </p> * + * @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 |