note description: "Sets represented as arrayed lists" library: "Free implementation of ELKS library" legal: "See notice at end of class." status: "See notice at end of class." names: arrayed_set, set, arrayed_list representation: array size: fixed access: membership contents: generic date: "$Date: 2019-07-05 15:26:16 +0000 (Fri, 05 Jul 2019) $" revision: "$Revision: 103325 $" class ARRAYED_SET [G] create make, make_from_iterable create {ARRAYED_SET} make_filled feature {NONE} -- Initialization default_create -- Process instances of classes with no creation clause. -- (Default: do nothing.) -- (from ANY) do end make_empty_area (n: INTEGER_32) -- Creates a special object for n entries. -- (from TO_SPECIAL) require -- from TO_SPECIAL non_negative_argument: n >= 0 do create area_v2.make_empty (n) ensure -- from TO_SPECIAL area_allocated: area_v2 /= Void capacity_set: area_v2.capacity = n count_set: area_v2.count = 0 end make_filled_area (a_default_value: G; n: INTEGER_32) -- Creates a special object for n entries. -- (from TO_SPECIAL) require -- from TO_SPECIAL non_negative_argument: n >= 0 do create area_v2.make_filled (a_default_value, n) ensure -- from TO_SPECIAL area_allocated: area_v2 /= Void capacity_set: area_v2.capacity = n count_set: area_v2.count = n area_filled: area_v2.filled_with (a_default_value, 0, n - 1) end make_from_array (a: ARRAY [G]) -- Create list from array a. -- (from ARRAYED_LIST) require -- from ARRAYED_LIST array_exists: a /= Void do index := 0 area_v2 := a.area ensure -- from ARRAYED_LIST shared: area = a.area correct_position: before filled: count = a.count end feature -- Initialization make (n: INTEGER_32) -- Allocate list with n items. -- (n may be zero for empty list.) -- (from ARRAYED_LIST) require -- from ARRAYED_LIST valid_number_of_items: n >= 0 do index := 0 create area_v2.make_empty (n) ensure -- from ARRAYED_LIST correct_position: before is_empty: is_empty end make_filled (n: INTEGER_32) -- Allocate list with n items. -- (n may be zero for empty list.) -- This list will be full. -- (from ARRAYED_LIST) require -- from ARRAYED_LIST valid_number_of_items: n >= 0 has_default: ({G}).has_default do index := 0 make_filled_area (({G}).default, n) ensure -- from ARRAYED_LIST correct_position: before filled: full end feature -- Access area: SPECIAL [G] -- Access to internal storage of ARRAYED_LIST -- (from ARRAYED_LIST) do Result := area_v2 end area_v2: SPECIAL [G] -- Special data zone. -- (from TO_SPECIAL) 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. -- (from ARRAYED_LIST) require -- from TABLE valid_key: valid_index (i) do Result := area_v2.item (i - 1) end array_at (i: INTEGER_32): G assign array_put -- Entry at index i, if in index interval. -- Was declared in TO_SPECIAL as synonym of item. -- (from TO_SPECIAL) require -- from TO_SPECIAL valid_index: array_valid_index (i) do Result := area_v2.item (i) end cursor: ARRAYED_LIST_CURSOR -- Current cursor position -- (from ARRAYED_LIST) do create Result.make (index) ensure -- from CURSOR_STRUCTURE cursor_not_void: Result /= Void end first: like item -- Item at first position -- (from ARRAYED_LIST) require -- from CHAIN not_empty: not is_empty do Result := area_v2.item (0) end generating_type: TYPE [detachable ARRAYED_SET [G]] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) external "built_in" ensure -- from ANY generating_type_not_void: Result /= Void end generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) external "built_in" ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty end has (v: like item): BOOLEAN -- Does current include v? -- (Reference or object equality, -- based on object_comparison.) -- (from ARRAYED_LIST) require -- from CONTAINER True local l_area: like area_v2 i, nb: INTEGER_32 do l_area := area_v2 nb := count if object_comparison and v /= Void then from until i >= nb or Result loop Result := v ~ l_area.item (i) i := i + 1 end else from until i >= nb or Result loop Result := v = l_area.item (i) i := i + 1 end end ensure -- from CONTAINER not_found_in_empty: Result implies not is_empty end sequential_has (v: like item): BOOLEAN -- Does structure include an occurrence of v? -- (Reference or object equality, -- based on object_comparison.) -- (from LINEAR) require -- from CONTAINER True do start if not off then search (v) end Result := not exhausted ensure -- from CONTAINER not_found_in_empty: Result implies not is_empty end 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. -- (from ARRAYED_LIST) require -- from TABLE valid_key: valid_index (i) require -- from READABLE_INDEXABLE valid_index: valid_index (i) do Result := area_v2.item (i - 1) end index: INTEGER_32 -- Index of item, if valid. -- (from ARRAYED_LIST) index_of (v: like item; i: INTEGER_32): INTEGER_32 -- Index of i-th occurrence of item identical to v. -- (Reference or object equality, -- based on object_comparison.) -- 0 if none. -- (from CHAIN) local pos: CURSOR do pos := cursor Result := sequential_index_of (v, i) go_to (pos) end sequential_index_of (v: like item; i: INTEGER_32): INTEGER_32 -- Index of i-th occurrence of v. -- 0 if none. -- (Reference or object equality, -- based on object_comparison.) -- (from LINEAR) require -- from LINEAR positive_occurrences: i > 0 local occur, pos: INTEGER_32 do if object_comparison and v /= Void then from start pos := 1 until exhausted or (occur = i) loop if item ~ v then occur := occur + 1 end forth pos := pos + 1 end else from start pos := 1 until exhausted or (occur = i) loop if item = v then occur := occur + 1 end forth pos := pos + 1 end end if occur = i then Result := pos - 1 end ensure -- from LINEAR non_negative_result: Result >= 0 end item: G -- Current item -- (from ARRAYED_LIST) require -- from ACTIVE readable: readable require -- from TRAVERSABLE not_off: not off require -- from TRAVERSABLE_SUBSET not_off: not off require else -- from ARRAYED_LIST index_is_valid: valid_index (index) do Result := area_v2.item (index - 1) end array_item (i: INTEGER_32): G assign array_put -- Entry at index i, if in index interval. -- Was declared in TO_SPECIAL as synonym of at. -- (from TO_SPECIAL) require -- from TO_SPECIAL valid_index: array_valid_index (i) do Result := area_v2.item (i) end item_for_iteration: G -- Item at current position -- (from LINEAR) require -- from LINEAR not_off: not off do Result := item end last: like first -- Item at last position -- (from ARRAYED_LIST) require -- from CHAIN not_empty: not is_empty do Result := area_v2.item (count - 1) end new_cursor: ARRAYED_LIST_ITERATION_CURSOR [G] -- Fresh cursor associated with current structure -- (from ARRAYED_LIST) require -- from ITERABLE True do create Result.make (Current) ensure -- from ITERABLE result_attached: Result /= Void end sequential_occurrences (v: like item): INTEGER_32 -- Number of times v appears. -- (Reference or object equality, -- based on object_comparison.) -- (from LINEAR) require -- from BAG True do from start search (v) until exhausted loop Result := Result + 1 forth search (v) end ensure -- from BAG non_negative_occurrences: Result >= 0 end 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. -- (from ARRAYED_LIST) do create Result.make_from_special (area_v2) ensure -- from ARRAYED_LIST to_array_attached: Result /= Void array_lower_set: Result.lower = 1 array_upper_set: Result.upper = count shared_area: Result.area = area end feature {NONE} -- Measurement estimated_count_of (other: ITERABLE [G]): INTEGER_32 -- Estimated number of elements in other. -- (from CONTAINER) do if attached {FINITE [G]} other as f then Result := f.count elseif attached {READABLE_INDEXABLE [G]} other as r then Result := r.upper - r.lower + 1 end ensure -- from CONTAINER instance_free: class non_negative_result: Result >= 0 end feature -- Measurement additional_space: INTEGER_32 -- Proposed number of additional items -- (from RESIZABLE) do Result := (capacity // 2).max (Minimal_increase) ensure -- from RESIZABLE at_least_one: Result >= 1 end capacity: INTEGER_32 -- Number of items that may be stored -- (from ARRAYED_LIST) do Result := area_v2.capacity ensure -- from BOUNDED capacity_non_negative: Result >= 0 end count: INTEGER_32 -- Number of items. -- (from ARRAYED_LIST) require -- from SET True require -- from FINITE True require -- from READABLE_INDEXABLE True do Result := area_v2.count ensure -- from FINITE count_non_negative: Result >= 0 end Growth_percentage: INTEGER_32 = 50 -- Percentage by which structure will grow automatically -- (from RESIZABLE) index_set: INTEGER_INTERVAL obsolete "Use `lower' and `upper' instead. [2017-05-31]" -- Range of acceptable indexes. -- (from READABLE_INDEXABLE) do create Result.make (Lower, count) ensure -- from READABLE_INDEXABLE not_void: Result /= Void empty_if_not_in_order: (Lower > count) implies Result.is_empty same_lower_if_not_empty: (Lower <= count) implies Result.lower = Lower same_upper_if_not_empty: (Lower <= count) implies Result.upper = count end Lower: INTEGER_32 = 1 -- Minimum index. -- (from CHAIN) Minimal_increase: INTEGER_32 = 5 -- Minimal number of additional items -- (from RESIZABLE) occurrences (v: like item): INTEGER_32 -- Number of times v appears. -- (Reference or object equality, -- based on object_comparison.) -- (from CHAIN) local pos: CURSOR do pos := cursor Result := sequential_occurrences (v) go_to (pos) end upper: INTEGER_32 -- Maximum index. -- Use count instead. -- (from ARRAYED_LIST) do Result := area_v2.count ensure -- from ARRAYED_LIST definition: Result = count end feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) do if a = Void then Result := b = Void else Result := b /= Void and then a.is_deep_equal (b) end ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) end disjoint (other: TRAVERSABLE_SUBSET [G]): BOOLEAN -- Do current set and other have no -- items in common? -- (from TRAVERSABLE_SUBSET) require -- from SUBSET set_exists: other /= Void same_rule: object_comparison = other.object_comparison do if not is_empty and not other.is_empty then Result := subset_strategy (other).disjoint (Current, other) else Result := True end end frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) do if a = Void then Result := b = Void else Result := b /= Void and then a.is_equal (b) end ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) end frozen is_deep_equal alias "≡≡≡" (other: ARRAYED_SET [G]): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void external "built_in" ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) end is_equal (other: ARRAYED_SET [G]): BOOLEAN -- Is array made of the same items as other? -- (from ARRAYED_LIST) require -- from ANY other_not_void: other /= Void local i: INTEGER_32 do if other = Current then Result := True elseif count = other.count and then object_comparison = other.object_comparison then if object_comparison then from Result := True i := Lower until not Result or i > upper loop Result := i_th (i) ~ other.i_th (i) i := i + 1 end else Result := area_v2.same_items (other.area_v2, 0, 0, count) end end ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result ensure then -- from LIST indices_unchanged: index = old index and other.index = old other.index true_implies_same_size: Result implies count = other.count end is_subset alias "⊆" (other: TRAVERSABLE_SUBSET [G]): BOOLEAN -- Is current set a subset of other? -- (from TRAVERSABLE_SUBSET) require -- from SUBSET set_exists: other /= Void same_rule: object_comparison = other.object_comparison do if not other.is_empty and then count <= other.count then from start until off or else not (other ∋ item) loop forth end if off then Result := True end elseif is_empty then Result := True end end is_superset alias "⊇" (other: SUBSET [G]): BOOLEAN -- Is current set a superset of other? -- (from SUBSET) require -- from SUBSET set_exists: other /= Void same_rule: object_comparison = other.object_comparison do Result := other ⊆ Current end frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) do if a = Void then Result := b = Void else Result := b /= Void and then a.standard_is_equal (b) end ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) end frozen standard_is_equal alias "≜" (other: ARRAYED_SET [G]): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void external "built_in" ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) end feature -- Status report after: BOOLEAN -- Is there no valid cursor position to the right of cursor? -- (from LIST) require -- from LINEAR True require -- from TRAVERSABLE_SUBSET True do Result := index = count + 1 end all_default: BOOLEAN -- Are all items set to default values? -- (from ARRAYED_LIST) require -- from ARRAYED_LIST has_default: ({G}).has_default do Result := area_v2.filled_with (({G}).default, 0, area_v2.upper) end before: BOOLEAN -- Is there no valid cursor position to the left of cursor? -- (from LIST) require -- from BILINEAR True require -- from LINEAR_SUBSET True do Result := index = 0 end conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void external "built_in" end empty: BOOLEAN obsolete "ELKS 2000: Use `is_empty' instead. [2017-05-31]" -- Is there no element? -- (from CONTAINER) do Result := is_empty end exhausted: BOOLEAN -- Has structure been completely explored? -- (from LINEAR) do Result := off ensure -- from LINEAR exhausted_when_off: off implies Result end extendible: BOOLEAN -- May new items be added? (Answer: yes.) -- (from DYNAMIC_CHAIN) require -- from COLLECTION True do Result := True end full: BOOLEAN -- Is structure full? -- (from BOUNDED) require -- from BOX True do Result := count = capacity end is_empty: BOOLEAN -- Is structure empty? -- (from FINITE) require -- from CONTAINER True do Result := count = 0 end is_inserted (v: G): BOOLEAN -- Has v been inserted by the most recent insertion? -- (By default, the value returned is equivalent to calling -- has (v). However, descendants might be able to provide more -- efficient implementations.) -- (from COLLECTION) do Result := has (v) end isfirst: BOOLEAN -- Is cursor at first position? -- (from CHAIN) do Result := not is_empty and (index = 1) ensure -- from CHAIN valid_position: Result implies not is_empty end islast: BOOLEAN -- Is cursor at last position? -- (from CHAIN) require -- from LINEAR_SUBSET True do Result := not is_empty and (index = count) ensure -- from CHAIN valid_position: Result implies not is_empty end object_comparison: BOOLEAN -- Must search operations use equal rather than = -- for comparing references? (Default: no, use =.) -- (from CONTAINER) off: BOOLEAN -- Is there no current item? -- (from CHAIN) require -- from TRAVERSABLE True require -- from TRAVERSABLE_SUBSET True do Result := (index = 0) or (index = count + 1) end prunable: BOOLEAN -- May items be removed? (Answer: yes.) -- (from ARRAYED_LIST) require -- from COLLECTION True do Result := True end readable: BOOLEAN -- Is there a current item that may be read? -- (from SEQUENCE) require -- from ACTIVE True do Result := not off end replaceable: BOOLEAN -- Can current item be replaced? -- (from ACTIVE) do Result := True end resizable: BOOLEAN -- May capacity be changed? (Answer: yes.) -- (from RESIZABLE) do Result := True end same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void external "built_in" ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) end valid_cursor (p: CURSOR): BOOLEAN -- Can the cursor be moved to position p? -- (from ARRAYED_LIST) do if attached {ARRAYED_LIST_CURSOR} p as al_c then Result := valid_cursor_index (al_c.index) end end valid_cursor_index (i: INTEGER_32): BOOLEAN -- Is i correctly bounded for cursor movement? -- (from CHAIN) do Result := (i >= 0) and (i <= count + 1) ensure -- from CHAIN valid_cursor_index_definition: Result = ((i >= 0) and (i <= count + 1)) end valid_index (i: INTEGER_32): BOOLEAN -- Is i a valid index? -- (from ARRAYED_LIST) require -- from READABLE_INDEXABLE True require -- from TABLE True require -- from LINEAR_SUBSET True do Result := (1 <= i) and (i <= count) ensure -- from READABLE_INDEXABLE only_if_in_index_set: Result implies (Lower <= i and i <= count) ensure then -- from CHAIN valid_index_definition: Result = ((i >= 1) and (i <= count)) ensure -- from LINEAR_SUBSET index_valid: 0 <= i and i <= count + 1 end array_valid_index (i: INTEGER_32): BOOLEAN -- Is i within the bounds of Current? -- (from TO_SPECIAL) do Result := area_v2.valid_index (i) end writable: BOOLEAN -- Is there a current item that may be modified? -- (from SEQUENCE) require -- from ACTIVE True do Result := not off end feature -- Status setting compare_objects -- Ensure that future search operations will use equal -- rather than = for comparing references. -- (from CONTAINER) require -- from CONTAINER changeable_comparison_criterion: changeable_comparison_criterion do object_comparison := True ensure -- from CONTAINER object_comparison end compare_references -- Ensure that future search operations will use = -- rather than equal for comparing references. -- (from CONTAINER) require -- from CONTAINER changeable_comparison_criterion: changeable_comparison_criterion do object_comparison := False ensure -- from CONTAINER reference_comparison: not object_comparison end feature -- Cursor movement back -- Move cursor one position backward. -- (from ARRAYED_LIST) require -- from BILINEAR not_before: not before do index := index - 1 end finish -- Move cursor to last position if any. -- (from ARRAYED_LIST) require -- from LINEAR True do index := count ensure then -- from CHAIN at_last: not is_empty implies islast ensure then -- from ARRAYED_LIST before_when_empty: is_empty implies before end forth -- Move cursor one position forward. -- (from ARRAYED_LIST) require -- from LINEAR not_after: not after require -- from TRAVERSABLE_SUBSET not_after: not after do index := index + 1 ensure then -- from LIST moved_forth: index = old index + 1 end go_i_th (i: INTEGER_32) -- Move cursor to i-th position. -- (from ARRAYED_LIST) require -- from CHAIN valid_cursor_index: valid_cursor_index (i) require -- from LINEAR_SUBSET valid_index: valid_index (i) do index := i ensure -- from CHAIN position_expected: index = i ensure -- from LINEAR_SUBSET cursor_moved: index = i end go_to (p: CURSOR) -- Move cursor to position p. -- (from ARRAYED_LIST) require -- from CURSOR_STRUCTURE cursor_position_valid: valid_cursor (p) do if attached {ARRAYED_LIST_CURSOR} p as al_c then index := al_c.index else check correct_cursor_type: False end end end move (i: INTEGER_32) -- Move cursor i positions. -- (from ARRAYED_LIST) do index := index + i if index > count + 1 then index := count + 1 elseif index < 0 then index := 0 end ensure -- from CHAIN too_far_right: (old index + i > count) implies exhausted too_far_left: (old index + i < 1) implies exhausted expected_index: (not exhausted) implies (index = old index + i) end 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.) -- (from ARRAYED_LIST) require -- from LINEAR True local l_area: like area_v2 i, nb: INTEGER_32 l_found: BOOLEAN do l_area := area_v2 nb := count - 1 i := (index - 1).max (0) if object_comparison and v /= Void then from until i > nb or l_found loop l_found := v ~ l_area.item (i) i := i + 1 end else from until i > nb or l_found loop l_found := v = l_area.item (i) i := i + 1 end end if l_found then index := i else index := i + 1 end ensure -- from LINEAR object_found: (not exhausted and object_comparison) implies v ~ item item_found: (not exhausted and not object_comparison) implies v = item end start -- Move cursor to first position if any. -- (from ARRAYED_LIST) require -- from TRAVERSABLE True require -- from TRAVERSABLE_SUBSET True do index := 1 ensure then -- from CHAIN at_first: not is_empty implies isfirst ensure then -- from ARRAYED_LIST after_when_empty: is_empty implies after end feature -- Element change append (s: SEQUENCE [G]) -- Append a copy of s. -- (from ARRAYED_LIST) require -- from SEQUENCE argument_not_void: s /= Void local c, old_count, new_count: INTEGER_32 do if attached {ARRAYED_LIST [G]} s as al then c := al.count if c > 0 then old_count := count new_count := old_count + al.count if new_count > area_v2.capacity then area_v2 := area_v2.aliased_resized_area (new_count) end; area_v2.copy_data (al.area_v2, 0, old_count, c) end else Precursor {DYNAMIC_LIST} (s) end ensure -- from SEQUENCE new_count: count >= old count end al_extend (v: like item) -- Add v to end. -- Do not move cursor. -- (from ARRAYED_LIST) require -- from COLLECTION extendible: extendible local i: INTEGER_32 l_area: like area_v2 do i := count + 1 l_area := area_v2 if i > l_area.capacity then l_area := l_area.aliased_resized_area (i + additional_space) area_v2 := l_area end; l_area.extend (v) ensure -- from COLLECTION item_inserted: is_inserted (v) end extend (v: G) -- Insert v if not present. -- Was declared in ARRAYED_SET as synonym of put. do if is_empty or else not has (v) then al_extend (v) end end fill (other: CONTAINER [G]) -- Fill with as many items of other as possible. -- The representations of other and current structure -- need not be the same. -- (from CHAIN) require -- from COLLECTION other_not_void: other /= Void extendible: extendible local lin_rep: LINEAR [G] l_cursor: CURSOR do lin_rep := other.linear_representation from l_cursor := cursor; lin_rep.start until not extendible or else lin_rep.off loop extend (lin_rep.item) finish; lin_rep.forth end go_to (l_cursor) end force (v: like item) -- Add v to end. -- Do not move cursor. -- Was declared in ARRAYED_LIST as synonym of extend. -- (from ARRAYED_LIST) require -- from SEQUENCE extendible: extendible local i: INTEGER_32 l_area: like area_v2 do i := count + 1 l_area := area_v2 if i > l_area.capacity then l_area := l_area.aliased_resized_area (i + additional_space) area_v2 := l_area end; l_area.extend (v) ensure then -- from SEQUENCE new_count: count = old count + 1 item_inserted: has (v) end merge (other: CONTAINER [G]) -- Add all items of other. -- (from TRAVERSABLE_SUBSET) require -- from SUBSET set_exists: other /= Void same_rule: object_comparison = other.object_comparison local l: LINEAR [G] do if attached {LINEAR [G]} other as lin_rep then l := lin_rep else l := other.linear_representation end from l.start until l.off loop extend (l.item); l.forth end end merge_left (other: ARRAYED_LIST [G]) -- Merge other into current structure before cursor. -- (from ARRAYED_LIST) require -- from DYNAMIC_CHAIN extendible: extendible not_before: not before other_exists: other /= Void not_current: other /= Current local old_index: INTEGER_32 old_other_count: INTEGER_32 do old_index := index old_other_count := other.count index := index - 1 merge_right (other) index := old_index + old_other_count ensure -- from DYNAMIC_CHAIN new_count: count = old count + old other.count new_index: index = old index + old other.count other_is_empty: other.is_empty end merge_right (other: ARRAYED_LIST [G]) -- Merge other into current structure after cursor. -- (from ARRAYED_LIST) require -- from DYNAMIC_CHAIN extendible: extendible not_after: not after other_exists: other /= Void not_current: other /= Current local l_new_count: INTEGER_32 do if not other.is_empty then l_new_count := count + other.count if l_new_count > area_v2.capacity then area_v2 := area_v2.aliased_resized_area (l_new_count) end; area_v2.insert_data (other.area_v2, 0, index, other.count); other.wipe_out end ensure -- from DYNAMIC_CHAIN new_count: count = old count + old other.count same_index: index = old index other_is_empty: other.is_empty end move_item (v: G) -- Move v to the left of cursor. -- (from LINEAR_SUBSET) require -- from LINEAR_SUBSET item_exists: v /= Void item_in_set: has (v) local idx: INTEGER_32 found: BOOLEAN do idx := index from start until found or after loop if object_comparison then found := v ~ item else found := v = item end if not found then forth end end check found: found and not after end remove go_i_th (idx) put_left (v) end put (v: G) -- Insert v if not present. -- Was declared in ARRAYED_SET as synonym of extend. do if is_empty or else not has (v) then al_extend (v) end end array_put (v: G; i: INTEGER_32) -- Replace i-th entry, if in index interval, by v. -- (from TO_SPECIAL) require -- from TO_SPECIAL valid_index: array_valid_index (i) do area_v2.put (v, i) ensure -- from TO_SPECIAL inserted: array_item (i) = v end al_put (v: like item) -- Replace current item by v. -- (Synonym for replace) -- (from CHAIN) require -- from CHAIN writeable: writable replaceable: replaceable do replace (v) ensure -- from CHAIN same_count: count = old count is_inserted: is_inserted (v) end sequence_put (v: like item) -- Add v to end. -- (from SEQUENCE) require -- from COLLECTION extendible: extendible do extend (v) ensure -- from COLLECTION item_inserted: is_inserted (v) ensure then -- from SEQUENCE new_count: count = old count + 1 end put_front (v: like item) -- Add v to the beginning. -- Do not move cursor. -- (from ARRAYED_LIST) require -- from DYNAMIC_CHAIN extendible: extendible do if is_empty then extend (v) else insert (v, 1) end index := index + 1 ensure -- from DYNAMIC_CHAIN new_count: count = old count + 1 item_inserted: first = v end put_i_th (v: like i_th; i: INTEGER_32) -- Replace i-th entry, if in index interval, by v. -- (from ARRAYED_LIST) require -- from TABLE valid_key: valid_index (i) require -- from TABLE valid_key: valid_index (i) do area_v2.put (v, i - 1) ensure -- from TABLE inserted: i_th (i) = v end put_left (v: like item) -- Add v to the left of current position. -- Do not move cursor. -- (from ARRAYED_LIST) require -- from DYNAMIC_CHAIN extendible: extendible not_before: not before require -- from LINEAR_SUBSET item_exists: v /= Void not_before: not before do if after or is_empty then extend (v) else insert (v, index) end index := index + 1 ensure -- from DYNAMIC_CHAIN new_count: count = old count + 1 new_index: index = old index + 1 ensure -- from LINEAR_SUBSET cursor_position_unchanged: index = old index + 1 end put_right (v: like item) -- Add v to the right of current position. -- Do not move cursor. -- (from ARRAYED_LIST) require -- from DYNAMIC_CHAIN extendible: extendible not_after: not after do if index = count then extend (v) else insert (v, index + 1) end ensure -- from DYNAMIC_CHAIN new_count: count = old count + 1 same_index: index = old index end replace (v: like first) -- Replace current item by v. -- (from ARRAYED_LIST) require -- from ACTIVE writable: writable replaceable: replaceable do put_i_th (v, index) ensure -- from ACTIVE item_replaced: item = v end feature {NONE} -- Element change set_area (other: like area_v2) -- Make other the new area. -- (from TO_SPECIAL) do area_v2 := other ensure -- from TO_SPECIAL area_set: area_v2 = other end feature -- Removal changeable_comparison_criterion: BOOLEAN -- May object_comparison be changed? -- (Answer: only if set empty; otherwise insertions might -- introduce duplicates, destroying the set property.) -- (from SET) require -- from CONTAINER True do Result := is_empty ensure then -- from SET only_on_empty: Result = is_empty end prune (v: like item) -- Remove v if present. do start al_prune (v) end al_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) -- (from ARRAYED_LIST) require -- from COLLECTION prunable: prunable do if before then index := 1 end if object_comparison then from until after or else item ~ v loop forth end else from until after or else item = v loop forth end end if not after then remove end end prune_all (v: like item) -- Remove all occurrences of v. -- (Reference or object equality, -- based on object_comparison.) -- (from ARRAYED_LIST) require -- from COLLECTION prunable: prunable local i, nb: INTEGER_32 offset: INTEGER_32 res: BOOLEAN obj_cmp: BOOLEAN l_area: like area_v2 do obj_cmp := object_comparison from l_area := area_v2 i := 0 nb := count until i = count loop if i < nb - offset then if offset > 0 then l_area.put (l_area.item (i + offset), i) end if obj_cmp then res := v ~ l_area.item (i) else res := v = l_area.item (i) end if res then offset := offset + 1 else i := i + 1 end else i := i + 1 end end; l_area.remove_tail (offset) index := count + 1 ensure -- from COLLECTION no_more_occurrences: not has (v) ensure then -- from DYNAMIC_CHAIN is_exhausted: exhausted ensure then -- from ARRAYED_LIST is_after: after end remove -- Remove current item. -- Move cursor to right neighbor -- (or after if no right neighbor) -- (from ARRAYED_LIST) require -- from ACTIVE prunable: prunable writable: writable require -- from TRAVERSABLE_SUBSET not_off: not off do if index < count then area_v2.move_data (index, index - 1, count - index) end; area_v2.remove_tail (1) ensure then -- from DYNAMIC_LIST after_when_empty: is_empty implies after ensure then -- from ARRAYED_LIST index: index = old index end remove_i_th (i: INTEGER_32) -- Remove item at index i. -- Move cursor to next neighbor (or after if no next neighbor) if it is at i-th position. -- Do not change cursor otherwise. -- (from ARRAYED_LIST) require -- from DYNAMIC_TABLE prunable: prunable valid_key: valid_index (i) do if i < count then area_v2.move_data (i, i - 1, count - i) end; area_v2.remove_tail (1) if index > i then index := index - 1 end ensure then -- from DYNAMIC_CHAIN new_count: count = old count - 1 same_index_if_below: index <= i implies index = old index new_index_if_above: index > i implies index = old index - 1 same_leading_items: across old twin as c all c.target_index < i implies c.item = i_th (c.target_index) end same_trailing_items: across old twin as c all c.target_index > i implies c.item = i_th (c.target_index - 1) end end remove_left -- Remove item to the left of cursor position. -- Do not move cursor. -- (from ARRAYED_LIST) require -- from DYNAMIC_CHAIN left_exists: index > 1 do index := index - 1 remove ensure -- from DYNAMIC_CHAIN new_count: count = old count - 1 new_index: index = old index - 1 end remove_right -- Remove item to the right of cursor position -- Do not move cursor -- (from ARRAYED_LIST) require -- from DYNAMIC_CHAIN right_exists: index < count do index := index + 1 remove index := index - 1 ensure -- from DYNAMIC_CHAIN new_count: count = old count - 1 same_index: index = old index end wipe_out -- Remove all items. -- (from ARRAYED_LIST) require -- from COLLECTION prunable: prunable do area_v2.wipe_out index := 0 ensure then -- from DYNAMIC_LIST is_before: before ensure -- from COLLECTION wiped_out: is_empty end chain_wipe_out -- Remove all items. -- (from DYNAMIC_CHAIN) require -- from COLLECTION prunable: prunable do from start until is_empty loop remove end ensure -- from COLLECTION wiped_out: is_empty end feature -- Resizing automatic_grow -- Change the capacity to accommodate at least -- Growth_percentage more items. -- (from RESIZABLE) require -- from RESIZABLE resizable: resizable do grow (capacity + additional_space) ensure -- from RESIZABLE increased_capacity: capacity >= old capacity + old additional_space end grow (i: INTEGER_32) -- Change the capacity to at least i. -- (from ARRAYED_LIST) require -- from RESIZABLE resizable: resizable do if i > area_v2.capacity then area_v2 := area_v2.aliased_resized_area (i) end ensure -- from RESIZABLE new_capacity: capacity >= i end resize (new_capacity: INTEGER_32) -- Resize list so that it can contain -- at least n items. Do not lose any item. -- (from ARRAYED_LIST) require -- from ARRAYED_LIST resizable: resizable new_capacity_large_enough: new_capacity >= capacity do grow (new_capacity) ensure -- from ARRAYED_LIST capacity_set: capacity >= new_capacity end trim -- Decrease capacity to the minimum value. -- Apply to reduce allocated storage. -- (from ARRAYED_LIST) require -- from RESIZABLE True local n: like count do n := count if n < area_v2.capacity then area_v2 := area_v2.aliased_resized_area (n) end ensure -- from RESIZABLE same_count: count = old count minimal_capacity: capacity = count ensure then -- from ARRAYED_LIST same_items: to_array.same_items (old to_array) end feature -- Transformation swap (i: INTEGER_32) -- Exchange item at i-th position with item -- at cursor position. -- (from ARRAYED_LIST) require -- from CHAIN not_off: not off valid_index: valid_index (i) local old_item: like item do old_item := item replace (area_v2.item (i - 1)); area_v2.put (old_item, i - 1) ensure -- from CHAIN swapped_to_item: item = old i_th (i) swapped_from_item: i_th (i) = old item end feature -- Conversion linear_representation: LINEAR [G] -- Representation as a linear structure -- (from LINEAR) require -- from CONTAINER True do Result := Current end feature -- Duplication frozen clone (other: detachable ANY): like other obsolete "Use `twin' instead. [2017-05-31]" -- Void if other is void; otherwise new object -- equal to other -- -- For non-void other, clone calls copy; -- to change copying/cloning semantics, redefine copy. -- (from ANY) do if other /= Void then Result := other.twin end ensure -- from ANY instance_free: class equal: Result ~ other end copy (other: ARRAYED_SET [G]) -- Reinitialize by copying all the items of other. -- (This is also used by clone.) -- (from ARRAYED_LIST) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) do if other /= Current then standard_copy (other) set_area (other.area_v2.twin) end ensure -- from ANY is_equal: Current ~ other ensure then -- from ARRAYED_LIST equal_areas: area_v2 ~ other.area_v2 end frozen deep_clone (other: detachable ANY): like other obsolete "Use `deep_twin' instead. [2017-05-31]" -- Void if other is void: otherwise, new object structure -- recursively duplicated from the one attached to other -- (from ANY) do if other /= Void then Result := other.deep_twin end ensure -- from ANY instance_free: class deep_equal: deep_equal (other, Result) end frozen deep_copy (other: ARRAYED_SET [G]) -- Effect equivalent to that of: -- copy (other . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void do copy (other.deep_twin) ensure -- from ANY deep_equal: deep_equal (Current, other) end frozen deep_twin: ARRAYED_SET [G] -- New object structure recursively duplicated from Current. -- (from ANY) external "built_in" ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) end duplicate (n: INTEGER_32): ARRAYED_SET [G] obsolete "[ Create a new container explicitly using `make_from_iterable` if available. Otherwise, replace a call to the feature with code that creates and initializes container. [2018-11-30] ]" -- Copy of sub-list beginning at current position -- and having min (n, count - index + 1) items. -- (from ARRAYED_LIST) require -- from CHAIN not_off_unless_after: off implies after valid_subchain: n >= 0 require -- from SUBSET non_negative: n >= 0 local m: INTEGER_32 do if after then Result := new_filled_list (0) else m := (count - index + 1).min (n) Result := new_filled_list (m); Result.area_v2.copy_data (area_v2, index - 1, 0, m) end ensure -- from SUBSET correct_count_1: n <= count implies Result.count = n correct_count_2: n >= count implies Result.count = count end frozen standard_clone (other: detachable ANY): like other obsolete "Use `standard_twin' instead. [2017-05-31]" -- Void if other is void; otherwise new object -- field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) do if other /= Void then Result := other.standard_twin end ensure -- from ANY instance_free: class equal: standard_equal (Result, other) end frozen standard_copy (other: ARRAYED_SET [G]) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) external "built_in" ensure -- from ANY is_standard_equal: standard_is_equal (other) end frozen standard_twin: ARRAYED_SET [G] -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) external "built_in" ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) end frozen twin: ARRAYED_SET [G] -- New object equal to Current -- twin calls copy; to change copying/twinning semantics, redefine copy. -- (from ANY) external "built_in" ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current end feature -- Basic operations frozen as_attached: attached ARRAYED_SET [G] obsolete "Remove calls to this feature. [2017-05-31]" -- Attached version of Current. -- (Can be used during transitional period to convert -- non-void-safe classes to void-safe ones.) -- (from ANY) do Result := Current end frozen default: detachable ARRAYED_SET [G] -- Default value of object's type -- (from ANY) do end frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.default for -- some p of type POINTER.) -- (from ANY) do ensure -- from ANY instance_free: class end default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) do end frozen do_nothing -- Execute a null action. -- (from ANY) do ensure -- from ANY instance_free: class end intersect (other: TRAVERSABLE_SUBSET [G]) -- Remove all items not in other. -- No effect if other is_empty. -- (from TRAVERSABLE_SUBSET) require -- from SUBSET set_exists: other /= Void same_rule: object_comparison = other.object_comparison do if not other.is_empty then from start; other.start until off loop if other ∋ item then forth else remove end end else wipe_out end ensure -- from SUBSET is_subset_other: is_subset (other) end subtract (other: TRAVERSABLE_SUBSET [G]) -- Remove all items also in other. -- (from TRAVERSABLE_SUBSET) require -- from SUBSET set_exists: other /= Void same_rule: object_comparison = other.object_comparison do if not (other.is_empty or is_empty) then from start; other.start until off loop if other ∋ item then remove else forth end end end ensure -- from SUBSET is_disjoint: disjoint (other) end symdif (other: TRAVERSABLE_SUBSET [G]) -- Remove all items also in other, and add all -- items of other not already present. -- (from TRAVERSABLE_SUBSET) require -- from SUBSET set_exists: other /= Void same_rule: object_comparison = other.object_comparison do if not other.is_empty then if is_empty then from other.start until other.after loop extend (other.item) end else subset_strategy (other).symdif (Current, other) end end end feature {DYNAMIC_CHAIN} -- Inapplicable new_chain: ARRAYED_SET [G] obsolete "Use explicit creation instead. See also explanations for `duplicate`. [2018-11-30]" -- Unused -- (from ARRAYED_LIST) do Result := Current ensure -- from DYNAMIC_CHAIN result_exists: Result /= Void end feature {NONE} -- Implementation force_i_th (v: like i_th; pos: INTEGER_32) -- (from ARRAYED_LIST) do if count + 1 > capacity then grow (count + additional_space) end; area_v2.force (v, pos) end insert (v: like item; pos: INTEGER_32) -- Add v at pos, moving subsequent items -- to the right. -- (from ARRAYED_LIST) require -- from ARRAYED_LIST index_small_enough: pos <= count index_large_enough: pos >= 1 do if count + 1 > capacity then grow (count + additional_space) end; area_v2.move_data (pos - 1, pos, count - pos + 1) put_i_th (v, pos) ensure -- from ARRAYED_LIST new_count: count = old count + 1 index_unchanged: index = old index insertion_done: i_th (pos) = v end new_filled_list (n: INTEGER_32): ARRAYED_SET [G] obsolete "Use explicit creation instead. See also explanations for `duplicate`. [2018-11-30]" -- New list with n elements. -- (from ARRAYED_LIST) require -- from ARRAYED_LIST n_non_negative: n >= 0 do create Result.make (n) ensure -- from ARRAYED_LIST new_filled_list_not_void: Result /= Void new_filled_list_count_set: Result.is_empty new_filled_list_before: Result.before end subset_strategy (other: TRAVERSABLE_SUBSET [G]): SUBSET_STRATEGY [G] -- Subset strategy suitable for the type of the contained elements. -- (from TRAVERSABLE_SUBSET) require -- from TRAVERSABLE_SUBSET not_empty: not is_empty do start check not_off: not off end Result := subset_strategy_selection (item, other) end subset_strategy_selection (v: G; other: TRAVERSABLE_SUBSET [G]): SUBSET_STRATEGY [G] -- Strategy to calculate several subset features selected depending -- on the dynamic type of v and other -- (from LINEAR_SUBSET) require -- from TRAVERSABLE_SUBSET item_exists: v /= Void other_exists: other /= Void do if attached {HASHABLE} v as h then create {SUBSET_STRATEGY_HASHABLE [G]} Result else create {SUBSET_STRATEGY_GENERIC [G]} Result end ensure -- from TRAVERSABLE_SUBSET strategy_set: Result /= Void end feature -- Correction Mismatch_information: MISMATCH_INFORMATION -- Original attribute values of mismatched object -- (from MISMATCH_CORRECTOR) once create Result end feature {NONE} -- Creation make_from_iterable (other: ITERABLE [G]) -- Create a circular chain with all items obtained from other. do make (estimated_count_of (other)) across other as o loop extend (o.item) end end 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. -- (from ARRAYED_LIST) require -- from TRAVERSABLE action_exists: action /= Void do area_v2.do_all_in_bounds (action, 0, area_v2.count - 1) end 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. -- (from ARRAYED_LIST) require -- from ARRAYED_LIST action_not_void: action /= Void local i, j, nb: INTEGER_32 l_area: like area_v2 do from i := 0 j := Lower nb := count - 1 l_area := area_v2 until i > nb loop action.call ([l_area.item (i), j]) j := j + 1 i := i + 1 end end 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. -- (from ARRAYED_LIST) require -- from TRAVERSABLE action_exists: action /= Void test_exists: test /= Void do area_v2.do_if_in_bounds (action, test, 0, area_v2.count - 1) end 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. -- (from ARRAYED_LIST) require -- from ARRAYED_LIST action_not_void: action /= Void test_not_void: test /= Void local i, j, nb: INTEGER_32 l_area: like area_v2 do from i := 0 j := Lower nb := count - 1 l_area := area_v2 until i > nb loop if test.item ([l_area.item (i), j]) then action.call ([l_area.item (i), j]) end j := j + 1 i := i + 1 end end for_all (test: FUNCTION [G, BOOLEAN]): BOOLEAN -- Is test true for all items? -- (from ARRAYED_LIST) require -- from TRAVERSABLE test_exists: test /= Void do Result := area_v2.for_all_in_bounds (test, 0, area_v2.count - 1) ensure then -- from LINEAR empty: is_empty implies Result end there_exists (test: FUNCTION [G, BOOLEAN]): BOOLEAN -- Is test true for at least one item? -- (from ARRAYED_LIST) require -- from TRAVERSABLE test_exists: test /= Void do Result := area_v2.there_exists_in_bounds (test, 0, area_v2.count - 1) end feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) once create Result; Result.set_output_default ensure -- from ANY instance_free: class io_not_void: Result /= Void end out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) do Result := tagged_out ensure -- from ANY out_not_void: Result /= Void end print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) local s: READABLE_STRING_8 do if attached o then s := o.out if attached {READABLE_STRING_32} s as s32 then Io.put_string_32 (s32) elseif attached {READABLE_STRING_8} s as s8 then Io.put_string (s8) else Io.put_string_32 (s.as_string_32) end end ensure -- from ANY instance_free: class end frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) external "built_in" ensure -- from ANY tagged_out_not_void: Result /= Void end feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) once create Result ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void end feature {NONE} -- Retrieval frozen internal_correct_mismatch -- Called from runtime to perform a proper dynamic dispatch on correct_mismatch -- from MISMATCH_CORRECTOR. -- (from ANY) local l_msg: STRING_32 l_exc: EXCEPTIONS do if attached {MISMATCH_CORRECTOR} Current as l_corrector then l_corrector.correct_mismatch else create l_msg.make_from_string ("Mismatch: ".as_string_32) create l_exc; l_msg.append (generating_type.name_32); l_exc.raise_retrieval_exception (l_msg) end end feature -- Retrieval correct_mismatch -- Attempt to correct object mismatch using Mismatch_information. -- (from ARRAYED_LIST) local i: INTEGER_32 do if not Mismatch_information.has ("area_v2") and then attached {SPECIAL [G]} Mismatch_information.item ("area") as l_area and then attached {INTEGER_32} Mismatch_information.item ("count") as l_count and then attached {BOOLEAN} Mismatch_information.item ("object_comparison") as l_comp and then attached {INTEGER_32} Mismatch_information.item ("index") as l_index then create area_v2.make_empty (l_count) from i := 0 until i = l_count loop area_v2.extend (l_area.item (i)) i := i + 1 end object_comparison := l_comp index := l_index else Precursor end end invariant -- from LINEAR_SUBSET before_definition: before = (index = 0) -- from TRAVERSABLE_SUBSET empty_definition: is_empty = (count = 0) count_range: count >= 0 -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from ARRAYED_LIST prunable: prunable starts_from_one: Lower = 1 -- from RESIZABLE increase_by_at_least_one: Minimal_increase >= 1 -- from BOUNDED valid_count: count <= capacity full_definition: full = (count = capacity) -- from FINITE empty_definition: is_empty = (count = 0) -- from LIST before_definition: before = (index = 0) after_definition: after = (index = count + 1) -- from CHAIN non_negative_index: index >= 0 index_small_enough: index <= count + 1 off_definition: off = ((index = 0) or (index = count + 1)) isfirst_definition: isfirst = ((not is_empty) and (index = 1)) islast_definition: islast = ((not is_empty) and (index = count)) item_corresponds_to_index: (not off) implies (item = i_th (index)) -- from ACTIVE writable_constraint: writable implies readable empty_constraint: is_empty implies (not readable) and (not writable) -- from READABLE_INDEXABLE consistent_boundaries: Lower <= count or else Lower = count + 1 -- from BILINEAR not_both: not (after and before) before_constraint: before implies off -- from LINEAR after_constraint: after implies off -- from TRAVERSABLE empty_constraint: is_empty implies off 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 ARRAYED_SET
Generated by ISE EiffelStudio