Improve quantity value#126
Merged
Merged
Conversation
### 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Quantity, improve QuantityValue
Added
Add static factory methods
QuantityValue.of(value, unit)with various value argument types that can be used to instantiate theBigDecimalvalue used internally.Add dynamic factory methods in
Unit.quantityValue(value)with various value argument types that can be used to instantiate theBigDecimalvalue used internally.Add delegate methods for many
BigDecimalmethods toQuantityValueto allow for mathematical operations withautomatic unit conversion, for example:
Fixed
Fix wrong definition of
Quantity. It used to encapsulate a Set ofQuantityValue, which never made sense. Withthis change, it encapsulates a
QuantityValueand aQuantityKind, conforming to the definition of the concept in QUDT.Update dependencies