API Reference

Generic Package Parameter(s)

   type Key_Type is private ; 
 

procedure Put

   procedure Put(  
       This   : in out Table_Type; 
       Key    : in Key_Type; 
       Value  : out Natural ); 
 
   Table_Full        : exception; 
   Key_Already_Used  : exception; 
   Key_Not_Existing  : exception; 

Description

This method stores the key and the container element in the keyed container.

Preconditions

P.1 - Item /= null

P.2 - Number of stored keys < capacity.

P.3 - Key not already stored

Postconditions

C.1 - An additional key/value pair has been added to the

container.

Exceptions

Table_Full - P.2 violated

function Get

   function Get(  
       This : in Table_Type; 
       Key  : in Key_Type ) return Natural; 
 

Description

Retrieve a container element from the container.

Preconditions

P.1 - Key exisits in container

Postconditions

C.1 - Funtion yield handle to copy of the container element

Exceptions

Key_Not_Existing - P.1 violated

Notes

None

function Key

   function Key(  
       This : in Table_Type; 
       Hash : in Natural ) return Key_Type; 
 

Description

Get the key associated with the hash code

Preconditions

P.1 - Hash code is used

Postconditions

C.1 - The yields key

Exceptions

Key_Not_Existing - P.1 violated

Notes

None

procedure Remove

   procedure Remove(  
      This : in out Table_Type; 
      Key  : in Key_Type ); 
 

Description

Remove a key from the container

Preconditions

P.1 - Key exists in container

Postconditions

C.1 - The container_element held by the container is deallocated

Exceptions

Key_Not_Existing - P.1 violated

procedure Clear

   procedure Clear(  
       This : in out Table_Type); 
 

Description

Clear the container

Preconditions

None

Postconditions

C.1 - All objects held by the container are destroyed. The

nbr of free entries = capacity.

Exceptions

None

Notes

None

function Is_Empty

   function Is_Empty(  
      This    : in Table_Type) return Boolean; 
 

Description

Check if empty

Preconditions

None

Postconditions

C.1 - return true if nbr_of_entries = 0

Exceptions

None

function Contains

   function Contains(  
      This    : in Table_Type; 
      Key     : in Key_Type ) return Boolean; 
 

Description

check if key or a element is in the container

Preconditions

None

Postconditions

C.1 - either true or false or the key handle.

Exceptions

None

Notes

Both procedures are not optimized for speed. In case of large tables this might be a real problem for the performance of your application code.

procedure Dictionary

   procedure Dictionary(  
      This    : in  Table_Type; 
      Keys    : out Dictionary_Table; 
      Length  : out Natural );     
 
   Dictionary_Overflow : exception; 
 

Description

Returns the list of all keys in the container

Preconditions

P.1 - The number of entries in the container is not larger then

the provided dictionary table

Postconditions

C.1 - length is set to the actual number of entries in the

dictionary.

Exceptions

Dictionary_Overflow - P.1 violated.

Notes

None