We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86cdbcd commit 07da5b0Copy full SHA for 07da5b0
src/main/java/com/thealgorithms/scheduling/AgingScheduling.java
@@ -33,10 +33,22 @@ public AgingScheduling() {
33
taskQueue = new LinkedList<>();
34
}
35
36
+ /**
37
+ * Adds a task to the scheduler with a given priority.
38
+ *
39
+ * @param name name of the task
40
+ * @param priority priority of the task
41
+ */
42
public void addTask(String name, int priority) {
43
taskQueue.offer(new Task(name, priority));
44
45
46
47
+ * Schedules the next task based on the priority and wait time.
48
+ * The priority of a task increases with the time it spends waiting.
49
50
+ * @return name of the next task to be executed
51
52
public String scheduleNext() {
53
if (taskQueue.isEmpty()) {
54
return null;
0 commit comments