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

Redesign UnitSystem to support non-SI systems and configurable default units #709

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Commits on Sep 28, 2019

  1. Create QuantityType -> UnitInfo associations (DefaultUnits) in UnitSy…

    …stem
    
    - UnitSystem holds the list of default units for each (compatible?) quantity type and a method (GetDefaultUnitInfo) that provides the corresponding UnitInfo given a QuantityType
    - All methods in Quantity that use a UnitSystem now use the new GetDefaultUnitInfo
    - Added a method (in UnitSystem) for creating derived unit systems(WithDefaultUnit), providing a new QuantityType->UnitInfo association and optionally a new BaseUnits definition (as currently used by Equals and visible in public ctor- otherwise obsolete?)
    lipchev committed Sep 28, 2019
    Configuration menu
    Copy the full SHA
    33d5a51 View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2019

  1. Added tests for the new public methods in UnitSystem

    - updated the comments and invalid arguments checks
    - added a few tests for those cases
    
    a few question marks remain (marked with TODOs)
    lipchev committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    75175e7 View commit details
    Browse the repository at this point in the history
  2. mostly cosmetic modifications

    - renamed some tests, added comments here and there
    - WithDefaultUnit : added a check for the compatibility between QuantityType and UnitInfo passed in (also added a test for this)
    lipchev committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    4dcc1ac View commit details
    Browse the repository at this point in the history
  3. use existing GetInfo(quantityType) method

    - had missed this one
    lipchev committed Sep 29, 2019
    Configuration menu
    Copy the full SHA
    0b69e3b View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2019

  1. UnitSystem in UnitDefinition schema (for Volume)

    - added an association (1:0..1) between UnitSystem and Unit (kept the name 'BaseUnit' instead of the previously considered 'DefaultUnit')
    - added an association (1:0..n) between Unit and UnitSystem- this would be used to generate list of units for a quantity in a particular unit system (not an exhaustive list, needs a review)
    lipchev committed Oct 5, 2019
    Configuration menu
    Copy the full SHA
    ff000d4 View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2019

  1. UnitSystem code generation

    - refactored the UnitSystem- moving the BaseUnits to BaseUnitSystem (SI derived from BaseUnitSystem), extended the unit mappings with the UnitSystemInfo class (containing both default and common/derived units)
    - updated the JsonTypes and created the  UnitSystemInfoGenerator (TODO WRC)
    - updated existing UnitSystemTests that tested for equality/BaseUnits (almost all in fact) to use the BaseUnitSystem instead (as the IEquatble/BaseUnits interface was pushed down)
    - added several more unit-system mappings to the UnitDefinitions (Acceleration, AmountOfSubstance, Area, Energy & Length)
    - commented (temporary) part of the Ctor_WithValueAndSIUnitSystem_ReturnsQuantityWithSIUnitOrThrowsArgum test (testing for support SI support)
    lipchev committed Nov 11, 2019
    Configuration menu
    Copy the full SHA
    d71900e View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2020

  1. UnitSystem equality, BaseUnits for BaseUnitSystem + tests

    - UnitSystem/BaseUnitSystem Equality contract based on the base (default) unit for each quantity
    - BaseUnits for BaseUnitSystem created from the provided unit associations
    - added unit system associations for all SI base types (Length, Mass, Duration etc.)
    - tests for the UnitSystem construction/derivation
    lipchev committed Oct 5, 2020
    Configuration menu
    Copy the full SHA
    d88e2e7 View commit details
    Browse the repository at this point in the history
  2. updated the Astronomical unit system

    - updated the default units (as per https://en.wikipedia.org/wiki/Astronomical_system_of_units)
    - fixed the docstring
    lipchev committed Oct 5, 2020
    Configuration menu
    Copy the full SHA
    b844f26 View commit details
    Browse the repository at this point in the history
  3. added static acess variables for all UnitSystems

    in order to avoid breaking the namespace (UnitSystem.SI) all static instances were added to the UnitSystem.Definition (partial class)
    lipchev committed Oct 5, 2020
    Configuration menu
    Copy the full SHA
    6ef823f View commit details
    Browse the repository at this point in the history
  4. added tests for supported unit systems (Ctor/As/ToUnit)

    - fixed typo in unit system for Length
    - Ctor_UnitSystem_ThrowsArgumentExceptionIfNotSupported
    - Ctor_WithNullUnitSystem_ThrowsArgumentNullException
    - As_UnitSystem_ThrowsArgumentExceptionIfNotSupported
    - As_WithNullUnitSystem_ThrowsArgumentNullException
    - To_UnitSystem_ThrowsArgumentExceptionIfNotSupported
    - ToUnit_WithNullUnitSystem_ThrowsNullException
    lipchev committed Oct 5, 2020
    Configuration menu
    Copy the full SHA
    a8f022d View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2020

  1. merged upstream & fixed issues with nullable ref types

    - merged all upstream modifications
    - fixed nullability issues in UnitSystem
    - the Lazy<..> BaseUnits constructor was made protected
    - marked all tests that rely solely on BaseUnits as Obsolete (with error=false)
    - removed some obsolete tests from MassConcentration (tesing for default unit system units)
    lipchev committed Oct 6, 2020
    Configuration menu
    Copy the full SHA
    784ef10 View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2021

  1. merged from upstream

    lipchev committed Mar 7, 2021
    Configuration menu
    Copy the full SHA
    9d5c86f View commit details
    Browse the repository at this point in the history
  2. removed SupportsSIUnitSystem in favor of the As_UnitSystem_ThrowsArgu…

    …mentExceptionIfNotSupported tests
    lipchev committed Mar 7, 2021
    Configuration menu
    Copy the full SHA
    e45efe8 View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2021

  1. Create manual.yml

    where is the run button!?
    lipchev authored Apr 27, 2021
    Configuration menu
    Copy the full SHA
    e027e7c View commit details
    Browse the repository at this point in the history
  2. Revert "Create manual.yml"

    This reverts commit e027e7c.
    lipchev committed Apr 27, 2021
    Configuration menu
    Copy the full SHA
    cbdbe19 View commit details
    Browse the repository at this point in the history

Commits on Apr 29, 2021

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

Commits on May 1, 2021

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

Commits on Aug 13, 2022

  1. - fixed the test for WithDefaultUnit_GivenNullForDerivedUnits_Returns…

    …UnitSystemWithOldDerivedUnits_IncludingTheNewBaseUnit
    lipchev committed Aug 13, 2022
    Configuration menu
    Copy the full SHA
    dfe0bd2 View commit details
    Browse the repository at this point in the history