File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/main/java/com/thealgorithms/scheduling Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff 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 <>();
You can’t perform that action at this time.
0 commit comments