Class PriorityQueue<T>

java.lang.Object
ghidra.util.datastruct.PriorityQueue<T>

public class PriorityQueue<T> extends Object
Maintains a list of objects in priority order where priority is just an integer value. The object with the lowest priority number can be retrieved using getFirst() and the object with the highest priority number can be retrieved using getLast().
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T obj, int priority)
    Adds the given object to the queue at the appropriate insertion point based on the given priority.
    void
    Removes all objects from the queue.
    Returns the object with the lowest priority number in the queue.
    Returns the priority of the object with the lowest priority in the queue.
    Returns the object with the highest priority number in the queue.
    Returns the priority of the object with the highest priority in the queue.
    boolean
    Returns true if the queue is empty.
    Removes and returns the object with the lowest priority number in the queue.
    Removes and returns the object with the highest priority number in the queue.
    int
    Returns the number of objects in the queue.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PriorityQueue

      public PriorityQueue()
  • Method Details

    • add

      public void add(T obj, int priority)
      Adds the given object to the queue at the appropriate insertion point based on the given priority.
      Parameters:
      obj - the object to be added.
      priority - the priority assigned to the object.
    • size

      public int size()
      Returns the number of objects in the queue.
    • isEmpty

      public boolean isEmpty()
      Returns true if the queue is empty.
    • getFirst

      public T getFirst()
      Returns the object with the lowest priority number in the queue. If more than one object has the same priority, then the object that was added to the queue first is considered to have the lower priority value. Null is returned if the queue is empty.
    • getFirstPriority

      public Integer getFirstPriority()
      Returns the priority of the object with the lowest priority in the queue. Null returned if the queue is empty.
    • getLast

      public T getLast()
      Returns the object with the highest priority number in the queue. If more than one object has the same priority, then the object that was added to the queue last is considered to have the higher priority value. Null is returned if the queue is empty.
    • getLastPriority

      public Integer getLastPriority()
      Returns the priority of the object with the highest priority in the queue. Null returned if the queue is empty.
    • removeFirst

      public T removeFirst()
      Removes and returns the object with the lowest priority number in the queue. If more than one object has the same priority, then the object that was added to the queue first is considered to have the lower priority value. Null is returned if the queue is empty.
      Returns:
      the object with the lowest priority number or null if the list is empty.
    • removeLast

      public T removeLast()
      Removes and returns the object with the highest priority number in the queue. If more than one object has the same priority, then the object that was added to the queue last is considered to have the higher priority value. Null is returned if the queue is empty.
      Returns:
      the object with the highest priority number or null if the list is empty.
    • clear

      public void clear()
      Removes all objects from the queue.