Die Adreßdatenbank II

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]

AddressManager.om
TYPE
   Database =
      RECORD
         hashByName, hashByPhone, hashByEmail: Hashes.Hash;
         (* names act as primary keys (i.e. we expect them
            to be unique) but we support phone numbers
            and email addresses as secondary indices as well;
            if secondary keys are not unique we just keep a
            reference to the first object we have seen with
            that key
         *)
      END;

PROCEDURE CreateDB(VAR db: Database);
   (* create the three hashes associated with db *)
BEGIN
   Hashes.Create(db.hashByName, Addresses.Hashable,
      Addresses.HashByName, Addresses.EqualByName);
   Hashes.Create(db.hashByPhone, Addresses.Hashable,
      Addresses.HashByPhone, Addresses.EqualByPhone);
   Hashes.Create(db.hashByEmail, Addresses.Hashable,
      Addresses.HashByEmail, Addresses.EqualByEmail);
END CreateDB;

*Für den primären und für die beiden sekundären Schlüssel wird je ein assoziatives Array unterhalten.
 

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]
Copyright © 1999 Andreas Borchert, in HTML konvertiert am 29.06.1999