Automatic generation produced by ISE Eiffel

Classes Clusters Cluster hierarchy Chart Relations Text Flat Contracts Flat contracts Go to:
indexing description: "Two-way lists, kept sorted" status: "See notice at end of class" names: sorted_two_way_list, sorted_struct, sequence representation: linked access: index, cursor, membership, min, max contents: generic date: "$Date: 2001-11-16 20:32:23 +0000 (Fri, 16 Nov 2001) $" revision: "$Revision: 51435 $" class PART_SORTED_TWO_WAY_LIST [G -> PART_COMPARABLE] inherit TWO_WAY_LIST [G] undefine has, search, is_inserted redefine prune_all, extend, new_chain end PART_SORTED_LIST [G] undefine move, remove, before, go_i_th, isfirst, start, finish, readable, islast, first, prune, after, last, off, prune_all, copy, is_equal end create make feature -- Element change extend (v: like item) is -- Put v at proper position in list. -- The cursor ends up on the newly inserted -- item. do search_after (v) put_left (v) back end feature -- Removal prune_all (v: like item) is -- Remove all items identical to v. -- (Reference or object equality, -- based on object_comparison.) -- Leave cursor off. do from start search (v) until off or else v < item loop remove end if not off then finish forth end end feature -- Status report sorted: BOOLEAN is -- is the structures topologically sorted -- i.e i < j implies not i_th (i) > i_th (j) local c: CURSOR prev: like item do Result := True if count > 1 then from c := cursor start check not off end prev := item forth until after or not Result loop Result := (prev <= item) prev := item forth end go_to (c) end end feature -- Transformation sort is -- sort the list -- Has O(count * log (count)) complexity. local no_change: BOOLEAN gap: INTEGER left_cell, cell: like first_element left_cell_item, cell_item: like item do if not is_empty then from gap := count * 10 // 13 until gap = 0 loop from no_change := False go_i_th (1 + gap) until no_change loop no_change := True from left_cell := first_element cell := active until cell = void loop left_cell_item := left_cell.item cell_item := cell.item if cell_item < left_cell_item then no_change := False cell.put (left_cell_item) left_cell.put (cell_item) end left_cell := left_cell.right cell := cell.right end end gap := gap * 10 // 13 end end end feature {PART_SORTED_TWO_WAY_LIST} -- Implementation new_chain: like Current is -- A newly created instance of the same type. -- This feature may be redefined in descendants so as to -- produce an adequately allocated and initialized object. do create Result.make end indexing library: "[ EiffelBase: Library of reusable components for Eiffel. ]" status: "[ Copyright 1986-2001 Interactive Software Engineering (ISE). For ISE customers the original versions are an ISE product covered by the ISE Eiffel license and support agreements. ]" license: "[ EiffelBase may now be used by anyone as FREE SOFTWARE to develop any product, public-domain or commercial, without payment to ISE, under the terms of the ISE Free Eiffel Library License (IFELL) at http://eiffel.com/products/base/license.html. ]" source: "[ Interactive Software Engineering Inc. ISE Building 360 Storke Road, Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Electronic mail <info@eiffel.com> Customer support http://support.eiffel.com ]" info: "[ For latest info see award-winning pages: http://eiffel.com ]" end -- class PART_SORTED_TWO_WAY_LIST
Classes Clusters Cluster hierarchy Chart Relations Text Flat Contracts Flat contracts Go to:

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