[BACK]Return to partitions_of_sets_of_unknowns.ads CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Product

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Product/partitions_of_sets_of_unknowns.ads, Revision 1.1.1.1

1.1       maekawa     1: with Sets_of_Unknowns;                   use Sets_of_Unknowns;
                      2:
                      3: package Partitions_of_Sets_of_Unknowns is
                      4:
                      5: -- DESCRIPTION :
                      6: --   This package provides a data abstraction for enumerating all
                      7: --   partitions of a given set of unknowns.
                      8:
                      9:   type partition is array ( positive range <> ) of Set;
                     10:
                     11: -- CREATORS :
                     12:
                     13:   procedure Create ( p : in out Partition; n : in natural );
                     14:
                     15:   -- DESCRIPTION :
                     16:   --   Creates all sets in the partition, to be ready to contain
                     17:   --   at most n unknowns.
                     18:
                     19:   function Create ( p : Partition ) return Partition;
                     20:
                     21:   -- DESCRIPTION :
                     22:   --   Returns a new partition which is an exact copy of the given one.
                     23:
                     24: -- CONSTRUCTORS :
                     25:
                     26:   generic
                     27:     with procedure Process ( p : in Partition; continue : out boolean );
                     28:   procedure Generate_Partitions ( s : in Set );
                     29:
                     30:   -- DESCRIPTION :
                     31:   --   Generates all partitions of a given set of unknowns.
                     32:   --   The procedure Process is invoked each time a new partition is
                     33:   --   generated.  The generation can be stopped by setting
                     34:   --   continue to false.  Otherwise, when continue is set to true,
                     35:   --   the generation continues.
                     36:
                     37:   -- NOTE :
                     38:   --   While processing the partition, it might be needed to copy
                     39:   --   the resulting partition, as sharing occurs.
                     40:
                     41: -- SELECTOR :
                     42:
                     43:   function Number_of_Partitions ( n : natural ) return natural;
                     44:
                     45:   -- DESCRIPTION :
                     46:   --   Returns the number of partitions of a set of n unknowns.
                     47:
                     48: -- DESTRUCTOR :
                     49:
                     50:   procedure Clear ( p : in out Partition );
                     51:
                     52:   -- DESCRIPTION :
                     53:   --   Deallocates the occupied memory.
                     54:
                     55: end Partitions_of_Sets_of_Unknowns;

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