Package minpq

Class PriorityNode<E>

  • Type Parameters:
    E - the type of element represented by this node.

    class PriorityNode<E>
    extends Object
    Represents the element-priority pair for use in MinPQ implementations.
    See Also:
    MinPQ
    • Field Detail

      • element

        private final E element
      • priority

        private double priority
    • Constructor Detail

      • PriorityNode

        PriorityNode​(E element,
                     double priority)
        Constructs a pair with the given element and priority.
        Parameters:
        element - the element in this pair.
        priority - the priority value associated with the element.
    • Method Detail

      • element

        E element()
        Returns the element.
        Returns:
        the element.
      • priority

        double priority()
        Returns the priority value.
        Returns:
        the priority value.
      • setPriority

        void setPriority​(double priority)
        Reassigns the priority value for this pair.
        Parameters:
        priority - the priority value to be assigned.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object