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

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

1.1       maekawa     1: package Symbol_Table is
                      2:
                      3: -- DESCRIPTION :
                      4: --   This package provides management of a table of symbols, useful
                      5: --   in the input/output of polynomials in several variables.
                      6:
                      7: -- AUXILIARY DATA STRUCTURES :
                      8:
                      9:   subtype Symbol is string(1..5);
                     10:
                     11: -- EXCEPTIONS :
                     12:
                     13:     OVERFLOW_IN_THE_SYMBOL_TABLE : exception;
                     14:      -- occurs when a new symbol is added to a full symbol table
                     15:
                     16:     INDEX_OUT_OF_RANGE : exception;
                     17:      -- occurs when a symbol is asked that is not in the range of the table
                     18:
                     19: -- CREATORS :
                     20:
                     21:   procedure Init ( max : in natural );
                     22:
                     23:   -- DESCRIPTION :
                     24:   --   A new symbol table is created with place for max symbols.
                     25:
                     26:   procedure Enlarge ( max : in natural );
                     27:
                     28:   -- DESCRIPTION :
                     29:   --   Enlarges the symbol table so that it can contain as many symbols
                     30:   --   as the previous maximum plus the new max.
                     31:
                     32:   procedure Replace ( i : in natural; sb : in Symbol );
                     33:
                     34:   -- DESCRIPTION :
                     35:   --   Replaces the ith symbol by the given sb.
                     36:
                     37: -- CONSTRUCTORS :
                     38:
                     39:   procedure Add ( sb : in Symbol );
                     40:   procedure Add ( sb : in Symbol; pos : out natural );
                     41:
                     42:   -- DESCRIPTION :
                     43:   --   A new symbol is added to the symbol table;
                     44:   --   pos is the entry of the added symbol in the table.
                     45:
                     46:   procedure Remove ( sb : in Symbol );
                     47:   procedure Remove ( i : in natural );
                     48:
                     49:   -- DESCRIPTION :
                     50:   --   Removes the ith symbol sb from the symbol table.
                     51:
                     52: -- SELECTORS :
                     53:
                     54:   function "<" ( s1,s2 : Symbol ) return boolean;
                     55:   function ">" ( s1,s2 : Symbol ) return boolean;
                     56:
                     57:   -- DESCRIPTION :
                     58:   --   Defines an order relation on the symbols.
                     59:
                     60:   function Maximal_Size return natural;
                     61:
                     62:   -- DESCRIPTION :
                     63:   --   Returns the maximal number of symbols the table can contain.
                     64:
                     65:   function Number return natural;
                     66:
                     67:   -- DESCRIPTION :
                     68:   --   Returns the number of current symbols in the table.
                     69:
                     70:   function Empty return boolean;
                     71:
                     72:   -- DESCRIPTION :
                     73:   --   Returns true if the symbol table has not been initialized yet,
                     74:   --   or if a Clear has been done.
                     75:
                     76:   function Get ( sb : Symbol ) return natural;
                     77:
                     78:   -- DESCRIPTION :
                     79:   --  The entry of the symbol in the table is returned.
                     80:   --  If the symbol does not occur in the table, then 0 is returned.
                     81:
                     82:   function Get ( i : natural ) return Symbol;
                     83:
                     84:   -- DESCRIPTION :
                     85:   --   The symbol corresponding with the ith unknown is returned.
                     86:
                     87: -- DESTRUCTOR :
                     88:
                     89:   procedure Clear;
                     90:
                     91:   -- DESCRIPTION :
                     92:   --   The allocated memory space is freed.
                     93:
                     94: end Symbol_Table;

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