Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ProcessDetails and PreemptivePriorityScheduling #5448

Merged
merged 4 commits into from
Sep 11, 2024

Conversation

doxxx93
Copy link
Contributor

@doxxx93 doxxx93 commented Sep 10, 2024

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

Changes

Removed internal Process class from PreemptivePriorityScheduling
Updated PreemptivePriorityScheduling to use ProcessDetails from com.thealgorithms.devutils.entities
Modified PreemptivePrioritySchedulingTest to work with ProcessDetails
Updated ProcessDetails to include a priority field and relevant constructor

Motivation

This change brings PreemptivePriorityScheduling in line with other scheduling algorithms in the project (FCFSScheduling, RRScheduling, SJFScheduling, SRTFScheduling) which all use the common ProcessDetails class. This improves consistency across the codebase and makes it easier to maintain and extend the scheduling algorithms.
Implementation Details

The Process class previously defined within PreemptivePriorityScheduling has been removed.
PreemptivePriorityScheduling now uses ProcessDetails for all process-related operations.
The priority field has been added to ProcessDetails along with getter and setter methods.
A new constructor has been added to ProcessDetails to include the priority when creating a new process.
The scheduling logic in PreemptivePriorityScheduling has been updated to work with ProcessDetails objects.
Test cases in PreemptivePrioritySchedulingTest have been updated to use ProcessDetails.

@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.03%. Comparing base (65e3264) to head (d3d3bc8).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5448      +/-   ##
============================================
+ Coverage     52.00%   52.03%   +0.03%     
- Complexity     3235     3238       +3     
============================================
  Files           524      524              
  Lines         15169    15181      +12     
  Branches       2889     2888       -1     
============================================
+ Hits           7889     7900      +11     
+ Misses         6957     6956       -1     
- Partials        323      325       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alxkm
Copy link
Contributor

alxkm commented Sep 11, 2024

Thank you for your contribution

@alxkm alxkm merged commit 648572a into TheAlgorithms:master Sep 11, 2024
5 checks passed
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.

3 participants