A generic priority queue class

(Available since version 1.0)

Introduction

This is the abstract base class from which all the priority queue implementations in this library are derived.

It provides the same interface as SplPriorityQueue with the extra method, PriorityQueue::update() which allows one to change the priority of a node in the queue.

The methods implemented in this class are common to all of the priority queue implementations in this library.

Note:

This class is not intended for public consumption. Most users should instead be deriving from one of the concrete classes, such as the pairing priority queue class.

Class synopsis

SEIDS::Heaps::PriorityQueue implements Countable , Iterator {
/* Constants */
const int EXTR_DATA = 1 ;
const int EXTR_PRIORITY = 2 ;
const int EXTR_BOTH = 3 ;
/* Properties */
protected mixed $DataStructure ;
protected int $flags = PriorityQueue::EXTR_DATA ;
/* Methods */
abstract public __construct ( void )
public void __clone ( void )
protected int compare ( mixed $priority1 , mixed $priority2 )
public int count ( void )
public mixed current ( void )
public mixed extract ( void )
public bool insert ( mixed $value , mixed $priority )
public bool isEmpty ( void )
public int key ( void )
public void next ( void )
public bool recoverFromCorruption ( void )
public void rewind ( void )
public int setExtractFlags ( int $flags )
public mixed top ( void )
public void update ( mixed $value , mixed $priority )
public bool valid ( void )
protected mixed processExtract ( SEIDS::Heaps::PriorityQueueHeapItem $extract )
}

Predefined Constants

PriorityQueue::EXTR_DATA

(1) Flag for extracting data from the priority queue.

PriorityQueue::EXTR_PRIORITY

(2) Flag for extracting priorities from the priority queue.

PriorityQueue::EXTR_BOTH

(3) The data and priority extraction flags combined. Used for extracting both simultaneously.

Properties

DataStructure

The underlying data-structure, generally a heap.

flags

The extraction mode. Defaults to PriorityQueue::EXTR_DATA.

Table of Contents

To Top