home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / MiscKit1.2.6 / Headers / misckit / MiscPriorityQueue.h < prev    next >
Encoding:
Text File  |  1994-01-07  |  2.2 KB  |  92 lines

  1. /* NAME:
  2. **    MiscPriorityQueue:Object
  3. **
  4. **    COPYRIGHT 1992 BY ONYSCHUK AND ASSOCIATES
  5. **    ALL RIGHTS RESERVED.
  6. **
  7. ** REVISION HISTORY:
  8. **    Sun Aug 16 14:14:03 EDT 1992    Mark Onyschuk
  9. **                    Starting point.
  10. **
  11. ** DESCRIPTION:
  12. **    A priority queue which dequeues objects by
  13. **    unsigned integer priority.
  14. **
  15. **    NOTE: priorityOf(n) > priorityOf(n + 1)
  16. **
  17. ** DISCLAIMER:
  18. **    This is free software; you can redistribute it and/or modify
  19. **    it under the terms of the MiscKit license; either version
  20. **    1, or (at your option) any later version.
  21. **
  22. **    This program is distributed in the hope that it will be
  23. **    useful, but WITHOUT ANY WARRANTY; without even the implied
  24. **    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  25. **    PURPOSE.
  26. */
  27.  
  28. #import <objc/Object.h>
  29.  
  30. typedef struct _NODE
  31. {
  32.     unsigned int    priority;
  33.     id            object;
  34. } NODE;
  35.  
  36.  
  37. @interface MiscPriorityQueue:Object
  38. {
  39.     NODE        *heap;
  40.     unsigned int    size, top;
  41. }
  42.  
  43. /* INITIALIZING A PRIORITY QUEUE ****************************************/
  44.  
  45. - init;
  46. - initCount:(unsigned)count;
  47.  
  48. /* COPYING AND FREEING A PRIORITY QUEUE *********************************/
  49.  
  50. - copyFromZone:(NXZone *)zone;
  51. - free;
  52.  
  53. /* QUEUEING AND DEQUEUEING OBJECTS BY PRIORITY **************************/
  54.  
  55. - addObject:anObject withPriority:(unsigned int)priority;
  56. - removeObject;
  57.  
  58. /* COUNTING THE NUMBER OF OBJECTS IN A PRIORITY QUEUE *******************/
  59.  
  60. - (unsigned int)count;
  61.  
  62. /* DETERMINING THE HIGHEST PRIORITY IN A PRIORITY QUEUE *****************/
  63.  
  64. - (unsigned int)highestPriority;
  65.  
  66. /* EMPTYING A PRIORITY QUEUE ********************************************/
  67.  
  68. - empty;
  69. - freeObjects;
  70.  
  71. /* COMPARING AND COMBINING PRIORITY QUEUES ******************************/
  72.  
  73. - (BOOL)isEqual:anObject;
  74. - appendQueue:(MiscPriorityQueue *)otherQueue;
  75.  
  76. /* GETTING AND SETTING THE CAPACITY OF A PRIORITY QUEUE *****************/
  77.  
  78. - (unsigned int)capacity;
  79. - setAvailableCapacity:(unsigned int)capacity;
  80.  
  81. /* SENDING MESSAGES TO OBJECTS ******************************************/
  82.  
  83. - makeObjectsPerform:(SEL)aSelector;
  84. - makeObjectsPerform:(SEL)aSelector with:anObject;
  85.  
  86. /* ARCHIVING ************************************************************/
  87.  
  88. - read:(NXTypedStream *)stream;
  89. - write:(NXTypedStream *)stream;
  90.  
  91. @end
  92.