Package edu.wpi.first.units
Interface UnitBuilder.UnitConstructorFunction<U extends Unit>
- Type Parameters:
U
- the type of the unit
- Enclosing class:
- UnitBuilder<U extends Unit>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface for constructing new units without relying on reflection.
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(U baseUnit, UnaryFunction toBaseUnits, UnaryFunction fromBaseUnits, String name, String symbol) Creates a new unit instance based on its relation to the base unit of measure.
-
Method Details
-
create
U create(U baseUnit, UnaryFunction toBaseUnits, UnaryFunction fromBaseUnits, String name, String symbol) Creates a new unit instance based on its relation to the base unit of measure.- Parameters:
baseUnit
- the base unit of the unit systemtoBaseUnits
- a function that converts values of the new unit to equivalent values in terms of the base unitfromBaseUnits
- a function that converts values in the base unit to equivalent values in terms of the new unitname
- the name of the new unitsymbol
- the shorthand symbol of the new unit- Returns:
- a new unit
-