indexing description: "[ A Heap, with the ability to walk through its elements ]" date: "$Date$" revision: "$Revision$" class HEAP_PRIORITY_QUEUE_WALKABLE [G -> COMPARABLE] inherit HEAP_PRIORITY_QUEUE [G] redefine make end create make feature -- Initialization make (n: INTEGER) is -- Allocate heap space. do array_make (1, n) cursor := 0 end feature -- Access item_for_iteration: G is -- returns the item at `cursor's position do Result := i_th (cursor) end feature -- Cursor movement start is -- start the cursor. do cursor := 1 end finish is -- put the cursor at the last position. do cursor := count end off: BOOLEAN is -- is the cursor off the range? do Result := cursor > count or cursor < 1 end forth is -- move the cursor forth. do cursor := cursor + 1 end back is -- move the cursor back. do cursor := cursor - 1 end feature -- Computation reorder (v: like item) is -- removes and inserts the element local lastcount: INTEGER do lastcount := count prune (v) if lastcount > count then put (v) end end feature {NONE} -- Implementation cursor: INTEGER -- cursor end