Package edu.wpi.first.units
Class Per<N extends Unit<N>,D extends Unit<D>>
- Type Parameters:
N
- the type of the numerator unitD
- the type of the denominator unit
public class Per<N extends Unit<N>,D extends Unit<D>> extends Unit<Per<N,D>>
Generic combinatory unit type that represents the proportion of one unit to another, such as
Meters per Second or Radians per Celsius.
Note: Velocity
is used to represent the velocity dimension, rather than
Per<Distance, Time>
.
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description static <N extends Unit<N>, D extends Unit<D>>
Per<N,D>combine(N numerator, D denominator)
Creates a new Per unit derived from an arbitrary numerator and time denominator units.D
denominator()
Gets the denominator unit.boolean
equals(Object o)
int
hashCode()
N
numerator()
Gets the numerator unit.Methods inherited from class edu.wpi.first.units.Unit
convertFrom, equivalent, fromBaseUnits, getConverterFromBase, getConverterToBase, mult, name, of, ofBaseUnits, one, per, per, symbol, toBaseUnits, toString, zero
-
Constructor Details
-
Per
Creates a new proportional unit derived from the ratio of one unit to another. Consider usingcombine(N, D)
instead of manually calling this constructor.- Parameters:
baseType
- the base type representing the unit rationumerator
- the numerator unitdenominator
- the denominator unit
-
-
Method Details
-
combine
public static <N extends Unit<N>, D extends Unit<D>> Per<N,D> combine(N numerator, D denominator)Creates a new Per unit derived from an arbitrary numerator and time denominator units. Using a denominator with a unit of time is discouraged; useVelocity
instead.Per.combine(Volts, Meters) // possible PID constant
It's recommended to use the convenience function
Unit.per(Unit)
instead of calling this factory directly.- Type Parameters:
N
- the type of the numerator unitD
- the type of the denominator unit- Parameters:
numerator
- the numerator unitdenominator
- the denominator for unit time- Returns:
- the combined unit
-
numerator
Gets the numerator unit. For aPer<A, B>
, this will return theA
unit.- Returns:
- the numerator unit
-
denominator
Gets the denominator unit. For aPer<A, B>
, this will return theB
unit.- Returns:
- the denominator unit
-
equals
-
hashCode
-