Skip to content

Conversation

@Kibnet
Copy link
Owner

@Kibnet Kibnet commented May 26, 2025

Adds a new public method GetElementsInRange(int firstElement, int lastElement) to the IntSet class. This method allows you to enumerate integers from the set that fall within the specified range [min(first, last), max(first, last)].

The enumeration direction (ascending or descending) is determined by the order of firstElement and lastElement.

Key changes include:

  • New private helper methods for bidirectional traversal of the internal Card/byte structure (TraverseRootCardsDirectional, TraverseCardLevelDirectional, TraverseByteLevelDirectional, ProcessBytesDirectional).
  • The existing GetEnumerator() was updated to use the new ascending directional traversal logic, ensuring consistency.
  • Efficient pruning logic is implemented at each level of traversal within GetElementsInRange to skip blocks of numbers that are outside the target range, using a new GetBlockRange helper.
  • Extensive unit tests have been added to IntSetTests.cs to cover various scenarios, including empty sets, ascending/descending ranges, edge cases, gaps in data, negative numbers, and int.MinValue/MaxValue.

Kibnet and others added 4 commits May 27, 2025 11:14
Modifies the GitHub Actions workflow (`.github/workflows/dotnetcore.yml`)
to include a step for running unit tests using `dotnet test`.

This ensures that tests are executed automatically as part of the
CI process after dependencies are restored and before the
solution is packed and published. The tests are run with
the Release configuration.

refactor: Separate CI tests and manual NuGet publication workflows

I've revised the GitHub Actions CI/CD setup for you:

1.  Automated Testing (`ci-tests.yml`):
    - I renamed this from `dotnetcore.yml`.
    - It now triggers on pushes and pull requests to all branches (`**`).
    - It performs checkout, .NET setup, dependency restore, and runs unit tests.
    - I've removed the packaging and publishing steps from this workflow.

2.  Manual NuGet Publication (`manual-publish.yml`):
    - This is a new workflow file.
    - You can trigger it manually via `workflow_dispatch` from the GitHub Actions UI.
    - It contains steps for checkout, .NET setup, restore, packing the solution,
      and publishing to both nuget.org and GitHub Packages.

This change allows for continuous testing on all development branches and
provides you with explicit control over the release and publication of NuGet packages.
Adds a new public method `GetElementsInRange(int firstElement, int lastElement)`
to the `IntSet` class. This method allows you to enumerate integers from the set
that fall within the specified range `[min(first, last), max(first, last)]`.

The enumeration direction (ascending or descending) is determined by the
order of `firstElement` and `lastElement`.

Key changes include:
- New private helper methods for bidirectional traversal of the internal
  Card/byte structure (`TraverseRootCardsDirectional`,
  `TraverseCardLevelDirectional`, `TraverseByteLevelDirectional`,
  `ProcessBytesDirectional`).
- The existing `GetEnumerator()` was updated to use the new ascending
  directional traversal logic, ensuring consistency.
- Efficient pruning logic is implemented at each level of traversal within
  `GetElementsInRange` to skip blocks of numbers that are outside the
  target range, using a new `GetBlockRange` helper.
- Extensive unit tests have been added to `IntSetTests.cs` to cover
  various scenarios, including empty sets, ascending/descending ranges,
  edge cases, gaps in data, negative numbers, and int.MinValue/MaxValue.
@Kibnet Kibnet force-pushed the feature/intset-range-enumeration branch from ea6975e to de9eac2 Compare May 27, 2025 08:43
@Kibnet Kibnet merged commit e0439ba into master May 27, 2025
2 checks passed
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.

2 participants