Search this API

y.util.pq
Interface DoubleNodePQ

All Known Implementing Classes:
BHeapDoubleNodePQ

public interface DoubleNodePQ

Defines an interface for specialized priority queues that contains nodes which are prioritized by associated double values.

 

Method Summary
 void add(Node n, double priority)
          Adds a node with the given priority to the queue.
 void clear()
          Removes all entries from the queue.
 boolean contains(Node n)
          Returns whether or not the given node is contained within this queue.
 void decreasePriority(Node n, double priority)
          Decreases the priority of a node in the queue to a given value.
 void dispose()
          Disposes this queue.
 Node getMin()
          Returns he node with smallest priority in this queue.
 double getPriority(Node n)
          Returns the current priority of the given node.
 boolean isEmpty()
          Returns whether or not this queue is empty.
 Node removeMin()
          Removes the node with the minimal priority from the queue.
 

Method Detail

isEmpty

boolean isEmpty()
Returns whether or not this queue is empty.


contains

boolean contains(Node n)
Returns whether or not the given node is contained within this queue.


add

void add(Node n,
         double priority)
Adds a node with the given priority to the queue.


removeMin

Node removeMin()
Removes the node with the minimal priority from the queue.


getMin

Node getMin()
Returns he node with smallest priority in this queue.

Precondition:
!isEmpty()

decreasePriority

void decreasePriority(Node n,
                      double priority)
Decreases the priority of a node in the queue to a given value.

Parameters:
n - a node in the priority queue.
priority - the new priority of the node.

clear

void clear()
Removes all entries from the queue.


getPriority

double getPriority(Node n)
Returns the current priority of the given node.


dispose

void dispose()
Disposes this queue. It is important to call this method after the queue is not needed anymore, to free bound resources.


© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.