PROCEDURE Delete(db: Database; address: Addresses.Address);
(* delete address from db.hashByName and
the other two hashes if present
*)
VAR
otherAddress: Addresses.Address;
BEGIN
Hashes.Delete(db.hashByName, address);
IF (address.phone # "") &
Hashes.Lookup(db.hashByPhone,
address, otherAddress) &
(address = otherAddress) THEN
Hashes.Delete(db.hashByPhone, address);
END;
IF (address.email # "") &
Hashes.Lookup(db.hashByEmail,
address, otherAddress) &
(address = otherAddress) THEN
Hashes.Delete(db.hashByEmail, address);
END;
END Delete;
|