-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# WARNING: head commit changed in the meantime
177: Liters per 100 km to mpg conversion issue Task-Url: unitsofmeasurement/uom-systems#177
- Loading branch information
Showing
6 changed files
with
41 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,12 +44,11 @@ | |
* @author <a href="mailto:[email protected]">Jean-Marie Dautelle</a> | ||
* @author <a href="mailto:[email protected]">Werner Keil</a> | ||
* @author Andi Huber | ||
* @version 1.4, Jun 23, 2019 | ||
* @version 2.0, Oct 8, 2020 | ||
* @since 1.0 | ||
*/ | ||
final class DoubleMultiplyConverter | ||
extends AbstractConverter | ||
implements MultiplyConverter { | ||
extends AbstractConverter implements MultiplyConverter { | ||
|
||
/** | ||
* | ||
|
@@ -135,6 +134,11 @@ public Double getValue() { | |
return doubleFactor; | ||
} | ||
|
||
@Override | ||
public double getAsDouble() { | ||
return doubleFactor; | ||
} | ||
|
||
@Override | ||
public int compareTo(UnitConverter o) { | ||
if (this == o) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
|
||
import java.math.BigDecimal; | ||
import java.math.BigInteger; | ||
import java.util.function.DoubleSupplier; | ||
|
||
import javax.measure.Prefix; | ||
import javax.measure.UnitConverter; | ||
|
@@ -49,11 +50,11 @@ | |
* @author <a href="mailto:[email protected]">Jean-Marie Dautelle</a> | ||
* @author <a href="mailto:[email protected]">Werner Keil</a> | ||
* @author Andi Huber | ||
* @version 2.6, September 10, 2019 | ||
* @version 2.7, October 8, 2020 | ||
* @since 1.0 | ||
*/ | ||
public interface MultiplyConverter extends UnitConverter, Converter<Number, Number>, | ||
ValueSupplier<Number>, FactorSupplier<Number>, Comparable<UnitConverter> { | ||
ValueSupplier<Number>, FactorSupplier<Number>, DoubleSupplier, Comparable<UnitConverter> { | ||
|
||
// -- FACTORIES | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ | |
|
||
import java.math.BigInteger; | ||
import java.util.Objects; | ||
import java.util.function.DoubleSupplier; | ||
|
||
import javax.measure.UnitConverter; | ||
|
||
import tech.units.indriya.internal.function.Calculator; | ||
|
@@ -44,7 +46,7 @@ | |
* @author <a href="mailto:[email protected]">Jean-Marie Dautelle</a> | ||
* @author <a href="mailto:[email protected]">Werner Keil</a> | ||
* @author Andi Huber | ||
* @version 1.8, August 21, 2019 | ||
* @version 2.0, October 8, 2020 | ||
* @since 1.0 | ||
*/ | ||
public final class RationalConverter extends AbstractConverter | ||
|
@@ -228,6 +230,11 @@ public int hashCode() { | |
public Number getValue() { | ||
return factor; | ||
} | ||
|
||
@Override | ||
public double getAsDouble() { | ||
return factor.doubleValue(); | ||
} | ||
|
||
@Override | ||
public int compareTo(UnitConverter o) { | ||
|
@@ -253,5 +260,4 @@ private AbstractConverter composeSameType(RationalConverter that) { | |
? IDENTITY | ||
: new RationalConverter(newDividend, newDivisor); | ||
} | ||
|
||
} |