-- filename hashtabl.ads 2:39PM 10/11/95 -- this generic HashTable package takes: -- the Key and Contents types (as private) -- the NumberOfBuckets to use -- a hash function that maps a key to a bucket# -- and Put procedures for the Key and Contents types -- and defines a type Table, indexed by type Key and storing items of type -- Contents. with list; generic type Key is private; type Contents is private; NumberOfBuckets: Positive; with function Hash(S:Key) return Positive; with procedure putkey(S:key); with procedure putcontents(V:Contents); package HashTable is type Table is private; procedure put(T:in Table); procedure Clear(T: in out Table); procedure AddEntry(S: in Key; V: in Contents; T: in out Table); procedure ChangeEntry(S:in Key; V: in Contents; T:in out Table); function Retrieve(S:in Key; T:in Table) return Contents; function IsBound(S: in Key; T:in Table) return Boolean; function IsEmpty(T: in Table) return Boolean; function Size(T: in Table) return Natural; multiple_binding, entry_not_found, Table_overflow : exception; private type binding is record index: key; value: contents; end record; procedure Put(B: in Binding); package bindlist is new list(binding); type Bucket is new bindlist.pointer; type tabarray is array (Positive range 1..NumberOfBuckets) of Bucket; type Table is access tabarray; end HashTable;