Feature/implement data related logic for ranges#2
Conversation
…factory methods for consistency - Introduced RangeData abstraction to couple logical ranges with data sequences and domains. - Updated RangeFactory methods to remove type parameters for cleaner usage. - Added TryCreate method for Range with validation and error messaging. - Enhanced Distance method in domain interfaces to ensure accurate step calculations. - Revised tests to reflect changes in range factory methods and ensure correctness. - Updated project metadata and CI/CD configurations for new data module.
…matches expected logical elements
…y and data integrity
…, slicing, and domain interactions
…uate performance and memory usage
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Introduces the new Intervals.NET.Data package (RangeData + extensions) and updates domains/range APIs to support centralized validation and consistent right-biased semantics, alongside CI/test/benchmark/docs updates.
Changes:
- Added
Intervals.NET.Data(RangeData core type, extension methods, enumerable helpers) plus a new test project and benchmarks. - Refactored range/domain APIs (e.g., centralized range-bound validation; domain
Distancestandardized tolong) and updated affected tests. - Added CI workflow and expanded documentation/bench artifacts for RangeData and right-biased semantics.
Reviewed changes
Copilot reviewed 48 out of 49 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Intervals.NET.Tests/RangeStringParserTests.cs | Simplifies CultureInfo usage in parsing tests. |
| tests/Intervals.NET.Tests/RangeFactoryTests.cs | Updates factory calls to rely on type inference. |
| tests/Intervals.NET.Tests/RangeFactoryInterpolationTests.cs | Updates factory calls to rely on type inference. |
| tests/Intervals.NET.Tests/RangeExtensionsTests.cs | Updates factory calls to rely on type inference. |
| tests/Intervals.NET.Tests/Intervals.NET.Tests.csproj | Adds reference to new Data project. |
| tests/Intervals.NET.Domain.Extensions.Tests/Variable/RangeDomainExtensionsTests.cs | Updates factory calls to rely on type inference. |
| tests/Intervals.NET.Domain.Extensions.Tests/Fixed/RangeDomainExtensionsTests.cs | Updates factory calls to rely on type inference. |
| tests/Intervals.NET.Domain.Default.Tests/Calendar/StandardDateTimeBusinessDaysVariableStepDomainTests.cs | Fixes namespace and uses fully-qualified DateTime. |
| tests/Intervals.NET.Data/Extensions/RangeDataExtensionsTests.cs | (Referenced in PR) Data-related tests under tests/Intervals.NET.Data. |
| tests/Intervals.NET.Data.Tests/RangeDataTests.cs | Adds comprehensive unit tests for RangeData slicing/indexing. |
| tests/Intervals.NET.Data.Tests/Intervals.NET.Data.Tests.csproj | New test project for Intervals.NET.Data. |
| tests/Intervals.NET.Data.Tests/Helpers/TestDomains.cs | Adds stub domains for domain-equality and overflow testing. |
| tests/Intervals.NET.Data.Tests/Extensions/RangeData_EqualityAndSliceTests.cs | Tests equality semantics and slicing behavior. |
| tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensions_TrimOverflowTests.cs | Tests trim overflow guard behavior. |
| tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensions_IsValidEdgeTests.cs | Adds edge-case validation tests for IsValid. |
| tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensions_DomainValidationTests.cs | Tests domain equality validation behavior in extensions. |
| tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensions_AdjacencyAndValidityTests.cs | Tests adjacency helpers and sequence-length validation. |
| tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensionsTests.cs | Adds tests for RangeData set operations + trims + containment. |
| src/Intervals.NET/Range.cs | Centralizes range bound validation and exposes IsValid. |
| src/Intervals.NET/Intervals.NET.csproj | Bumps Intervals.NET package version. |
| src/Intervals.NET/Factories/RangeFactory.cs | Adds TryCreate factory to avoid throwing for invalid bounds. |
| src/Intervals.NET.Data/RangeData.cs | Adds core RangeData type with indexers/slicing/equality semantics. |
| src/Intervals.NET.Data/Intervals.NET.Data.csproj | New Data package project metadata + references. |
| src/Intervals.NET.Data/Extensions/RangeDataExtensions.cs | Adds right-biased union/intersect + trimming/relationship/validation helpers. |
| src/Intervals.NET.Data/Extensions/EnumerableExtensions.cs | Adds ToRangeData helper for IEnumerable<T>. |
| src/Domain/Intervals.NET.Domain.Extensions/Intervals.NET.Domain.Extensions.csproj | Bumps Domain.Extensions package version. |
| src/Domain/Intervals.NET.Domain.Default/Intervals.NET.Domain.Default.csproj | Bumps Domain.Default package version. |
| src/Domain/Intervals.NET.Domain.Abstractions/Intervals.NET.Domain.Abstractions.csproj | Bumps Domain.Abstractions package version. |
| src/Domain/Intervals.NET.Domain.Abstractions/IVariableStepDomain.cs | Simplifies interface (inherits IRangeDomain<T> only). |
| src/Domain/Intervals.NET.Domain.Abstractions/IRangeDomain.cs | Adds Distance(T,T) returning long. |
| src/Domain/Intervals.NET.Domain.Abstractions/IFixedStepDomain.cs | Simplifies interface (inherits IRangeDomain<T> only). |
| src/Domain/Intervals.NET.Domain.Default/Calendar/StandardDateTimeBusinessDaysVariableStepDomain.cs | Changes Distance return type to long. |
| src/Domain/Intervals.NET.Domain.Default/Calendar/StandardDateOnlyBusinessDaysVariableStepDomain.cs | Changes Distance return type to long. |
| benchmarks/Results/Intervals.NET.Benchmarks.Benchmarks.RangeDataExtensionsBenchmarks-report-github.md | Adds RangeData extensions benchmark report. |
| benchmarks/Results/Intervals.NET.Benchmarks.Benchmarks.RangeDataBenchmarks-report-github.md | Adds RangeData benchmark report. |
| benchmarks/Intervals.NET.Benchmarks/Intervals.NET.Benchmarks.csproj | Adds reference to Data project. |
| benchmarks/Intervals.NET.Benchmarks/Benchmarks/RangeDataExtensionsBenchmarks.cs | Adds benchmarks for RangeData extensions. |
| benchmarks/Intervals.NET.Benchmarks/Benchmarks/RangeDataBenchmarks.cs | Adds benchmarks for RangeData core operations. |
| benchmarks/Intervals.NET.Benchmarks/Benchmarks/DomainOperationsBenchmarks.cs | Removes unused domain abstractions import. |
| benchmarks/Intervals.NET.Benchmarks/Benchmarks/ConstructionBenchmarks.cs | Updates range factory calls to rely on type inference. |
| README.md | Adds RangeData documentation section + TOC update. |
| RANGEDATA_ZERO_ALLOCATION_OPTIMIZATION.md | Adds supporting design/optimization notes for RangeData union. |
| RANGEDATA_UNION_FINAL_OPTIMIZED.md | Adds supporting design/optimization notes for RangeData union. |
| RANGEDATA_EXTENSIONS_IMPLEMENTATION.md | Adds implementation write-up for RangeData extensions. |
| RANGEDATA_EXTENSIONS_CORRECTED.md | Adds corrected behavior/invariant documentation. |
| RANGEDATA_CONSISTENT_RIGHT_BIAS.md | Adds rationale/docs for consistent right-bias semantics. |
| RANGEDATA_CENTRALIZED_VALIDATION.md | Adds rationale/docs for centralized domain validation. |
| Intervals.NET.sln | Adds Data projects/tests/benchmarks + workflow + benchmark reports to solution. |
| .github/workflows/intervals-net-data.yml | Adds CI/CD workflow for Intervals.NET.Data. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensions_TrimOverflowTests.cs
Show resolved
Hide resolved
benchmarks/Intervals.NET.Benchmarks/Benchmarks/RangeDataBenchmarks.cs
Outdated
Show resolved
Hide resolved
benchmarks/Intervals.NET.Benchmarks/Benchmarks/RangeDataExtensionsBenchmarks.cs
Outdated
Show resolved
Hide resolved
…validation and improved error handling - Refine RangeData indexer to validate sub-range finiteness and containment, throwing specific exceptions for invalid cases - Update TryGet methods to ensure points and sub-ranges are within bounds before accessing data - Align index calculations with range inclusivity for accurate data mapping - Improve XML documentation for IRangeDomain to clarify complexity of Distance implementations - Update benchmarks and tests for readonly domain fields and minor cleanup - Clarify package description and README section for RangeData usage and validation
…ject dependencies
…ject dependencies
…omain.Abstractions workflow
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 54 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ion for TryCreate method
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 54 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…toration, building, and testing
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 54 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 52 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Domain/Intervals.NET.Domain.Extensions/Variable/RangeDomainExtensions.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 52 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensionsTests.cs
Outdated
Show resolved
Hide resolved
tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensionsTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 52 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensionsTests.cs
Outdated
Show resolved
Hide resolved
…element counts for ranges
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 52 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…larity and consistency
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 52 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ons to clarify performance characteristics and equality semantics
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 84 out of 86 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@blaze6950 I've opened a new pull request, #3, to work on those changes. Once the pull request is ready, I'll request review from you. |
…boundaries (#3) * Initial plan * Add test case demonstrating bug with empty subranges in exclusive-start parents Co-authored-by: blaze6950 <32897401+blaze6950@users.noreply.github.com> * Fix bug where empty subranges with negative indices returned false instead of empty RangeData Co-authored-by: blaze6950 <32897401+blaze6950@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: blaze6950 <32897401+blaze6950@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 84 out of 86 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces significant improvements to the RangeData extensions, focusing on two main areas: centralized domain validation and consistent right-biased semantics for set operations. The changes enhance maintainability, correctness, and predictability of the API, while also updating documentation and project configuration to support these improvements.
Centralized domain validation and consistent right-bias:
ValidateDomainEqualitymethod to centralize and standardize runtime domain validation across all RangeData extension methods, eliminating duplicate checks and ensuring correct behavior when domains have instance-specific state.Intersect,Union,IsTouching, etc.) to use the centralized validation method, reducing code duplication and making error messages consistent and clear.Set operation semantics and documentation:
IntersectandUnionmethods to consistently use right-biased semantics, meaning the right operand's (typically fresher) data is always preferred in overlaps, aligning with real-world scenarios like cache updates and time-series data.Project and CI/CD configuration:
.github/workflows/intervals-net-data.yml) for CI/CD of theIntervals.NET.Datapackage, including build, test, and NuGet publishing steps.Intervals.NET.sln) to include the new Data projects and benchmarks, ensuring they are built and tested as part of the solution. [1] [2] [3] [4] [5]Supporting materials:
These changes collectively make the RangeData extensions more robust, maintainable, and intuitive for end-users.