[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:
Sam Carlberg
2023-12-08 13:39:28 -08:00
committed by GitHub
parent a71adef316
commit ddf79a25d4
2 changed files with 26 additions and 1 deletions

View File

@@ -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&lt;Angle&gt; 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.
*