note description: "Infinite sequences, indexed by integers" library: "Free implementation of ELKS library" status: "See notice at end of class." legal: "See notice at end of class." names: countable_sequence, infinite_sequence access: cursor, membership contents: generic date: "$Date: 2012-05-24 04:13:10 +0000 (Thu, 24 May 2012) $" revision: "$Revision: 91981 $" deferred class COUNTABLE_SEQUENCE [G] inherit COUNTABLE [G] rename item as i_th end ACTIVE [G] export {NONE} fill, prune_all, put, prune, wipe_out, replace, remove redefine Replaceable end LINEAR [G] redefine linear_representation end feature -- Access index: INTEGER_32 -- Index of current position item: G -- Item at current position do Result := i_th (index) end feature -- Status report After: BOOLEAN = False -- Is current position past last item? (Answer: no.) Extendible: BOOLEAN = False -- May items be added? (Answer: no.) Prunable: BOOLEAN = False -- May items be removed? (Answer: no.) Readable: BOOLEAN = True -- Is there a current item that may be read? -- (Answer: yes.) Writable: BOOLEAN = False -- Is there a current item that may be written? -- (Answer: no.) Replaceable: BOOLEAN = False -- Can current item be replaced? feature -- Cursor movement forth -- Move to next position. do index := index + 1 end start -- Move to first position. do index := 1 end feature -- Inapplicable extend (v: G) -- Add v at end. do end finish -- Move to last position. do ensure then failure: False end linear_representation: LINEAR [G] -- Representation as a linear structure do create {LINKED_LIST [G]} Result.make end prune (v: G) -- Remove first occurrence of v, if any. do end put (v: G) -- Add v to the right of current position. do end remove -- Remove item to the right of current position. do end replace (v: G) -- Replace by v item at current position. do end wipe_out -- Remove all items. do end note copyright: "Copyright (c) 1984-2012, 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 COUNTABLE_SEQUENCE
Generated by ISE EiffelStudio