![]() ![]() | ![]() |
File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Polynomials / symbol_table.ads (download)
Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:27 2000 UTC (23 years, 10 months ago) by maekawa
Import the second public release of PHCpack. OKed by Jan Verschelde. |
package Symbol_Table is -- DESCRIPTION : -- This package provides management of a table of symbols, useful -- in the input/output of polynomials in several variables. -- AUXILIARY DATA STRUCTURES : subtype Symbol is string(1..5); -- EXCEPTIONS : OVERFLOW_IN_THE_SYMBOL_TABLE : exception; -- occurs when a new symbol is added to a full symbol table INDEX_OUT_OF_RANGE : exception; -- occurs when a symbol is asked that is not in the range of the table -- CREATORS : procedure Init ( max : in natural ); -- DESCRIPTION : -- A new symbol table is created with place for max symbols. procedure Enlarge ( max : in natural ); -- DESCRIPTION : -- Enlarges the symbol table so that it can contain as many symbols -- as the previous maximum plus the new max. procedure Replace ( i : in natural; sb : in Symbol ); -- DESCRIPTION : -- Replaces the ith symbol by the given sb. -- CONSTRUCTORS : procedure Add ( sb : in Symbol ); procedure Add ( sb : in Symbol; pos : out natural ); -- DESCRIPTION : -- A new symbol is added to the symbol table; -- pos is the entry of the added symbol in the table. procedure Remove ( sb : in Symbol ); procedure Remove ( i : in natural ); -- DESCRIPTION : -- Removes the ith symbol sb from the symbol table. -- SELECTORS : function "<" ( s1,s2 : Symbol ) return boolean; function ">" ( s1,s2 : Symbol ) return boolean; -- DESCRIPTION : -- Defines an order relation on the symbols. function Maximal_Size return natural; -- DESCRIPTION : -- Returns the maximal number of symbols the table can contain. function Number return natural; -- DESCRIPTION : -- Returns the number of current symbols in the table. function Empty return boolean; -- DESCRIPTION : -- Returns true if the symbol table has not been initialized yet, -- or if a Clear has been done. function Get ( sb : Symbol ) return natural; -- DESCRIPTION : -- The entry of the symbol in the table is returned. -- If the symbol does not occur in the table, then 0 is returned. function Get ( i : natural ) return Symbol; -- DESCRIPTION : -- The symbol corresponding with the ith unknown is returned. -- DESTRUCTOR : procedure Clear; -- DESCRIPTION : -- The allocated memory space is freed. end Symbol_Table;