Class TaskPriorityQueue
java.lang.Object
eu.svjatoslav.alyverkko_cli.commands.task_processor.TaskPriorityQueue
A custom priority queue implementation for TaskQueueEntry that maintains tasks in priority order.
Uses a TreeSet for efficient insertion, polling, and iteration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a task to the priority queue.Returns all tasks in the queue in order of priority (highest priority first).poll()Removes and returns the highest priority task from the queue.voidremoveIf(Predicate<TaskProcessorCommand.TaskQueueEntry> predicate) Removes tasks matching the given predicate.
-
Constructor Details
-
TaskPriorityQueue
public TaskPriorityQueue()Constructs a new empty task priority queue.
-
-
Method Details
-
add
Adds a task to the priority queue.- Parameters:
task- the task to add (must not be null)
-
poll
Removes and returns the highest priority task from the queue.- Returns:
- the highest priority task, or null if the queue is empty
-
removeIf
Removes tasks matching the given predicate.- Parameters:
predicate- the condition for removal (must not be null)
-
getAllTasks
Returns all tasks in the queue in order of priority (highest priority first).- Returns:
- a new list containing all tasks in priority order
-