note
	description: "Priority queues implemented as heaps"
	library: "Free implementation of ELKS library"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	names: sorted_priority_queue, dispenser, heap
	representation: heap
	access: fixed, membership
	contents: generic
	date: "$Date: 2018-12-15 18:06:16 +0000 (Sat, 15 Dec 2018) $"
	revision: "$Revision: 102608 $"

class interface
	HEAP_PRIORITY_QUEUE [G -> COMPARABLE]

create 
	make,
	make_from_iterable

feature -- Access

	item: G
			-- Entry at top of heap.

	has (v: G): BOOLEAN
			-- Does structure include v?
			-- (Reference or object equality,
			-- based on object_comparison.)
	
feature -- Iteration

	new_cursor: HEAP_PRIORITY_QUEUE_ITERATION_CURSOR [G]
			-- Fresh cursor associated with current structure
	
feature -- Measurement

	count: INTEGER_32
			-- Number of items

	capacity: INTEGER_32
			-- Number of items that may be stored

	occurrences (v: G): INTEGER_32
			-- Number of times v appears in structure
			-- (Reference or object equality,
			-- based on object_comparison.)

	index_set: INTEGER_INTERVAL
			-- Range of acceptable indexes
		ensure then
			count_definition: Result.count = count
	
feature -- Status report

	extendible: BOOLEAN
			-- May items be added?

	replaceable: BOOLEAN
			-- Can current item be replaced?

	Prunable: BOOLEAN = True
			-- May items be removed? (Answer: yes.)
	
feature -- Comparison

	is_equal (other: like Current): BOOLEAN
			-- Is other attached to an object considered
			-- equal to current object?
	
feature -- Element change

	force (v: like item)
			-- Add item v at its proper position.

	put (v: like item)
			-- Insert item v at its proper position.

	extend (v: like item)
			-- Add item v.
	
feature -- Duplication

	copy (other: like Current)
			-- Update current object using fields of object attached
			-- to other, so as to yield equal objects.
	
feature -- Removal

	remove
			-- Remove item of highest value.

	prune (v: G)
			-- Remove first occurrence of v if any.

	wipe_out
			-- Remove all items.
	
feature -- Resizing

	grow (i: INTEGER_32)
			-- Ensure that capacity is at least i.

	trim
			-- Decrease capacity to the minimum value.
			-- Apply to reduce allocated storage.
		ensure then
			same_items: linear_representation.is_equal (old linear_representation)
	
feature -- Conversion

	linear_representation: ARRAYED_LIST [G]
			-- Representation as a linear structure
			-- (Sorted according to decreasing priority)
	
feature -- Inapplicable

	replace (v: like item)
			-- Replace current item by v.
	
note
	copyright: "Copyright (c) 1984-2018, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class HEAP_PRIORITY_QUEUE

Generated by ISE EiffelStudio