Eine Abstraktion für assoziative Arrays III

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

Hashes.od
TYPE
   HashValue = INTEGER;

   HashValProc =
      PROCEDURE (object: Objects.Object) : HashValue;
      (* return hash value of the key of this object *)

   HashableProc =
      PROCEDURE (object: Objects.Object) : BOOLEAN;
      (* return TRUE if hashval and equal may be invoked
         for object *)

   EqualProc =
      PROCEDURE (object1, object2: Objects.Object) : BOOLEAN;
      (* return TRUE if the keys of object1 and object2
         are identical *)

TYPE
   Hash = POINTER TO HashRec;
   HashRec = RECORD (Objects.ObjectRec) END;

PROCEDURE Create(VAR hash: Hash;
                 hashable: HashableProc;
                 hashval: HashValProc;
                 equal: EqualProc);

*Genauso wie SortedBinaryTrees.Create erhält Hashes.Create alle Prozeduren als Parameter, die von dem Typ des Schlüssels abhängen.
 

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