mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user