Package edu.wpi.first.units
Class Mult<A extends Unit<A>,B extends Unit<B>>
- Type Parameters:
A
- the type of the first unit in the resultB
- the type of the second unit in the result
public class Mult<A extends Unit<A>,B extends Unit<B>> extends Unit<Mult<A,B>>
A combinatory unit type that is equivalent to the product of two other others. Note that
algebraic reduction is not possible in Java's generic type system, so
Mult<A, B>
is not
type-compatible with Mult<B, A>
!-
Constructor Summary
-
Method Summary
Modifier and Type Method Description static <A extends Unit<A>, B extends Unit<B>>
Mult<A,B>combine(A a, B b)
Creates a new Mult unit derived from two arbitrary units multiplied together.boolean
equals(Object o)
int
hashCode()
String
toString()
A
unitA()
Gets the first unit of the product.B
unitB()
Gets the second unit of the product.Methods inherited from class edu.wpi.first.units.Unit
convertFrom, equivalent, fromBaseUnits, getConverterFromBase, getConverterToBase, mult, name, of, ofBaseUnits, one, per, per, symbol, toBaseUnits, zero
-
Constructor Details
-
Mult
Creates a new product unit. Consider usingcombine(A, B)
instead of manually calling this constructor.- Parameters:
baseType
- the base type representing the unit producta
- the first unit of the productb
- the second unit of the product
-
-
Method Details
-
combine
Creates a new Mult unit derived from two arbitrary units multiplied together.Mult.combine(Volts, Meters) // Volt-Meters
It's recommended to use the convenience function
Unit.mult(Unit)
instead of calling this factory directly.- Type Parameters:
A
- the type of the first unitB
- the type of the second unit- Parameters:
a
- the first unitb
- the second unit- Returns:
- the combined unit
-
unitA
Gets the first unit of the product.- Returns:
- the first unit
-
unitB
Gets the second unit of the product.- Returns:
- the second unit
-
toString
-
equals
-
hashCode
-