y.util.pq
Interface NodePQ

All Known Implementing Classes:
BHeapNodePQ

public interface NodePQ

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


Method Summary
 void add(Node v, Object priority)
          Adds the given node with the given priority to the queue.
 void clear()
          Makes this queue the empty queue.
 boolean contains(Node v)
          Returns whether or not the given node is contained in this queue.
 void decreasePriority(Node v, Object priority)
          Decreased the priority value of the given node.
 Node getMin()
          Returns he node with smallest priority in this queue.
 Object getPriority(Node v)
          Returns the current priority of the given node.
 boolean isEmpty()
          Returns whether or not this queue is empty
 Node removeMin()
          Removes the node with smallest priority from this queue.
 int size()
          Returns the number of nodes currently in this queue
 

Method Detail

add

public void add(Node v,
                Object priority)
Adds the given node with the given priority to the queue.

Precondition:
!contains(v)

decreasePriority

public void decreasePriority(Node v,
                             Object priority)
Decreased the priority value of the given node.

Preconditions:
contains(v)
c.compare(p,getPriority(v)) < 0, where c is the corresponding comparator for the priorities in this queue.

removeMin

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

Precondition:
!isEmpty()
Returns:
the removed node with smallest priority

getMin

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

Precondition:
!isEmpty()

clear

public void clear()
Makes this queue the empty queue. in this queue.


contains

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


getPriority

public Object getPriority(Node v)
Returns the current priority of the given node.


isEmpty

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


size

public int size()
Returns the number of nodes currently in this queue


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

2003