Class PriorityQueueNode.Integer<E>

java.lang.Object
org.cicirello.ds.PriorityQueueNode<E>
org.cicirello.ds.PriorityQueueNode.Integer<E>
Type Parameters:
E - The type of element contained in the PriorityQueueNode.
All Implemented Interfaces:
Copyable<PriorityQueueNode.Integer<E>>
Enclosing class:
PriorityQueueNode<E>

public static final class PriorityQueueNode.Integer<E> extends PriorityQueueNode<E> implements Copyable<PriorityQueueNode.Integer<E>>
An instance of this class encapsulates an (element, priority) pair for an integer valued priority. This class is used by the various priority queue classes of the library.
  • Constructor Details

    • Integer

      public Integer(E element, int value)
      Initializes the PriorityQueueNode.Integer.
      Parameters:
      element - The object.
      value - The value of the object.
  • Method Details

    • copy

      public PriorityQueueNode.Integer<E> copy()
      Creates an identical copy of this object.

      During the copy, if the element is of a type that also implements Copyable, then the element is copied. Otherwise, the copy will contain a reference to the same element as the PriorityQueueNode that was copied.

      Specified by:
      copy in interface Copyable<E>
      Returns:
      an identical copy of this object.
    • equals

      public boolean equals(Object other)
      Checks if another PriorityQueueNode.Integer is equal to this one.
      Overrides:
      equals in class PriorityQueueNode<E>
      Parameters:
      other - The other PriorityQueueNode.Integer.
      Returns:
      true if and only if they contain an identical object, determined by the equals method of the encapsulated object, as well as the same priority.
    • hashCode

      public int hashCode()
      Computes the hashCode of the PriorityQueueNode.Integer.
      Overrides:
      hashCode in class PriorityQueueNode<E>
      Returns:
      a hashCode
    • getPriority

      public int getPriority()
      Gets the priority value.
      Returns:
      the priority value.