note
	description: "Sorted sets implemented as binary search trees"
	library: "Free implementation of ELKS library"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	names: binary_search_tree_set, set, binary_search_tree
	representation: recursive, array
	access: membership, min, max
	contents: generic
	date: "$Date: 2019-07-05 15:26:16 +0000 (Fri, 05 Jul 2019) $"
	revision: "$Revision: 103325 $"

class interface
	BINARY_SEARCH_TREE_SET [G -> COMPARABLE]

create 
	make,
	make_from_iterable

feature -- Measurement

	count: INTEGER_32
			-- Number of items in tree

	min: like item
			-- Minimum item in tree

	max: like item
			-- Maximum item in tree

	item: G
			-- Current item
	
feature -- Status report

	is_empty: BOOLEAN
			-- Is set empty?

	Extendible: BOOLEAN = True
			-- Can new items be added? (Answer: yes.)

	Prunable: BOOLEAN = True
			-- Can items be removed? (Answer: yes.)

	after: BOOLEAN
			-- Is there no valid cursor position to the right of cursor?

	before: BOOLEAN
			-- Is there no valid cursor position to the left of cursor?

	has alias "" (v: like item): BOOLEAN
			-- Is there a node with item v in tree?
			-- (Reference or object equality,
			-- based on object_comparison.)

	off: BOOLEAN
			-- Is there no current item?
			-- off only if tree is_empty or if
			-- it is before or after.
	
feature -- Iteration

	new_cursor: ITERATION_CURSOR [G]
			-- Fresh cursor associated with current structure
	
feature -- Cursor movement

	start
			-- Move cursor to first node.

	finish
			-- Move cursor to last node.

	forth
			-- Move cursor to next node.

	back
			-- Move cursor to previous node.
	
feature -- Element change

	put (v: like item)
			-- Put v at proper position in set
			-- (unless one already exists).
			-- Was declared in BINARY_SEARCH_TREE_SET as synonym of extend.
		require else
			item_exists: v /= Void

	extend (v: like item)
			-- Put v at proper position in set
			-- (unless one already exists).
			-- Was declared in BINARY_SEARCH_TREE_SET as synonym of put.
		require else
			item_exists: v /= Void
	
feature -- Removal

	wipe_out
			-- Remove all items.

	prune (v: like item)
			-- Remove v.

	remove
			-- Remove current item.
	
invariant
	comparison_mode_equal: attached tree as t implies object_comparison = t.object_comparison

note
	copyright: "Copyright (c) 1984-2019, 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 BINARY_SEARCH_TREE_SET

Generated by ISE EiffelStudio