Fix Count logic bug in C# and C++ implementations #413
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.
Summary
Fixes the Count logic bug described in issue #359 where the Count method had incorrect logic when either source or target was 'any'.
Problem Description
The bug was in the Count method (and related Each method) where when checking links with partial restrictions:
valuevariable that got overwritten when both conditions were checkedsource == any,valuewas set totargettarget == any,valuewas overwritten withsource, losing the previous assignmentSolution
Changed the logic to handle each case separately:
source==anyandtarget==anycases independently with separate conditional blocksFiles Changed
C# Implementation
csharp/Platform.Data.Doublets/Memory/Split/Generic/SplitMemoryLinksBase.cs(lines 393-406)C++ Implementation
cpp/Platform.Data.Doublets/Memory/Split/Generic/SplitMemoryLinksBase.h(3 locations):Test/Example
examples/count_logic_test.csdemonstrating the fix with test casesCode Changes
Old (buggy) logic:
New (fixed) logic:
Test Plan
Fixes #359
🤖 Generated with Claude Code