Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

SamCarlberg
Copy link
Member

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

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
@SamCarlberg SamCarlberg added the component: wpiunits Java units library label Jan 17, 2025
@SamCarlberg SamCarlberg requested a review from a team as a code owner January 17, 2025 01:45
@PeterJohnson PeterJohnson merged commit e52f400 into wpilibsuite:main Jan 17, 2025
47 checks passed
@SamCarlberg SamCarlberg deleted the wpiunits/measure-per-unit branch January 17, 2025 14:31
katzuv pushed a commit to katzuv/allwpilib that referenced this pull request Feb 16, 2025
…suite#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wpiunits Java units library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants