Convert COBOL merge sort to Java implementation #22
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.
Convert COBOL merge sort to Java implementation
Summary
This PR converts the COBOL merge sort functionality from
merge_sort/merge_sort_test.cblto a modern Java implementation while preserving the core business logic. The conversion replaces file-based COBOL operations with in-memory Java collections and implements the same merge-by-customer-ID and sort-by-contract-ID-descending operations.Key Components Added:
CustomerRecord.java- Java class mapping COBOL record layout with proper field types and formattingMergeSortExample.java- Main implementation with merge algorithm, sorting, and test data generationREADME.md- Documentation explaining the conversion and usage instructionsCore Logic Preserved:
Review & Testing Checklist for Human
Recommended Test Plan:
javac -d . src/main/java/com/example/mergesort/*.java && java com.example.mergesort.MergeSortExampleDiagram
%%{ init : { "theme" : "default" }}%% graph TD COBOL["merge_sort_test.cbl<br/>(Original COBOL)"]:::context CustomerRecord["java-merge-sort/src/main/java/<br/>com/example/mergesort/<br/>CustomerRecord.java"]:::major-edit MergeSortExample["java-merge-sort/src/main/java/<br/>com/example/mergesort/<br/>MergeSortExample.java"]:::major-edit README["java-merge-sort/README.md"]:::major-edit COBOL -->|"Converted to"| CustomerRecord COBOL -->|"Converted to"| MergeSortExample CustomerRecord -->|"Used by"| MergeSortExample MergeSortExample -->|"Creates test data<br/>Merges by customer ID<br/>Sorts by contract ID"| Output["Console Output<br/>(Formatted records)"]:::context subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
pic 9(5)mapped to Javaint,pic x(n)mapped to JavaStringwith proper padding in toString()Link to Devin run: https://app.devin.ai/sessions/0a302785c3114b1294a8a834b33f905e
Requested by: Samir Chaudhry (@schaudhry123)