diff options
author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2020-10-02 10:16:10 -0500 |
---|---|---|
committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2020-10-02 10:16:10 -0500 |
commit | cd33f886dfbd35c0ee3d8cf5b553ea3481b0b3a1 (patch) | |
tree | 821f14b1ec307f78a0eb9b8bce48ead18cae4d70 /src/org/unitConverter/unit/LinearUnit.java | |
parent | 5a7e8f6fcb175b238eb1d5481513b35039107a3e (diff) |
Added Unitlike objects
Diffstat (limited to 'src/org/unitConverter/unit/LinearUnit.java')
-rw-r--r-- | src/org/unitConverter/unit/LinearUnit.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/org/unitConverter/unit/LinearUnit.java b/src/org/unitConverter/unit/LinearUnit.java index 2d63ca7..b7f33d5 100644 --- a/src/org/unitConverter/unit/LinearUnit.java +++ b/src/org/unitConverter/unit/LinearUnit.java @@ -65,6 +65,24 @@ public final class LinearUnit extends Unit { } /** + * @return the base unit associated with {@code unit}, as a + * {@code LinearUnit}. + * @since 2020-10-02 + */ + public static LinearUnit getBase(final Unit unit) { + return new LinearUnit(unit.getBase(), 1, NameSymbol.EMPTY); + } + + /** + * @return the base unit associated with {@code unitlike}, as a + * {@code LinearUnit}. + * @since 2020-10-02 + */ + public static LinearUnit getBase(final Unitlike<?> unit) { + return new LinearUnit(unit.getBase(), 1, NameSymbol.EMPTY); + } + + /** * Gets a {@code LinearUnit} from a unit base and a conversion factor. In * other words, gets the product of {@code unitBase} and * {@code conversionFactor}, expressed as a {@code LinearUnit}. |