Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Supports/generic_lists_of_vectors.ads, Revision 1.1
1.1 ! maekawa 1: with Abstract_Ring;
! 2: with Generic_Vectors;
! 3: with Generic_VecVecs;
! 4: with Generic_Lists;
! 5:
! 6: generic
! 7:
! 8: with package Ring is new Abstract_Ring(<>);
! 9: with package Vectors is new Generic_Vectors(Ring);
! 10: with package VecVecs is new Generic_VecVecs(Ring,Vectors);
! 11:
! 12: package Generic_Lists_of_Vectors is
! 13:
! 14: -- DESCRIPTION :
! 15: -- An implementation of lists of links to vectors.
! 16:
! 17: use Vectors,VecVecs;
! 18:
! 19: -- DATA STRUCTURE : a list of pointers to vectors
! 20:
! 21: package Vector_Lists is new Generic_Lists(Link_to_Vector);
! 22: type List is new Vector_Lists.List;
! 23:
! 24: -- CREATORS :
! 25:
! 26: function Deep_Create ( v : VecVec ) return List;
! 27: function Shallow_Create ( v : VecVec ) return List;
! 28:
! 29: function Deep_Create ( l : List ) return VecVec;
! 30: function Shallow_Create ( l : List ) return VecVec;
! 31:
! 32: -- DESCRIPTION :
! 33: -- l := Create(v) equals v := Create(l).
! 34: -- There is no sharing of pointers with a deep Create.
! 35: -- With a shallow Create, both structure share the pointers.
! 36:
! 37: -- COMPARISON and COPYING :
! 38:
! 39: procedure Copy ( l1 : in List; l2 : in out List );
! 40:
! 41: -- DESCRIPTION :
! 42: -- After Copy(l1,l2), Equal(l1,l2) holds.
! 43: -- Of course, this is a deep copy, a shallow copy is given by l2 := l1.
! 44:
! 45: function Equal ( l1,l2 : List ) return boolean;
! 46:
! 47: -- DESCRIPTION :
! 48: -- Returns true if both lists have the same vectors, false otherwise.
! 49:
! 50: -- SELECTORS :
! 51:
! 52: function Is_In ( l : List; v : Vector ) return boolean;
! 53: function Is_In ( l : List; v : Link_to_Vector ) return boolean;
! 54:
! 55: -- DESCRIPTION :
! 56: -- Returns true if the vector belongs to l, false otherwise.
! 57:
! 58: function Sub_List ( l1,l2 : List ) return boolean;
! 59:
! 60: -- DESCRIPTION :
! 61: -- Returns true if all elements in l1 occur in l2, false otherwise.
! 62:
! 63: -- CONSTRUCTORS :
! 64:
! 65: procedure Append ( first,last : in out List; v : in Vector );
! 66:
! 67: -- DESCRIPTION :
! 68: -- The vector will be appended to the list first,
! 69: -- last is a pointer to the last element of the list first.
! 70:
! 71: procedure Append_Diff ( first,last : in out List; v : in Vector );
! 72: procedure Append_Diff ( first,last : in out List; v : in Link_to_Vector );
! 73:
! 74: -- DESCRIPTION :
! 75: -- Only when v does not already belong to first, v will be added.
! 76:
! 77: procedure Deep_Concat ( first,last : in out List; l : in List );
! 78: procedure Shallow_Concat ( first,last : in out List; l : in List );
! 79:
! 80: -- DESCRIPTION :
! 81: -- The list l will be concatenated to the list first,
! 82: -- last is a pointer to the last element of the list first.
! 83: -- With a deep concatenation, no pointers are shared.
! 84:
! 85: procedure Deep_Concat_Diff ( first,last : in out List; l : in List );
! 86: procedure Shallow_Concat_Diff ( first,last : in out List; l : in List );
! 87:
! 88: -- DESCRIPTION :
! 89: -- Only those vectors of l will be concatenated that are not already
! 90: -- in the list first.
! 91: -- With a deep concatenation, no pointers are shared.
! 92:
! 93: procedure Remove ( l : in out List; x : in Vector );
! 94: procedure Remove ( l : in out List; x : in Link_to_Vector );
! 95:
! 96: -- DESCRIPTION :
! 97: -- Removes the point x from the list l.
! 98:
! 99: procedure Swap_to_Front ( l : in out List; x : in Vector );
! 100: procedure Swap_to_Front ( l : in out List; x : in Link_to_Vector );
! 101:
! 102: -- DESCRIPTION :
! 103: -- The point x belongs to the list l,
! 104: -- Its content will be place in front of l and the first element
! 105: -- of l will be swapped to the place of x.
! 106:
! 107: -- DESTRUCTORS :
! 108:
! 109: procedure Deep_Clear ( l : in out List );
! 110: procedure Shallow_Clear ( l : in out List );
! 111:
! 112: -- DESCRIPTION :
! 113: -- Frees all allocated memory space.
! 114: -- A deep clear deallocates also the points to the integer vectors,
! 115: -- while a shallow clear only removes the list structure.
! 116:
! 117: end Generic_Lists_of_Vectors;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>