[BACK]Return to 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/sets_of_unknowns.ads, Revision 1.1

1.1     ! maekawa     1: package Sets_of_Unknowns is
        !             2:
        !             3: -- DESCRIPTION :
        !             4: --   This package provides a data abstraction for dealing with
        !             5: --   sets with a limited number of unknowns.
        !             6:
        !             7:   type Set is private;
        !             8:
        !             9: -- CREATORS :
        !            10:
        !            11:   function Create ( n : natural ) return Set;
        !            12:
        !            13:   -- DESCRIPTION :
        !            14:   --   Creates a set which can contain n unknowns.
        !            15:   --   After this operation Dimension(s) = n.
        !            16:
        !            17:   function Create ( s : Set ) return Set;
        !            18:
        !            19:   -- DESCRIPTION :
        !            20:   --   Returns a new set with the same contents as the given one.
        !            21:   --   Note that s1 := s2 does only create a new name of the same set,
        !            22:   --   but does not create a new set.
        !            23:
        !            24: -- CONSTRUCTORS :
        !            25:
        !            26:   procedure Add ( s : in out Set; i : in natural );
        !            27:
        !            28:   -- DESCRIPTION :
        !            29:   --   Adds the ith unknown to the set.
        !            30:   --   The set must be created and 1 <= i <= Dimension(s).
        !            31:
        !            32:   procedure Union ( s1 : in out Set; s2 : in Set );
        !            33:   function  Union ( s1,s2 : Set ) return Set;
        !            34:
        !            35:   -- DESCRIPTION :
        !            36:   --   Constructs the union of two sets of equal dimension.
        !            37:   --   Either the result will be contained in s1, or a new set
        !            38:   --   will be constructed.
        !            39:
        !            40:   procedure Remove ( s : in out Set; i : in natural );
        !            41:
        !            42:   -- DESCRIPTION :
        !            43:   --   Removes the ith unknown from the set.
        !            44:   --   The set must be created and 1 <= i <= Dimension(s);
        !            45:
        !            46:   procedure Difference ( s1 : in out Set; s2 : in Set );
        !            47:   function  Difference ( s1,s2 : Set ) return Set;
        !            48:
        !            49:   -- DESCRIPTION :
        !            50:   --   Constructs the difference s1\s2 of two sets of equal dimension.
        !            51:   --   Either the result will be contained in s1, or a new set
        !            52:   --   will be constructed.
        !            53:
        !            54:   procedure Intersection ( s1 : in out Set; s2 : in Set );
        !            55:   function  Intersection ( s1,s2 : Set ) return Set;
        !            56:
        !            57:   -- DESCRIPTION :
        !            58:   --   Construct the intersection of two sets of equal dimension.
        !            59:   --   Either the result will be contained in s1, or a new set
        !            60:   --   will be constructed.
        !            61:
        !            62: -- SELECTORS :
        !            63:
        !            64:   function Dimension ( s : Set ) return natural;
        !            65:
        !            66:   -- DESCRIPTION :
        !            67:   --   Returns the number of unknowns the set can contain.
        !            68:   --   For an empty set, Dimension(s) = 0.
        !            69:
        !            70:   function Extent_Of ( s : Set ) return natural;
        !            71:
        !            72:   -- DESCRIPTION :
        !            73:   --   Returns the number of unknowns the set contains.
        !            74:
        !            75:   function Is_In ( s : Set; i : natural ) return boolean;
        !            76:
        !            77:   -- DESCRIPTION :
        !            78:   --   Returns true if the ith unknown belongs to the set.
        !            79:
        !            80:   function Is_Subset ( s1,s2 : Set ) return boolean;
        !            81:
        !            82:   -- DESCRIPTION :
        !            83:   --   Returns true when the set s1 is a subset of s2.
        !            84:
        !            85:   function Is_Equal ( s1,s2 : Set ) return boolean;
        !            86:
        !            87:   -- DESCRIPTION :
        !            88:   --   Returns true when the two sets have the same dimension
        !            89:   --   and the same elements.
        !            90:
        !            91:   generic
        !            92:     with procedure Process ( sub : in Set; continue : out boolean );
        !            93:   procedure Generate_Subsets ( s : in Set; k : in positive );
        !            94:
        !            95:   -- DESCRIPTION :
        !            96:   --   Generates all proper subsets with k elements of the set s.
        !            97:   --   Each time a new subset is found, Process is called, with the
        !            98:   --   subset as input parameter.  When the output parameter continue
        !            99:   --   is set to false, the iteration stops.  Otherwise it continues.
        !           100:
        !           101:   -- NOTE :
        !           102:   --   The same subset will be used over and over.  If necessary,
        !           103:   --   copies should be taken when processing the subset.
        !           104:
        !           105:   generic
        !           106:     with procedure Process ( sub : in Set; continue : out boolean );
        !           107:   procedure Generate_All_Subsets ( s : in Set );
        !           108:
        !           109:   -- DESCRIPTION :
        !           110:   --   Generates all nonempty subsets of the set s, the set s included.
        !           111:   --   As above, the procedure Process allows the processing of a subset.
        !           112:
        !           113: -- DESTRUCTOR :
        !           114:
        !           115:   procedure Clear ( s : in out Set );
        !           116:
        !           117:   -- DESCRIPTION :
        !           118:   --   Frees all occupied memory of the given set.
        !           119:   --   After Clear(s), Dimension(s) = 0.
        !           120:
        !           121: private
        !           122:
        !           123:   type Set_Rep;
        !           124:   type Set is access Set_Rep;
        !           125:
        !           126: end Sets_of_Unknowns;

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