class EL_HASH_TABLE

(source code)

Client examples: CLASS_NOTESFEATURE_EDITOR_COMMAND_TEST_SETHTTP_CONNECTION_TEST_SETID3_FRAME_CODE_CLASS_GENERATORID3_TAG_INFO_TEST_SETNOTE_EDITORPYXIS_TO_XML_TEST_SETPYXIS_TRANSLATION_TREE_COMPILERRBOX_IRADIO_ENTRYRBOX_SONGREPOSITORY_SITEMAP_PAGETAGLIB_TEST_SETTANGO_MP3_FILE_COLLATORTRANSLATION_TREE_COMPILER_TEST_SET

Description

Hash table

note
	description: "Hash table"

	author: "Finnian Reilly"
	copyright: "Copyright (c) 2001-2017 Finnian Reilly"
	contact: "finnian at eiffel hyphen loop dot com"

	license: "MIT license (See: en.wikipedia.org/wiki/MIT_License)"
	date: "2020-06-28 10:32:16 GMT (Sunday 28th June 2020)"
	revision: "9"

class
	EL_HASH_TABLE [G, K -> HASHABLE]

inherit
	HASH_TABLE [G, K]
		rename
			make as make_size
		redefine
			default_create
		end

create
	 default_create, make, make_size, make_equal, make_from_map_list

feature {NONE} -- Initialization

	default_create
			--
		do
			make_equal (3)
		end

	make (array: ARRAY [like as_map_list.item])
			--
		do
			make_equal (array.count)
			append_tuples (array)
		end

	make_from_map_list (map: EL_ARRAYED_MAP_LIST [K, G]; compare_equal: BOOLEAN)
		do
			if compare_equal then
				make_equal (map.count)
			else
				make_size (map.count)
			end
			from map.start until map.after loop
				put (map.item_value, map.item_key)
				map.forth
			end
		end

feature -- Element change

	append_tuples (array: ARRAY [like as_map_list.item])
			--
		local
			i, new_count: INTEGER; map: like as_map_list.item
		do
			new_count := count + array.count
			if new_count > capacity then
				accommodate (new_count)
			end
			from i := 1 until i > array.count loop
				map := array [i]
				force (map.value, map.key)
				i := i + 1
			end
		end

feature -- Constants

	as_map_list: EL_ARRAYED_MAP_LIST [K, G]
		do
	 		create Result.make_from_keys (current_keys, agent item)
	 	end

end