generic type Index_Type is (); type Element_Type is private; type Element_Array is array (Index_Type range ) of Element_Type; with function ">" (L, R : Element_Type) return Boolean; procedure Ada_Store.Support.Bubble_Sort(The_Array : in out Element_Array);
procedure Ada_Store.Support.Bubble_Sort(The_Array : in out Element_Array) is begin for Loop_Top in reverse The_Array'Range loop for Item in The_Array'First .. Index_Type'Pred(Loop_Top) loop if The_Array(Item) > The_Array(Index_Type'Succ(Item)) then declare Element : Element_Type := The_Array(Item); begin The_Array(Item) := The_Array(Index_Type'Succ(Item)); The_Array(Index_Type'Succ(Item)) := Element; end; end if; end loop; end loop; end Ada_Store.Support.Bubble_Sort;
Copyright ©
1996 Simon Johnston &
Addison Wesley Longman