note
	description: "[
		Subsets that are traversable linearly without commitment to a concrete
		implementation.
	]"
	library: "Free implementation of ELKS library"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	names: linear_subset, subset, set
	access: membership
	contents: generic
	date: "$Date: 2017-03-23 19:18:26 +0000 (Thu, 23 Mar 2017) $"
	revision: "$Revision: 100033 $"

deferred class interface
	LINEAR_SUBSET [G]

feature -- Access

	index: INTEGER_32
			-- Current index
	
feature -- Status report

	before: BOOLEAN
			-- Is cursor at left from first item?

	islast: BOOLEAN
			-- Is cursor at last item?

	valid_index (n: INTEGER_32): BOOLEAN
			-- Is n a valid index?
		ensure
			index_valid: 0 <= n and n <= count + 1
	
feature -- Cursor movement

	go_i_th (i: INTEGER_32)
			-- Move cursor to i-th item.
		require
			valid_index: valid_index (i)
		ensure
			cursor_moved: index = i
	
feature -- Element change

	put_left (v: G)
			-- Insert v before the cursor.
		require
			item_exists: v /= Void
			not_before: not before
		ensure
			cursor_position_unchanged: index = old index + 1

	move_item (v: G)
			-- Move v to the left of cursor.
		require
			item_exists: v /= Void
			item_in_set: has (v)
	
invariant
	before_definition: before = (index = 0)

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

Generated by ISE EiffelStudio