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

Java units API rewrite #6958

Merged
merged 47 commits into from
Sep 7, 2024
Merged

Commits on Aug 22, 2024

  1. Configuration menu
    Copy the full SHA
    5112c36 View commit details
    Browse the repository at this point in the history
  2. Flatten units into discrete types

    Java's type system is incapable of handling these with generics, so we need to write all the discrete cases ourselves
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    869a2c4 View commit details
    Browse the repository at this point in the history
  3. Rename IMutable to MutableMeasure

    Generic arguments are 100% breaking from the v1 API
    
    Fix some missing imports
    
    Add`Unit.of`, `Unit.ofBaseUnits`, and `Unit.mutable` methods returning wildcarded generic types. Subclasses should override these to sharpen the signatures to the unit-specific measurement implementations like `Angle` and `Distance`.
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    fb61fc7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cd04e93 View commit details
    Browse the repository at this point in the history
  5. Split into mutable and immutable variants

    Allows immutables to be records and easily converted to value types if valhalla ever lands
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    485135a View commit details
    Browse the repository at this point in the history
  6. Small fixups

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    158c576 View commit details
    Browse the repository at this point in the history
  7. Move measure interfaces to their own package

    Reduces clutter in the root `units` package
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    fd0d2d1 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    29b1e68 View commit details
    Browse the repository at this point in the history
  9. Misc cleanup

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    542b0f6 View commit details
    Browse the repository at this point in the history
  10. Add generic constructor to trapezoid profile constraints

    Instead of separate discrete constructors for different unit types
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    a44bf47 View commit details
    Browse the repository at this point in the history
  11. Add ratio measure type

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    38d18ba View commit details
    Browse the repository at this point in the history
  12. Add math operator overloads for all known dimensions

    Add code generation for the measure implementations (eg Distance, ImmutableDistance, and MutDistance) due to the sheer volume of manual work that would have been required to write (or copy/paste) ten thousand lines of code
    
    Reconsolidate the measure implementations into a single package
    
    Rename `negate` to `unaryMinus` and some variants of `per` to `divide` for consistent naming.  Overloads of `divide` may be renamed to `per`; TBD
    
    Rename `Ratio` measure type back to `Per` to ease code generation. May be renamed back to `Ratio` or `Quotient`; TBD
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    d23b27f View commit details
    Browse the repository at this point in the history
  13. Formatting and linting

    Checkstyle and PMD are disabled for generated files
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    0e6c8d0 View commit details
    Browse the repository at this point in the history
  14. Linting, documentation, and seal nonextensible unit types

    Add `per(TimeUnit)` abstract method to Unit for subclasses to implement. Often returns a velocity
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    acfea50 View commit details
    Browse the repository at this point in the history
  15. Fix import ordering

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    ab96bf3 View commit details
    Browse the repository at this point in the history
  16. Improve equals logic

    Instead of relying on the default record implementation for immutable types and the autogenerated logic for mutables, check for measure equivalence
    
    This allows for comparisons of eg `Measure<DistanceUnit>` to `ImmutableDistance` to `MutDistance` to all work correctly
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    04cb95a View commit details
    Browse the repository at this point in the history
  17. Checkstyle

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    d44ac50 View commit details
    Browse the repository at this point in the history
  18. Consistent API in unit subclasses for non-inherited methods

    For example, `convertFrom` cannot be declared in the base unit class and must therefore be declared and implemented in every subclass, and `getBaseUnit` must be overridden to return the correct type in every subclass
    
    Make composite units consistently use the correct base units
    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    88ecf04 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    0405dff View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    2f7cd05 View commit details
    Browse the repository at this point in the history
  21. Doc fix

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    90da7a9 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    4c71208 View commit details
    Browse the repository at this point in the history
  23. Update epilogue logging

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    0e7a055 View commit details
    Browse the repository at this point in the history
  24. Update cmake build

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    6fefb1c View commit details
    Browse the repository at this point in the history
  25. Linting

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    1239fb6 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    a5c821c View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    469d8dc View commit details
    Browse the repository at this point in the history
  28. Fix Newton definition

    SamCarlberg committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    ef5b23e View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    10081d6 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    e20ee8e View commit details
    Browse the repository at this point in the history
  31. Formatting fixes

    github-actions[bot] committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    3d5134a View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2024

  1. Configuration menu
    Copy the full SHA
    a08c350 View commit details
    Browse the repository at this point in the history
  2. Fix docs typo

    SamCarlberg committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    65e2c8c View commit details
    Browse the repository at this point in the history
  3. Add a timesConversionFactor() method

    Can't overload `times()` due to type erasure
    SamCarlberg committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    d7f42e1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    055b409 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    bbc7784 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ed9204a View commit details
    Browse the repository at this point in the history
  7. Remove Force.mult(Distance) -> Energy function for now

    Not as easy to combine into energy as torque, and it's a less common usecase
    
    Rename existing function to `multAsTorque` for clarity
    
    Add equivalent torque multiplication function to the Force class
    SamCarlberg committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    eedcea4 View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2024

  1. Configuration menu
    Copy the full SHA
    f1d9dc2 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2024

  1. Use Measure input parameters consistently

    Allows for wider compatibility with results of math operations
    SamCarlberg committed Sep 3, 2024
    Configuration menu
    Copy the full SHA
    10bb1af View commit details
    Browse the repository at this point in the history
  2. Add .ofNative factories to PerUnit

    Allows for known `Per` object outputs instead of bounded wildcard `Measure<? extends PerUnit>`
    SamCarlberg committed Sep 3, 2024
    Configuration menu
    Copy the full SHA
    5de0ae9 View commit details
    Browse the repository at this point in the history
  3. Linting

    SamCarlberg committed Sep 3, 2024
    Configuration menu
    Copy the full SHA
    9d2e419 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4d4e61c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7365901 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2024

  1. Consistently use dimension-specific measure types wherever possible

    Allows for more obvious types for readability and access to type-specific methods that would otherwise be unusable (eg `Frequency.asPeriod()`)
    
    Some places must still be generic (eg trapezoid profile constraints and states)
    SamCarlberg committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    6bb4513 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bcdac63 View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2024

  1. Linting

    SamCarlberg committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    2140dec View commit details
    Browse the repository at this point in the history