with Employees;
package Tables is
------------------------------------------------------------------
--| ADT for simple employee table type
--| Author: Michael B. Feldman, The George Washington University 
--| Last Modified: October 1995                                     
------------------------------------------------------------------

  subtype KeyType is Employees.IDType; 
  subtype ElementType is Employees.Employee;

  type TableType is limited private;

  procedure InitializeTable (T : in out TableType);
  -- Pre : None
  -- Post: T is an initialized Table.
     
  procedure Insert (T       : in out TableType; 
                    E       : ElementType;
                    Success : out Boolean);
  --  Pre : T is initialized and Target is defined
  --  Post: Inserts element E into table T 
  --    Success is True if insertion is performed, and False
  --    if T already has an element with the same key as E.
     
  procedure Retrieve (T       : TableType;
                      Target  : KeyType;
                      E       : out ElementType;
                      Success : out Boolean);
  --  Pre : T is initialized and Target is defined
  --  Post: Copies into E the element of T whose key is Target. 
  --    Success is True if the copy is performed, and False
  --    if T has no element whose key is Target.
     
  procedure Delete (T       : in out TableType; 
                    Target  : KeyType;
                    Success : out Boolean);
  --  Pre : T is initialized and Target is defined
  --  Post: Deletes from T the element with key Target
  --    Success is True if deletion is performed, and False 
  --    if T has no element whose key is Target.

  procedure Traverse (T : TableType);
  --  Pre : T is initialized.
  --  Post: The elements of T are displayed in order by key.

private

  MaxElements: constant Positive := 25;

  subtype TableIndex is Natural range 1..MaxElements;
  subtype TableRange is Natural range 0..MaxElements;  
  type Elements is array(TableIndex) of ElementType;
  
  type TableType is record
    ActualElements: Elements;
    CurrentSize:    TableRange := 0;
  end record;

end Tables;