generic type ITEM_TYPE is private; with function ">="(L,R: ITEM_TYPE) return BOOLEAN is <>; with function "<"(L,R: ITEM_TYPE) return BOOLEAN is <>; package RINGS is -- All these priority queue implementations assume that the priority (i.e., -- the ordering relationships) of an item will not change once it is in the -- queue. That is, for correct operation, changing the priority of an item -- requires: -- 1. delete it from queue; -- 2. change the priority; -- 3. reinsert it in the queue. type QUEUE_TYPE is limited private; function MIN(QUEUE: QUEUE_TYPE) return ITEM_TYPE; -- Returns the smallest item in the queue. -- Result is undefined if the queue is empty. -- The results of all operations are also undefined for -- an uninitialized queue. procedure INSERT(QUEUE: QUEUE_TYPE; ITEM: ITEM_TYPE); -- If the item is already there, do nothing. procedure DELETE(QUEUE: QUEUE_TYPE; ITEM: ITEM_TYPE); -- If the item is not there, do nothing. function EMPTY(QUEUE: QUEUE_TYPE) return BOOLEAN; procedure MAKE_EMPTY(QUEUE: in out QUEUE_TYPE); -- This must be called to initialize each queue. pragma INLINE(MIN); function MEMBER(QUEUE: QUEUE_TYPE; ITEM: ITEM_TYPE) return BOOLEAN; generic with procedure P(ITEM: ITEM_TYPE); procedure APPLY(QUEUE: QUEUE_TYPE); private type QUEUE_RECORD; type QUEUE_TYPE is access QUEUE_RECORD; end RINGS;