Skip to content

Improve quantity value#126

Merged
fkleedorfer merged 6 commits into
mainfrom
improve-quantity-value
Feb 9, 2026
Merged

Improve quantity value#126
fkleedorfer merged 6 commits into
mainfrom
improve-quantity-value

Conversation

@fkleedorfer
Copy link
Copy Markdown
Contributor

@fkleedorfer fkleedorfer commented Feb 9, 2026

Fix Quantity, improve QuantityValue

Added

  • Add static factory methods QuantityValue.of(value, unit) with various value argument types that can be used to instantiate the
    BigDecimal value used internally.

  • Add dynamic factory methods in Unit.quantityValue(value) with various value argument types that can be used to instantiate the
    BigDecimal value used internally.

  • Add delegate methods for many BigDecimal methods to QuantityValue to allow for mathematical operations with
    automatic unit conversion, for example:

    QuantityValue mVal = Qudt.Units.M.quantityValue(20);
    QuantityValue ftVal = Qudt.Units.FT.quantityValue(1);
    QuantityValue mValResult = mVal.add(ftVal);
    

Fixed

  • Fix wrong definition of Quantity. It used to encapsulate a Set of QuantityValue, which never made sense. With
    this change, it encapsulates a QuantityValue and a QuantityKind, conforming to the definition of the concept in QUDT.

  • Update dependencies

### Added

- Add static factory methods `QuantityValue.of(value, unit)` with various value argument types that can be used to instantiate the
  `BigDecimal` value used internally.

- Add dynamic factory methods in `Unit.quantityValue(value)` with various value argument types that can be used to instantiate the
  `BigDecimal` value used internally.

- Add delegate methods for many `BigDecimal` methods to `QuantityValue` to allow for mathematical operations with
  automatic unit conversion, for example:

  ```
  QuantityValue mVal = Qudt.Units.M.quantityValue(20);
  QuantityValue ftVal = Qudt.Units.FT.quantityValue(1);
  QuantityValue mValResult = mVal.add(ftVal);
  ```

### Fixed

- Fix wrong definition of `Quantity`. It used to encapsulate a Set of `QuantityValue`, which never made sense. With
  this change, it encapsulates a `QuantityValue` and a `QuantityKind`, conforming to the definition of the concept in QUDT.
@fkleedorfer fkleedorfer merged commit 5fc468d into main Feb 9, 2026
1 check passed
@fkleedorfer fkleedorfer deleted the improve-quantity-value branch February 9, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant