org.rollerjm.graph
Class Dijkstra.PriorityQueue

java.lang.Object
  |
  +--org.rollerjm.graph.Dijkstra.PriorityQueue
Enclosing class:
Dijkstra

public class Dijkstra.PriorityQueue
extends java.lang.Object

Title: graphs

Description: inner class of Dijkstra used by the Dijkstra's algorithm to choose the shortest vertex (the one whose priority is the lowest !)

Copyright: Copyright (c) 2002

Company:

Version:
1.0
Author:
Jean-Michel Garnier

Nested Class Summary
(package private)  class Dijkstra.PriorityQueue.QueueElement
          Title: graphs
 
Field Summary
private  java.util.TreeSet queue
          the queue is implemented by a TreeSet because it includes a sort algorithm !
 
Constructor Summary
Dijkstra.PriorityQueue()
           
 
Method Summary
 void clear()
          Remove all the elements of the queue
 java.lang.Object dequeueLowestPriorityElement()
           
 int getSize()
           
 void insert(java.lang.Object element, int priority)
           
 boolean isEmpty()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queue

private java.util.TreeSet queue
the queue is implemented by a TreeSet because it includes a sort algorithm !

Constructor Detail

Dijkstra.PriorityQueue

public Dijkstra.PriorityQueue()
Method Detail

clear

public void clear()
Remove all the elements of the queue


isEmpty

public boolean isEmpty()
Returns:
true if the queue is empty

getSize

public int getSize()
Returns:
int the number of elements in the queue

insert

public void insert(java.lang.Object element,
                   int priority)
Parameters:
element - any object !
priority - should be >= 0

dequeueLowestPriorityElement

public java.lang.Object dequeueLowestPriorityElement()
Returns:
Object the element in the queue which has the lowest priority. Also removes it from the queue.