mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpiunits] Overload Measure.per(Time) to return Measure<Velocity> (#6018)
As opposed to returning Measure<Per<U, Time>> Now matches the overload on Unit
This commit is contained in:
@@ -178,6 +178,21 @@ public interface Measure<U extends Unit<U>> extends Comparable<Measure<U>> {
|
||||
return newUnit.of(magnitude());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a velocity measure equivalent to this one per a unit of time.
|
||||
*
|
||||
* <pre>
|
||||
* Radians.of(3.14).per(Second) // Velocity<Angle> equivalent to RadiansPerSecond.of(3.14)
|
||||
* </pre>
|
||||
*
|
||||
* @param time the unit of time
|
||||
* @return the velocity measure
|
||||
*/
|
||||
default Measure<Velocity<U>> per(Time time) {
|
||||
var newUnit = unit().per(time);
|
||||
return newUnit.of(magnitude());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds another measure to this one. The resulting measure has the same unit as this one.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user