diff options
author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2020-10-03 11:40:17 -0500 |
---|---|---|
committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2020-10-03 11:40:17 -0500 |
commit | 0169e644908c4285536d9d23ab82b0a3a46d9d8b (patch) | |
tree | a921546e3bf022fdc6cc47a2123cfc367fd46557 /src/org/unitConverter/unit/UnitValue.java | |
parent | cd33f886dfbd35c0ee3d8cf5b553ea3481b0b3a1 (diff) |
Added the MultiUnit
Diffstat (limited to 'src/org/unitConverter/unit/UnitValue.java')
-rw-r--r-- | src/org/unitConverter/unit/UnitValue.java | 15 |
1 files changed, 8 insertions, 7 deletions
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 <U extends Unitlike<W>, W> UnitlikeValue<U, W> 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 <W> UnitlikeValue<W> convertTo(Unitlike<W> other) { - return UnitlikeValue.of(other, + public final UnitValue convertTo(Unit other) { + return UnitValue.of(other, this.getUnit().convertTo(other, this.getValue())); } |