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

File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Supports / generic_lists_of_vectors.ads (download)

Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:27 2000 UTC (23 years, 8 months ago) by maekawa
Branch: PHC, MAIN
CVS Tags: v2, maekawa-ipv6, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, RELEASE_1_2_1, HEAD
Changes since 1.1: +0 -0 lines

Import the second public release of PHCpack.

OKed by Jan Verschelde.

with Abstract_Ring;
with Generic_Vectors;
with Generic_VecVecs;
with Generic_Lists;

generic

  with package Ring is new Abstract_Ring(<>);
  with package Vectors is new Generic_Vectors(Ring);
  with package VecVecs is new Generic_VecVecs(Ring,Vectors);

package Generic_Lists_of_Vectors is

-- DESCRIPTION :
--   An implementation of lists of links to vectors.

  use Vectors,VecVecs;

-- DATA STRUCTURE : a list of pointers to vectors

  package Vector_Lists is new Generic_Lists(Link_to_Vector);
  type List is new Vector_Lists.List;

-- CREATORS :

  function Deep_Create    ( v : VecVec ) return List;
  function Shallow_Create ( v : VecVec ) return List;

  function Deep_Create    ( l : List ) return VecVec;
  function Shallow_Create ( l : List ) return VecVec;

  -- DESCRIPTION :
  --   l := Create(v) equals v := Create(l).
  --   There is no sharing of pointers with a deep Create.
  --   With a shallow Create, both structure share the pointers.

-- COMPARISON and COPYING :

  procedure Copy ( l1 : in List; l2 : in out List );

  -- DESCRIPTION :
  --   After Copy(l1,l2), Equal(l1,l2) holds.
  --   Of course, this is a deep copy, a shallow copy is given by l2 := l1.

  function Equal ( l1,l2 : List ) return boolean;

  -- DESCRIPTION :
  --   Returns true if both lists have the same vectors, false otherwise.

-- SELECTORS :

  function Is_In ( l : List; v : Vector ) return boolean;
  function Is_In ( l : List; v : Link_to_Vector ) return boolean;

  -- DESCRIPTION :
  --   Returns true if the vector belongs to l, false otherwise.

  function Sub_List ( l1,l2 : List ) return boolean;

  -- DESCRIPTION :
  --   Returns true if all elements in l1 occur in l2, false otherwise.

-- CONSTRUCTORS :

  procedure Append ( first,last : in out List; v : in Vector );

  -- DESCRIPTION :
  --   The vector will be appended to the list first,
  --   last is a pointer to the last element of the list first.

  procedure Append_Diff ( first,last : in out List; v : in Vector );
  procedure Append_Diff ( first,last : in out List; v : in Link_to_Vector );

  -- DESCRIPTION :
  --   Only when v does not already belong to first, v will be added.

  procedure Deep_Concat    ( first,last : in out List; l : in List );
  procedure Shallow_Concat ( first,last : in out List; l : in List );

  -- DESCRIPTION :
  --   The list l will be concatenated to the list first,
  --   last is a pointer to the last element of the list first.
  --   With a deep concatenation, no pointers are shared.

  procedure Deep_Concat_Diff    ( first,last : in out List; l : in List );
  procedure Shallow_Concat_Diff ( first,last : in out List; l : in List );

  -- DESCRIPTION :
  --   Only those vectors of l will be concatenated that are not already
  --   in the list first.
  --   With a deep concatenation, no pointers are shared.

  procedure Remove ( l : in out List; x : in Vector );
  procedure Remove ( l : in out List; x : in Link_to_Vector );

  -- DESCRIPTION :
  --   Removes the point x from the list l.

  procedure Swap_to_Front ( l : in out List; x : in Vector );
  procedure Swap_to_Front ( l : in out List; x : in Link_to_Vector );

  -- DESCRIPTION :
  --   The point x belongs to the list l,
  --   Its content will be place in front of l and the first element
  --   of l will be swapped to the place of x.

-- DESTRUCTORS :

  procedure Deep_Clear    ( l : in out List );
  procedure Shallow_Clear ( l : in out List );

  -- DESCRIPTION :
  --   Frees all allocated memory space.
  --   A deep clear deallocates also the points to the integer vectors,
  --   while a shallow clear only removes the list structure.

end Generic_Lists_of_Vectors;