summaryrefslogtreecommitdiff
path: root/src/org/unitConverter/unit/UnitValue.java
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2020-10-03 11:40:17 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2020-10-03 11:40:17 -0500
commit0169e644908c4285536d9d23ab82b0a3a46d9d8b (patch)
treea921546e3bf022fdc6cc47a2123cfc367fd46557 /src/org/unitConverter/unit/UnitValue.java
parentcd33f886dfbd35c0ee3d8cf5b553ea3481b0b3a1 (diff)
Added the MultiUnit
Diffstat (limited to 'src/org/unitConverter/unit/UnitValue.java')
-rw-r--r--src/org/unitConverter/unit/UnitValue.java15
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()));
}