[BACK]Return to generic_lists.ads CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Polynomials

Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Polynomials/generic_lists.ads, Revision 1.1.1.1

1.1       maekawa     1: generic
                      2:
                      3:   type Item is private;
                      4:
                      5: package Generic_Lists is
                      6:
                      7: -- DESCRIPTION :
                      8: --   This generic package allows to implement lists of items.
                      9:
                     10:   type List is private;
                     11:
                     12:   Null_List : constant List;
                     13:
                     14:   Overflow     : exception;
                     15:   List_Is_Null : exception;
                     16:
                     17: -- CONSTRUCTORS :
                     18:
                     19:   procedure Construct ( i : in Item; l : in out List );
                     20:
                     21:   -- DESCRIPTION :
                     22:   --   Adds the item i to the front of the list l.
                     23:
                     24:   procedure Set_Head ( l : in out List; i : in Item);
                     25:
                     26:   -- DESCRIPTION :
                     27:   --   Sets the first element in the list to item i.
                     28:
                     29:   -- REQUIRED : not Is_Null(l).
                     30:
                     31:   procedure Swap_Tail ( l1,l2 : in out List );
                     32:
                     33:   -- DESCRIPTION :
                     34:   --   Swaps the tail of list l1 with the list l2.
                     35:
                     36:   procedure Append ( first,last : in out List; i : in Item );
                     37:
                     38:   -- DESCRIPTION :
                     39:   --   Appends the item i to the list, where first points to the first
                     40:   --   element and last to its last element.
                     41:
                     42:   procedure Concat ( first,last : in out List; l : in List );
                     43:
                     44:   -- DESCRIPTION :
                     45:   --   Concatenates the list l to the list first, where last points to
                     46:   --   the last element of the list.
                     47:
                     48:   procedure Copy ( l1 : in List; l2 : in out List );
                     49:
                     50:   -- DESCRIPTION :
                     51:   --   Makes a copy from the list l1 to the list l2.
                     52:
                     53: -- SELECTORS :
                     54:
                     55:   function Is_Equal ( l1,l2 : List ) return boolean;
                     56:
                     57:   -- DESCRIPTION :
                     58:   --   Returns true if both lists are equal.
                     59:
                     60:   function Length_Of ( l : List ) return natural;
                     61:
                     62:   -- DESCRIPTION :
                     63:   --   Returns the length of the list, i.e.: the number of elements.
                     64:
                     65:   function Is_Null ( l : List ) return boolean;
                     66:
                     67:   -- DESCRIPTION :
                     68:   --   Returns true if the list is empty, false otherwise.
                     69:
                     70:   function Head_Of ( l : List) return Item;
                     71:
                     72:   -- DESCRIPTION :
                     73:   --   Returns the first element in the list.
                     74:
                     75:   -- REQUIRED : not Is_Null(l).
                     76:
                     77:   function Tail_Of ( l : List ) return List;
                     78:
                     79:   -- DESCRIPTION :
                     80:   --   Returns the tail of the list l.
                     81:
                     82:   -- REQUIRED : not Is_Null(l).
                     83:
                     84: -- DESTRUCTOR :
                     85:
                     86:   procedure Clear ( l : in out List );
                     87:
                     88:   -- DESCRIPTION :
                     89:   --   Deallocates the memory occupied by the elements in the list.
                     90:
                     91: private
                     92:
                     93:   type Node;
                     94:   type List is access Node;
                     95:   Null_List : constant List := null;
                     96:
                     97: end Generic_Lists;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>