File tree 1 file changed +12
-0
lines changed
src/main/java/com/thealgorithms/scheduling
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,22 @@ public SlackTimeScheduling() {
37
37
tasks = new ArrayList <>();
38
38
}
39
39
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
+ */
40
47
public void addTask (String name , int executionTime , int deadline ) {
41
48
tasks .add (new Task (name , executionTime , deadline ));
42
49
}
43
50
51
+ /**
52
+ * Schedules the tasks based on their slack time.
53
+ *
54
+ * @return the order in which the tasks should be executed
55
+ */
44
56
public List <String > scheduleTasks () {
45
57
tasks .sort (Comparator .comparingInt (Task ::getSlackTime ));
46
58
List <String > scheduledOrder = new ArrayList <>();
You can’t perform that action at this time.
0 commit comments