[wpiunits] Add Measure.per overloads for all known unit types (#7699)

Instead of only providing per(TimeUnit)

Useful for making conversion factors easier, eg `Inches.of(10).per(Rotation)` vs `Inches.of(10).per(Rotation.one())`

Update VelocityUnit.one() and VelocityUnit.zero() to return Velocity objects instead of generic Measure<? extends VelocityUnit<D>>; VelocityUnit is final, so the wildcard generic is unnecessary, and this makes the generated `per` functions possible for this type
This commit is contained in:
Sam Carlberg
2025-01-17 02:24:11 -05:00
committed by GitHub
parent a9f3fc6b2c
commit e52f400687
28 changed files with 3300 additions and 145 deletions

View File

@@ -90,14 +90,14 @@ public final class VelocityUnit<D extends Unit> extends PerUnit<D, TimeUnit> {
@Override
@SuppressWarnings("unchecked")
public Measure<? extends VelocityUnit<D>> zero() {
return (Measure<? extends VelocityUnit<D>>) super.zero();
public Velocity<D> zero() {
return (Velocity<D>) super.zero();
}
@Override
@SuppressWarnings("unchecked")
public Measure<? extends VelocityUnit<D>> one() {
return (Measure<? extends VelocityUnit<D>>) super.one();
public Velocity<D> one() {
return (Velocity<D>) super.one();
}
@Override