Interface Conversion<Input,Output>
public interface Conversion<Input,Output>
Represent a conversion factor from any measurement to another.
For instance you can have a Conversion<Double, Double>
which could convert between
motor RPM to wheel MPS
-
Method Summary
Modifier and TypeMethodDescriptionstatic <I,
O> Conversion<I, O> Creates aConversion<I, O>
object.fromOutput
(Output output) default Conversion<Output,
Input> invert()
-
Method Details
-
create
Creates aConversion<I, O>
object.- Type Parameters:
I
- Input class type.O
- Output class type.- Parameters:
inputToOutput
-Function<I, O>
which converts input measurement to output measurement.outputToInput
-Function<O, I>
which converts output measurement to input measurement.- Returns:
- A
Conversion
object representing the two functions.
-
invert
- Returns:
- A new
Conversion
object which flips the input and output of this object such thatConversion<I, O>.invert()
would returnConversion<O, I>
.
-
fromInput
- Parameters:
input
- Measurement representing typeInput
to convert to typeOutput
.- Returns:
- Type
Output
converted fromInput
.
-
fromOutput
- Parameters:
output
- Measurement representing typeOutput
to convert to typeInput
.- Returns:
- Type
Input
converted fromOutput
.
-