indexing
	description: "Hash table searchers"
	library: "Gobo Eiffel Structure Library"
	author: "Eric Bezault <ericb@gobo.demon.co.uk>"
	copyright: "Copyright (c) 1997, Eric Bezault"

deferred class interface
	DS_HASH_TABLE_SEARCHER [G, K -> HASHABLE]

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_item (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

	hash_position (a_container: like container; k: K): INTEGER
			-- Position in a_container where key is equal to k
			-- or first possible insertion position otherwise
		require
			container_not_void: a_container /= void;
			valid_key: a_container.valid_key (k)

	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.
			-- (from DS_BILINEAR_SEARCHER)
		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

	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.
			-- (from DS_LINEAR_SEARCHER)
		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
	
invariant

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

end -- class DS_HASH_TABLE_SEARCHER