indexing
	description: "Arrayed list searchers using value comparison criterion"
	library: "Gobo Eiffel Structure Library"
	author: "Eric Bezault <ericb@gobo.demon.co.uk>"
	copyright: "Copyright (c) 1997, Eric Bezault"

class interface
	DS_ARRAYED_LIST_VALUE_SEARCHER [G]

feature -- Measurement

	occurrences (a_container: like container; v: G): INTEGER
			-- Number of times v appears in a_container
			-- (from DS_LINEAR_SEARCHER)
		ensure -- from DS_SEARCHER
			positive: Result >= 0;
			has: a_container.has (v) implies Result >= 1
	
feature -- Status report

	has (a_container: like container; v: G): BOOLEAN
			-- Does a_container include v?
			-- (from DS_LINEAR_SEARCHER)
		require -- from DS_SEARCHER
			a_container_not_void: a_container /= void
		ensure -- from DS_SEARCHER
			not_empty: Result implies not a_container.is_empty
	
feature -- Search

	search_back (a_cursor: like cursor; v: G)
			-- Move to first position at or before a_cursor
			-- position where item and v are equal.
			-- Move before if not found.
		require -- from DS_BILINEAR_SEARCHER
			cursor_not_void: a_cursor /= void;
			valid_cursor: a_cursor.is_valid;
			not_cursor_off: not a_cursor.off or a_cursor.before
		ensure then
			found: not a_cursor.before implies equal (a_cursor.item, v)

	search_forth (a_cursor: like cursor; v: G)
			-- Move to first position at or after a_cursor
			-- position where item and v are equal.
			-- Move after if not found.
		require -- from DS_LINEAR_SEARCHER
			cursor_not_void: a_cursor /= void;
			valid_cursor: a_cursor.is_valid;
			not_cursor_off: not a_cursor.off or a_cursor.after
		ensure then
			found: not a_cursor.after implies equal (a_cursor.item, v)
	
invariant

		-- from GENERAL
	reflexive_equality: standard_is_equal (Current);
	reflexive_conformance: conforms_to (Current);

end -- class DS_ARRAYED_LIST_VALUE_SEARCHER