From 14f097c989da5f42edb10fd20703579a82888d99 Mon Sep 17 00:00:00 2001 From: konard Date: Sun, 14 Sep 2025 11:21:01 +0300 Subject: [PATCH 1/3] Initial commit with task details for issue #52 Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: https://github.com/linksplatform/Data.Doublets/issues/52 --- CLAUDE.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..59bfa1777 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,5 @@ +Issue to solve: https://github.com/linksplatform/Data.Doublets/issues/52 +Your prepared branch: issue-52-3f2f1389 +Your prepared working directory: /tmp/gh-issue-solver-1757838004522 + +Proceed. \ No newline at end of file From 03675d26d699962138a9e8d03cf3e59645043706 Mon Sep 17 00:00:00 2001 From: konard Date: Sun, 14 Sep 2025 11:30:33 +0300 Subject: [PATCH 2/3] Add console logging ILinks decorator for debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This decorator provides console output for ILinks operations to assist with debugging. It logs Create, Update, Delete, and Count operations with before/after states and restriction parameters. Features: - Logs Create operations showing before and after link states - Logs Update operations showing before and after link states - Logs Delete operations showing before and after link states - Logs Count operations showing restrictions and result count - Uses System.Console.WriteLine for immediate console output - Follows existing decorator patterns in the codebase 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../ConsoleLoggingDecoratorTests.cs | 57 +++++++++++++++++++ .../Decorators/ConsoleLoggingDecorator.cs | 53 +++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 csharp/Platform.Data.Doublets.Tests/ConsoleLoggingDecoratorTests.cs create mode 100644 csharp/Platform.Data.Doublets/Decorators/ConsoleLoggingDecorator.cs diff --git a/csharp/Platform.Data.Doublets.Tests/ConsoleLoggingDecoratorTests.cs b/csharp/Platform.Data.Doublets.Tests/ConsoleLoggingDecoratorTests.cs new file mode 100644 index 000000000..7c7e67573 --- /dev/null +++ b/csharp/Platform.Data.Doublets.Tests/ConsoleLoggingDecoratorTests.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using System.Numerics; +using Platform.Data.Doublets.Decorators; +using Xunit; + +using Platform.Memory; + +using Platform.Data.Doublets.Memory.United.Generic; + +namespace Platform.Data.Doublets.Tests +{ + public static class ConsoleLoggingDecoratorTests + { + [Fact] + public static void BasicConsoleLoggingTest() + { + Using(links => + { + // Create a link + var link = links.Create(); + + // Update it + links.Update(link, link, link); + + // Count links + var count = links.Count(); + + // Delete the link + links.Delete(link); + }); + } + + [Fact] + public static void ConsoleLoggingWithRestrictionsTest() + { + Using(links => + { + var link1 = links.Create(); + var link2 = links.Create(); + + // Test with restrictions + var count = links.Count(new[] { links.Constants.Any, link1, links.Constants.Any }); + + links.Delete(link1); + links.Delete(link2); + }); + } + + private static void Using(Action> action) where TLinkAddress : IUnsignedNumber, IShiftOperators, IBitwiseOperators, IMinMaxValue, IComparisonOperators + { + var unitedMemoryLinks = new UnitedMemoryLinks(new HeapResizableDirectMemory()); + ConsoleLoggingDecorator decoratedStorage = new(unitedMemoryLinks); + action(decoratedStorage); + } + } +} \ No newline at end of file diff --git a/csharp/Platform.Data.Doublets/Decorators/ConsoleLoggingDecorator.cs b/csharp/Platform.Data.Doublets/Decorators/ConsoleLoggingDecorator.cs new file mode 100644 index 000000000..a4f41ea39 --- /dev/null +++ b/csharp/Platform.Data.Doublets/Decorators/ConsoleLoggingDecorator.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; +using System.Numerics; +using Platform.Delegates; + +namespace Platform.Data.Doublets.Decorators; + +public class ConsoleLoggingDecorator : LinksDecoratorBase where TLinkAddress : IUnsignedNumber +{ + public ConsoleLoggingDecorator(ILinks links) : base(links: links) + { + } + + public override TLinkAddress Create(IList? substitution, WriteHandler? handler) + { + WriteHandlerState handlerState = new(@continue: _constants.Continue, @break: _constants.Break, handler: handler); + return base.Create(substitution: substitution, handler: (before, after) => + { + handlerState.Handle(before: before, after: after); + System.Console.WriteLine(value: $"Create. Before: {new Link(values: before)}. After: {new Link(values: after)}"); + return _constants.Continue; + }); + } + + public override TLinkAddress Update(IList? restriction, IList? substitution, WriteHandler? handler) + { + WriteHandlerState handlerState = new(@continue: _constants.Continue, @break: _constants.Break, handler: handler); + return base.Update(restriction: restriction, substitution: substitution, handler: (before, after) => + { + handlerState.Handle(before: before, after: after); + System.Console.WriteLine(value: $"Update. Before: {new Link(values: before)}. After: {new Link(values: after)}"); + return _constants.Continue; + }); + } + + public override TLinkAddress Delete(IList? restriction, WriteHandler? handler) + { + WriteHandlerState handlerState = new(@continue: _constants.Continue, @break: _constants.Break, handler: handler); + return base.Delete(restriction: restriction, handler: (before, after) => + { + handlerState.Handle(before: before, after: after); + System.Console.WriteLine(value: $"Delete. Before: {new Link(values: before)}. After: {new Link(values: after)}"); + return _constants.Continue; + }); + } + + public override TLinkAddress Count(IList? restriction) + { + var result = base.Count(restriction: restriction); + var restrictionStr = restriction == null ? "null" : $"[{string.Join(", ", restriction)}]"; + System.Console.WriteLine(value: $"Count. Restriction: {restrictionStr}. Result: {result}"); + return result; + } +} \ No newline at end of file From 09a8c40dd9bad8baf5be2d305e9d88acee037d34 Mon Sep 17 00:00:00 2001 From: konard Date: Sun, 14 Sep 2025 11:30:56 +0300 Subject: [PATCH 3/3] Remove CLAUDE.md - Claude command completed --- CLAUDE.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 59bfa1777..000000000 --- a/CLAUDE.md +++ /dev/null @@ -1,5 +0,0 @@ -Issue to solve: https://github.com/linksplatform/Data.Doublets/issues/52 -Your prepared branch: issue-52-3f2f1389 -Your prepared working directory: /tmp/gh-issue-solver-1757838004522 - -Proceed. \ No newline at end of file