Skip to content

Commit af76b23

Browse files
committed
Fix
1 parent b2d18b8 commit af76b23

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/com/thealgorithms/scheduling/SlackTimeScheduling.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,22 @@ public SlackTimeScheduling() {
3737
tasks = new ArrayList<>();
3838
}
3939

40+
/**
41+
* Adds a task to the scheduler.
42+
*
43+
* @param name the name of the task
44+
* @param executionTime the time required to execute the task
45+
* @param deadline the deadline by which the task must be completed
46+
*/
4047
public void addTask(String name, int executionTime, int deadline) {
4148
tasks.add(new Task(name, executionTime, deadline));
4249
}
4350

51+
/**
52+
* Schedules the tasks based on their slack time.
53+
*
54+
* @return the order in which the tasks should be executed
55+
*/
4456
public List<String> scheduleTasks() {
4557
tasks.sort(Comparator.comparingInt(Task::getSlackTime));
4658
List<String> scheduledOrder = new ArrayList<>();

0 commit comments

Comments
 (0)