indexing
	description: "Structures that can be sorted"
	library: "Gobo Eiffel Structure Library"
	author: "Eric Bezault <ericb@gobo.demon.co.uk>"
	copyright: "Copyright (c) 1997, Eric Bezault"
deferred class interface
	DS_SORTABLE [G]
feature -- Measurement
	count: INTEGER
			-- Number of items in structure
			-- (from DS_CONTAINER)
	
feature -- Comparison
	is_equal (other: like Current): BOOLEAN
			-- Is current structure equal to other?
			-- (from DS_CONTAINER)
		require -- from GENERAL
			other_not_void: other /= void
		ensure -- from GENERAL
			symmetric: Result implies other.is_equal (Current);
			consistent: standard_is_equal (other) implies Result
		ensure then -- from DS_CONTAINER
			same_count: Result implies count = other.count
	
feature -- Status report
	is_empty: BOOLEAN
			-- Is structure empty?
			-- (from DS_CONTAINER)
	sorted (sorter: DS_SORTER [G]): BOOLEAN
			-- Is structure sorted according to sorter's criterion?
		require
			sorter_not_void: sorter /= void
	
feature -- Removal
	wipe_out
			-- Remove all items from structure.
			-- (from DS_CONTAINER)
		ensure -- from DS_CONTAINER
			wipe_out: is_empty
	
feature -- Sort
	sort (sorter: DS_SORTER [G])
			-- Sort structure using sorter's algorithm.
		require
			sorter_not_void: sorter /= void
		ensure
			sorted: sorted (sorter)
	
invariant
		-- from GENERAL
	reflexive_equality: standard_is_equal (Current);
	reflexive_conformance: conforms_to (Current);
		-- from DS_CONTAINER
	positive_count: count >= 0;
	empty_definition: is_empty = (count = 0);
end -- class DS_SORTABLE