Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /smlnj-lib/trunk/Util/mono-hash2-table-sig.sml
ViewVC logotype

Annotation of /smlnj-lib/trunk/Util/mono-hash2-table-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9 - (view) (download)
Original Path: sml/trunk/src/smlnj-lib/Util/mono-hash2-table-sig.sml

1 : monnier 2 (* mono-hash2-table-sig.sml
2 :     *
3 :     * COPYRIGHT (c) 1996 by AT&T Research.
4 :     *
5 :     * Hash tables that are keyed by two keys (in different domains).
6 :     *
7 :     * AUTHOR: John Reppy
8 :     * AT&T Bell Laboratories
9 :     * Murray Hill, NJ 07974
10 :     * jhr@research.att.com
11 :     *)
12 :    
13 :     signature MONO_HASH2_TABLE =
14 :     sig
15 :    
16 :     structure Key1 : HASH_KEY
17 :     structure Key2 : HASH_KEY
18 :    
19 :     type 'a hash_table
20 :    
21 :     val mkTable : (int * exn) -> 'a hash_table
22 :     (* Create a new table; the int is a size hint and the exception
23 :     * is to be raised by find.
24 :     *)
25 :    
26 : monnier 8 val clear : 'a hash_table -> unit
27 :     (* remove all elements from the table *)
28 :    
29 : monnier 2 val insert : 'a hash_table -> (Key1.hash_key * Key2.hash_key * 'a) -> unit
30 :     (* Insert an item. If the key already has an item associated with it,
31 :     * then the old item is discarded.
32 :     *)
33 :    
34 :     val lookup1 : 'a hash_table -> Key1.hash_key -> 'a
35 :     val lookup2 : 'a hash_table -> Key2.hash_key -> 'a
36 :     (* Find an item, the table's exception is raised if the item doesn't exist *)
37 :    
38 :     val find1 : 'a hash_table -> Key1.hash_key -> 'a option
39 :     val find2 : 'a hash_table -> Key2.hash_key -> 'a option
40 :     (* Look for an item, return NONE if the item doesn't exist *)
41 :    
42 :     val remove1 : 'a hash_table -> Key1.hash_key -> 'a
43 :     val remove2 : 'a hash_table -> Key2.hash_key -> 'a
44 :     (* Remove an item, returning the item. The table's exception is raised if
45 :     * the item doesn't exist.
46 :     *)
47 :    
48 :     val numItems : 'a hash_table -> int
49 :     (* Return the number of items in the table *)
50 :    
51 :     val listItems : 'a hash_table -> 'a list
52 :     val listItemsi : 'a hash_table -> (Key1.hash_key * Key2.hash_key * 'a) list
53 :     (* Return a list of the items (and their keys) in the table *)
54 :    
55 :     val app : ('a -> unit) -> 'a hash_table -> unit
56 :     val appi : ((Key1.hash_key * Key2.hash_key * 'a) -> unit) -> 'a hash_table
57 :     -> unit
58 :     (* Apply a function to the entries of the table *)
59 :    
60 :     val map : ('a -> 'b) -> 'a hash_table -> 'b hash_table
61 :     val mapi : ((Key1.hash_key * Key2.hash_key * 'a) -> 'b) -> 'a hash_table
62 :     -> 'b hash_table
63 :     (* Map a table to a new table that has the same keys *)
64 :    
65 :     val fold : (('a * 'b) -> 'b) -> 'b -> 'a hash_table -> 'b
66 :     val foldi : ((Key1.hash_key * Key2.hash_key * 'a * 'b) -> 'b) -> 'b
67 :     -> 'a hash_table -> 'b
68 :    
69 :     (** Also mapPartial?? *)
70 :     val filter : ('a -> bool) -> 'a hash_table -> unit
71 :     val filteri : ((Key1.hash_key * Key2.hash_key * 'a) -> bool) -> 'a hash_table
72 :     -> unit
73 :     (* remove any hash table items that do not satisfy the given
74 :     * predicate.
75 :     *)
76 :    
77 :     val copy : 'a hash_table -> 'a hash_table
78 :     (* Create a copy of a hash table *)
79 :    
80 :     val bucketSizes : 'a hash_table -> (int list * int list)
81 :     (* returns a list of the sizes of the various buckets. This is to
82 :     * allow users to gauge the quality of their hashing function.
83 :     *)
84 :    
85 :     end (* MONO_HASH2_TABLE *)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0