Implementierung assoziativer Arrays IV

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

Hashes.om
PROCEDURE Create(VAR hash: Hash;
                 hashable: HashableProc;
                 hashval: HashValProc;
                 equal: EqualProc);
BEGIN
   NEW(hash);
   hash.hashable := hashable; hash.hashval := hashval;
   hash.equal := equal;
   hash.nextval := tabsize + 1; hash.nextentry := NIL;
END Create;

PROCEDURE Hashable(hash: Hash;
                   object: Objects.Object) : BOOLEAN;
   (* return TRUE if the key of object is compatible
      to those of hash
   *)
BEGIN
   RETURN hash.hashable(object)
END Hashable;

PROCEDURE Acceptable(hash: Hash;
                     object: Objects.Object) : BOOLEAN;
   (* return TRUE if the key of object is hashable and
      not yet present in hash
   *)
   VAR
      hashval: HashValue;
      entry, predecessor: Entry;
BEGIN
   RETURN ~Find(hash, object, hashval, entry, predecessor)
END Acceptable;

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