ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Temp/DataStructures/PriorityQueue.h

This is PriorityQueue.h in view mode; [Download] [Up]

#import "Queue.h"

// Copyright (C) 1993 by Don Yacktman

// This object would be useful for sorting events in a simulator and
// then send them in correct time order, or it could track important
// objects "things to do" and then return them in order of priority.
// I've used this in an RTL simulator to handle the event queue
// dynamically, but there's plenty of other applications...

@protocol PrioritizedObject

// An object should follow this protocol if you're going to
// add it to the priority queue.  Objects with lower return
// values will exit the queue first.

- (unsigned int)sortKey;	// This should return a hash value, a
							// priority, timestamp or something
							// which tells the queue how to sort
							// the objects as it adds them.
@end


@interface PriorityQueue : Queue
{
}

// use -addObject: (from List) to add to the queue, and this to
// remove from the queue.  Other List methods still apply.
- removeNextObject;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.