Interface to Generic Bubble Sort Procedure

Go to Procedure Implementation

GENERIC

  TYPE KeyType IS PRIVATE;
  TYPE ElementType IS PRIVATE;
  TYPE IndexType IS RANGE <>;   -- integer subscripts
  TYPE ListType IS ARRAY (IndexType RANGE <>) OF ElementType;
  WITH FUNCTION KeyOf  (Element: ElementType) RETURN KeyType IS <>;
  WITH FUNCTION "<"(Left, Right: KeyType) RETURN Boolean IS <>;

PROCEDURE Sort_Bubble_Generic(List: IN OUT ListType);
------------------------------------------------------------------------
--| Pre:  The procedure has been instantiated and List is defined
--| Post: The contents of List are in order defined by "<"
--| Author: Michael B. Feldman, The George Washington University
--| Last Modified: January 1996
------------------------------------------------------------------------