Convert COBOL merge sort implementation to Java #24
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 implementation to Java
Summary
This PR adds a complete Java implementation that replicates the functionality of the existing COBOL merge sort program (
merge_sort/merge_sort_test.cbl). The implementation includes:Comparable<CustomerRecord>with fields matching the COBOL record structure (customer ID, names, contract ID, comment)The Java version uses in-memory Collections instead of direct file processing, leveraging Java's built-in sorting capabilities while maintaining the same logical behavior and output format as the original COBOL implementation.
Review & Testing Checklist for Human
Recommended test plan: Compile and run
java com.example.mergesort.MergeSortMainand verify the output shows correct customer ID ascending merge (1,3,5,10,24,25,30,50,75,85,999) followed by contract ID descending sort (12323,8765,7725,5423,5050,4567,3331,1610,1175,653,247).Diagram
%%{ init : { "theme" : "default" }}%% graph TD COBOL["merge_sort/merge_sort_test.cbl"]:::context CustomerRecord["java-merge-sort/src/.../CustomerRecord.java"]:::major-edit MergeSortProcessor["java-merge-sort/src/.../MergeSortProcessor.java"]:::major-edit MergeSortMain["java-merge-sort/src/.../MergeSortMain.java"]:::major-edit README["java-merge-sort/README.md"]:::major-edit COBOL -->|"converted to"| CustomerRecord COBOL -->|"logic replicated in"| MergeSortProcessor COBOL -->|"workflow replicated in"| MergeSortMain CustomerRecord -->|"used by"| MergeSortProcessor MergeSortProcessor -->|"used by"| MergeSortMain 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
toString()method in CustomerRecord uses specific field widths (5,50,50,5,25) to match COBOL PIC clausesLink to Devin run: https://app.devin.ai/sessions/7351953a888a46b5bef1232524732046
Requested by: @schaudhry123