Automatic generation produced by ISE Eiffel

Classes Clusters Cluster hierarchy Chart Relations Text Flat Contracts Go to:
note description: "Lists implemented by resizable arrays" library: "Free implementation of ELKS library" legal: "See notice at end of class." status: "See notice at end of class." names: sequence representation: array access: index, cursor, membership size: fixed contents: generic date: "$Date: 2016-04-13 06:29:38 -0700 (Wed, 13 Apr 2016) $" revision: "$Revision: 98619 $" class interface ARRAYED_LIST [G] create make, make_filled, make_from_array feature -- Initialization make (n: INTEGER_32) -- Allocate list with `n' items. -- (`n' may be zero for empty list.) require valid_number_of_items: n >= 0 ensure correct_position: before is_empty: is_empty make_filled (n: INTEGER_32) -- Allocate list with `n' items. -- (`n' may be zero for empty list.) -- This list will be full. require valid_number_of_items: n >= 0 has_default: ({G}).has_default ensure correct_position: before filled: full make_from_array (a: ARRAY [G]) -- Create list from array `a'. require array_exists: a /= Void ensure shared: area = a.area correct_position: before filled: count = a.count feature -- Access area: SPECIAL [G] -- Access to internal storage of ARRAYED_LIST item: G -- Current item require else index_is_valid: valid_index (index) i_th alias "[]" (i: INTEGER_32): like item assign put_i_th -- Item at `i'-th position -- Was declared in ARRAYED_LIST as synonym of at. at alias "@" (i: INTEGER_32): like item assign put_i_th -- Item at `i'-th position -- Was declared in ARRAYED_LIST as synonym of i_th. first: like item -- Item at first position last: like first -- Item at last position index: INTEGER_32 -- Index of item, if valid. cursor: ARRAYED_LIST_CURSOR -- Current cursor position has (v: like item): BOOLEAN -- Does current include `v'? -- (Reference or object equality, -- based on object_comparison.) to_array: ARRAY [G] -- Share content to be used as an ARRAY. -- Note that although the content is shared, it might -- not be shared when a resizing occur in either ARRAY or Current. ensure to_array_attached: Result /= Void array_lower_set: Result.lower = 1 array_upper_set: Result.upper = count shared_area: Result.area = area new_cursor: ARRAYED_LIST_ITERATION_CURSOR [G] -- Fresh cursor associated with current structure feature -- Iteration do_all (action: PROCEDURE [G]) -- Apply `action' to every item, from first to last. -- Semantics not guaranteed if `action' changes the structure; -- in such a case, apply iterator to clone of structure instead. do_if (action: PROCEDURE [G]; test: FUNCTION [G, BOOLEAN]) -- Apply `action' to every item that satisfies `test', from first to last. -- Semantics not guaranteed if `action' or `test' changes the structure; -- in such a case, apply iterator to clone of structure instead. there_exists (test: FUNCTION [G, BOOLEAN]): BOOLEAN -- Is `test' true for at least one item? for_all (test: FUNCTION [G, BOOLEAN]): BOOLEAN -- Is `test' true for all items? do_all_with_index (action: PROCEDURE [G, INTEGER_32]) -- Apply `action' to every item, from first to last. -- `action' receives item and its index. -- Semantics not guaranteed if `action' changes the structure; -- in such a case, apply iterator to clone of structure instead. require action_not_void: action /= Void do_if_with_index (action: PROCEDURE [G, INTEGER_32]; test: FUNCTION [G, INTEGER_32, BOOLEAN]) -- Apply `action' to every item that satisfies `test', from first to last. -- `action' and `test' receive the item and its index. -- Semantics not guaranteed if `action' or `test' changes the structure; -- in such a case, apply iterator to clone of structure instead. require action_not_void: action /= Void test_not_void: test /= Void feature -- Measurement count: INTEGER_32 -- Number of items. capacity: INTEGER_32 -- Number of items that may be stored upper: INTEGER_32 -- Maximum index. -- Use count instead. ensure definition: Result = count feature -- Comparison is_equal (other: like Current): BOOLEAN -- Is array made of the same items as `other'? feature -- Status report prunable: BOOLEAN -- May items be removed? (Answer: yes.) valid_cursor (p: CURSOR): BOOLEAN -- Can the cursor be moved to position `p'? valid_index (i: INTEGER_32): BOOLEAN -- Is `i' a valid index? is_inserted (v: G): BOOLEAN -- Has `v' been inserted at the end by the most recent put or -- extend? all_default: BOOLEAN -- Are all items set to default values? require has_default: ({G}).has_default feature -- Cursor movement move (i: INTEGER_32) -- Move cursor `i' positions. start -- Move cursor to first position if any. ensure then after_when_empty: is_empty implies after finish -- Move cursor to last position if any. ensure then before_when_empty: is_empty implies before forth -- Move cursor one position forward. back -- Move cursor one position backward. go_i_th (i: INTEGER_32) -- Move cursor to `i'-th position. go_to (p: CURSOR) -- Move cursor to position `p'. search (v: like item) -- Move to first position (at or after current -- position) where item and `v' are equal. -- If structure does not include `v' ensure that -- exhausted will be true. -- (Reference or object equality, -- based on object_comparison.) feature -- Element change put_front (v: like item) -- Add `v' to the beginning. -- Do not move cursor. put_i_th (v: like i_th; i: INTEGER_32) -- Replace `i'-th entry, if in index interval, by `v'. force (v: like item) -- Add `v' to end. -- Do not move cursor. -- Was declared in ARRAYED_LIST as synonym of extend. extend (v: like item) -- Add `v' to end. -- Do not move cursor. -- Was declared in ARRAYED_LIST as synonym of force. put_left (v: like item) -- Add `v' to the left of current position. -- Do not move cursor. put_right (v: like item) -- Add `v' to the right of current position. -- Do not move cursor. replace (v: like first) -- Replace current item by `v'. merge_left (other: ARRAYED_LIST [G]) -- Merge `other' into current structure before cursor. merge_right (other: ARRAYED_LIST [G]) -- Merge `other' into current structure after cursor. append (s: SEQUENCE [G]) -- Append a copy of `s'. feature -- Resizing grow (i: INTEGER_32) -- Change the capacity to at least `i'. resize (new_capacity: INTEGER_32) -- Resize list so that it can contain -- at least `n' items. Do not lose any item. require resizable: resizable new_capacity_large_enough: new_capacity >= capacity ensure capacity_set: capacity >= new_capacity trim -- Decrease capacity to the minimum value. -- Apply to reduce allocated storage. ensure then same_items: to_array.same_items (old to_array) feature -- Duplication copy (other: like Current) -- Reinitialize by copying all the items of `other'. -- (This is also used by clone.) ensure then equal_areas: area_v2 ~ other.area_v2 feature -- Removal prune (v: like item) -- Remove first occurrence of `v', if any, -- after cursor position. -- Move cursor to right neighbor. -- (or after if no right neighbor or `v' does not occur) remove -- Remove current item. -- Move cursor to right neighbor -- (or after if no right neighbor) ensure then index: index = old index prune_all (v: like item) -- Remove all occurrences of `v'. -- (Reference or object equality, -- based on object_comparison.) ensure then is_after: after remove_left -- Remove item to the left of cursor position. -- Do not move cursor. remove_right -- Remove item to the right of cursor position -- Do not move cursor wipe_out -- Remove all items. feature -- Transformation swap (i: INTEGER_32) -- Exchange item at `i'-th position with item -- at cursor position. feature -- Retrieval correct_mismatch -- Attempt to correct object mismatch using Mismatch_information. feature -- Duplication duplicate (n: INTEGER_32): like Current -- Copy of sub-list beginning at current position -- and having min (`n', count - index + 1) items. invariant prunable: prunable starts_from_one: Lower = 1 note copyright: "Copyright (c) 1984-2016, 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 ARRAYED_LIST
Classes Clusters Cluster hierarchy Chart Relations Text Flat Contracts Go to:

-- Generated by ISE Eiffel --
For more details: www.eiffel.com