Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

Summary

This pull request implements the requested feature from issue #125 by adding property operator implementations that support multiple values.

Fixes

Fixes #125

Implementation Details

New Property Operators

1. MultipleValuesPropertyOperator<TLinkAddress>

Extends the existing PropertyOperator to store and manage multiple values for a single property.

Key Features:

  • GetAll(link) - Returns all values for a property
  • GetFirst(link) - Returns the first value (maintains compatibility)
  • Add(link, value) - Adds a value without replacing existing ones
  • Remove(link, value) - Removes a specific value
  • Set(link, values) - Replaces all values with a new set
  • Clear(link) - Removes all values
  • Contains(link, value) - Checks if a value exists
  • Count(link) - Returns the number of values

2. MultipleValuesPropertiesOperator<TLinkAddress>

Extends the existing PropertiesOperator to handle multiple values for object-property combinations.

Key Features:

  • GetAllValues(object, property) - Returns all values for an object-property pair
  • AddValue(object, property, value) - Adds a value
  • RemoveValue(object, property, value) - Removes a specific value
  • SetAllValues(object, property, values) - Replaces all values
  • ClearAllValues(object, property) - Removes all values
  • ContainsValue(object, property, value) - Checks if a value exists
  • CountValues(object, property) - Returns the number of values

Architecture

Both operators follow the existing codebase patterns:

  • Extend LinksOperatorBase<TLinkAddress>
  • Use the same generic constraints as existing operators
  • Maintain compatibility with the current ILinks interface
  • Follow the established coding style and documentation patterns

Test Coverage

Comprehensive test suites have been added for both operators covering:

  • Adding multiple values
  • Removing specific values
  • Setting/replacing all values
  • Clearing all values
  • Counting values
  • Checking value existence
  • Edge cases (non-existent properties, duplicate values, etc.)
  • Multi-object scenarios

Usage Example

// MultipleValuesPropertiesOperator usage
var propertiesOperator = new MultipleValuesPropertiesOperator<ulong>(links);

propertiesOperator.AddValue(person, nameProperty, "John");
propertiesOperator.AddValue(person, nameProperty, "Johnny"); 
propertiesOperator.AddValue(person, nameProperty, "Jon");

var names = propertiesOperator.GetAllValues(person, nameProperty).ToList();
// names contains: ["John", "Johnny", "Jon"]

propertiesOperator.RemoveValue(person, nameProperty, "Johnny");
// names now contains: ["John", "Jon"]

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #125
@konard konard self-assigned this Sep 14, 2025
This commit implements the requested feature from issue #125 by adding two new
property operators that extend the existing functionality to support multiple values:

1. MultipleValuesPropertyOperator<TLinkAddress>
   - Extends PropertyOperator to store and manage multiple values for a single property
   - Key methods: GetAll(), Add(), Remove(), Set(), Clear(), Contains(), Count()

2. MultipleValuesPropertiesOperator<TLinkAddress>
   - Extends PropertiesOperator to handle multiple values for object-property combinations
   - Key methods: GetAllValues(), AddValue(), RemoveValue(), SetAllValues(), etc.

Both operators maintain compatibility with the existing architecture while providing
the requested multiple values functionality. Comprehensive test suites are included
to verify correct behavior for all operations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Add property operator implementations with support for multiple values Add property operator implementations with support for multiple values Sep 14, 2025
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>'
@konard konard marked this pull request as ready for review September 14, 2025 04:57
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.

Add property operator implementations with support for multiple values

2 participants