Skip to content

feat (core-engine): implement multi‑algorithm diff engine (QDiffXCore)#3

Merged
djad04 merged 74 commits intodevfrom
feature/algorithm-manager-core
Jul 6, 2025
Merged

feat (core-engine): implement multi‑algorithm diff engine (QDiffXCore)#3
djad04 merged 74 commits intodevfrom
feature/algorithm-manager-core

Conversation

@djad04
Copy link
Owner

@djad04 djad04 commented Jul 6, 2025

This introduces the foundational QAlgorithmManager module, serving as the central engine for all diffing operations. It provides robust capabilities for managing, selecting, and executing various diffing algorithms (“dtl”, “dmp”), and supports both synchronous and asynchronous (non‑blocking, multithreaded ) execution modes ensuring thread safety, high‑performance diff computations.

Key Features and Components Introduced:

-QAlgorithmManager:
-Centralized interface for calculating diffs (synchronous and asynchronous).
-Automatic algorithm selection based on content characteristics (e.g., text length) with a fallback mechanism.
-Manual algorithm selection .
-Comprehensive error handling and reporting for diff operations.
-Management of execution modes (synchronous/asynchronous).
-Configuration management for algorithms.
-Thread-safe execution of diff algorithms.
QAlgorithmRegistry:
-Singleton pattern for global access to registered diff algorithms.
-Dynamic registration and unregistration of new algorithms.
-Factory for creating algorithm instances (std::function-based unique_ptr).
-Retrieval of algorithm information and capabilities.
-Configuration management for individual algorithms.
-Thread safety with QMutex for concurrent access.
Core Algorithms Integration:
-Full implementation and integration of the DMP (Diff Match Patch) algorithm.
-Full implementation and integration of the DTL (Diff Three-Way Algorithm).
-Standardized QDiffAlgorithm interface for extensibility.
Fundamental Data Structures:
-QDiffResult, QDiffOperation, QDiffChange for structured diff output.
-QAlgorithmCapabilities for algorithm metadata.
-QAlgorithmManagerError for specific error types.
Build System Enhancements:
-Restructured CMake configuration to introduce QDiffXCore as a standalone library.
Testing:
-Initial integration of unit tests for QAlgorithmManager and QAlgorithmRegistry to ensure stability and correctness.

djad04 added 30 commits June 20, 2025 19:06
…me characteristics in DiffAlgorithm interface
- Add complete QDiffAlgorithm abstract interface
- Include DiffOperation enum and DiffChange struct
- Add QDiffResult class for algorithm output
- Implement AlgorithmCapabilities for algorithm metadata
- Support configuration and performance estimation

This merge integrates the core diff algorithm abstraction layer
that will be used by the algorithm manager to support multiple
diff algorithms (DMP, DTL, and future algorithms).
…ons (dmpOperation to QDiffXoperation/ dmpchanges to QDiffXchange)
…ng from DMPAlgorithm (handle it in a different way using calculateLineByLine and calculateCharByChar
✅ Add complete DMP (Diff-Match-Patch) algorithm implementation
- Implements Google's diff-match-patch algorithm with Qt6 modernization
- Supports Auto, LineByLine, and CharByChar diff modes
- Full configuration system with 7 tunable parameters
- Professional line number calculation with left/right tracking
- Unicode support and large file handling (up to 10MB)
- Enterprise-grade error handling and metadata generation
- All QDiffAlgorithm interface methods implemented
- Ready for algorithm manager integration

Technical details:
- Uses native DMP diff_main() with checklines parameter
- Proper operation conversion (INSERT/DELETE/EQUAL)
- Semantic and efficiency cleanup for optimal results
- calculateSimilarity() method for quality metrics
- Professional code structure following enterprise standards
…rithm info methods

-Name ,Description, capabilities  methods
-ConfigKeys
-Constructor
- Add configuration methods (setConfiguration, getConfigurationKeys)
- Add performance estimation methods (estimateComplexity, isRecommendedFor)
- Add calculateSimilarity method for quality metrics
- Add DTL conversion helper method declarations
- Add utility method declarations for line processing
djad04 and others added 27 commits June 27, 2025 23:13
…tation; add TODO comments in DMPAlgorithm and DTLAlgorithm headers
…ug/error reporting

-lastError() to get the last error
-errorMessage() to get the last error message
-lastErrorMessage() to get last error message
- errorOutputEnabled functions to handle debugging
Add initializeDefaultAlgorithms() method to register DTL and DMP algorithms
during QAlgorithmRegistry construction.
add new functions to get/set algorithm configurations and query algorithm metadata
initialize default configurations during registry construction
…ger and AlgorithmRegistry

- Add algorithm configuration management methods to QAlgorithmRegistry and QAlgorithmManager
- Implement new event signals for algorithm state changes and operations
- Add reset functionality to QAlgorithmManager
- Improve error handling with detailed error signals
- Add error state reset in all public methods
- Remove const qualifier from createAlgorithm to allow error emission
- Simplify boolean expressions and improve code readability
- Emit error signals in createAlgorithm for better error reporting
- Added comprehensive unit tests for QAlgorithmManager and QAlgorithmRegistry functionalities, including algorithm registration, error handling, and configuration management.
…thm registration and availability

- Introduced `registerAlgorithmInternal` and `internalGetAvailableAlgorithms` to streamline mutex handling.
- Updated `registerAlgorithm` and `unregisterAlgorithm` to utilize internal methods for improved clarity and efficiency.
- Corrected algorithm registration calls in `initializeDefaultAlgorithms` to use internal methods.
- Adjusted signal emissions to reflect changes in algorithm availability and state management.
Add Unit Tests, Refactor Core AlgorithmManager & Fix Critical Bugs
@djad04 djad04 marked this pull request as ready for review July 6, 2025 19:35
@djad04 djad04 merged commit dc40664 into dev Jul 6, 2025
7 checks passed
djad04 added a commit that referenced this pull request Nov 21, 2025
feat (core-engine): implement multi‑algorithm diff engine (QDiffXCore)
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.

1 participant