From 0169e644908c4285536d9d23ab82b0a3a46d9d8b Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Sat, 3 Oct 2020 11:40:17 -0500 Subject: Added the MultiUnit --- src/org/unitConverter/unit/UnitValue.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/org/unitConverter/unit/UnitValue.java') diff --git a/src/org/unitConverter/unit/UnitValue.java b/src/org/unitConverter/unit/UnitValue.java index 8932ccc..c138332 100644 --- a/src/org/unitConverter/unit/UnitValue.java +++ b/src/org/unitConverter/unit/UnitValue.java @@ -70,15 +70,16 @@ public final class UnitValue { } /** - * Returns a UnitValue that represents the same value expressed in a - * different unit + * Returns a UnitlikeValue that represents the same value expressed in a + * different unitlike form. * * @param other new unit to express value in * @return value expressed in {@code other} */ - public final UnitValue convertTo(Unit other) { - return UnitValue.of(other, - this.getUnit().convertTo(other, this.getValue())); + public final , W> UnitlikeValue convertTo( + U other) { + return UnitlikeValue.of(other, + this.unit.convertTo(other, this.getValue())); } /** @@ -88,8 +89,8 @@ public final class UnitValue { * @param other new unit to express value in * @return value expressed in {@code other} */ - public final UnitlikeValue convertTo(Unitlike other) { - return UnitlikeValue.of(other, + public final UnitValue convertTo(Unit other) { + return UnitValue.of(other, this.getUnit().convertTo(other, this.getValue())); } -- cgit v1.2.3