y.util.pq
Interface IntNodePQ

All Known Implementing Classes:
ArrayIntNodePQ, BHeapIntNodePQ, ListIntNodePQ, TreeIntNodePQ

public interface IntNodePQ

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


Method Summary
 void add(Node n, int 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, int 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.
 int 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

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


contains

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


add

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


getMin

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

Precondition:
!isEmpty()

removeMin

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


decreasePriority

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

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

clear

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


getPriority

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


dispose

public 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-2003,
yWorks GmbH.
All rights reserved.

2003