| class FMULTIMAP{KTP,ETP} < $STR |
|---|
| **** | A mapping from elements of type K to lists of elements of type T Unlike FMAP, this class is NOT meant to be used when void and must be created initially.
_ Implementation: Most of the primitive FMAP routines have been made private and renamed with a multi_ prefix. We do permit one operation that violates the interface, danger_multi_get which returns the actual flist associated with a particular key (not a copy of the flist). This list must *not* be modified and may well become invalid when other operations are performed upon the multi-map |
| $STR | FMAP{_,_} | AREF{_} | COMPARE{_} |
| clear:SAME .. Included as clear |
|---|
| **** | Clear out self, return the space if it has 17 or less entries otherwise return void. Self may be void. |
| copy: SAME |
|---|
| create: SAME |
|---|
| **** | Create must be called before use |
| get(k:K):T .. Included as danger_multi_get |
|---|
| **** | If `k' is a key, return the corresponding target, otherwise return void. Self may be void. |
| delete(k: KTP, t: ETP): SAME |
|---|
| **** | Delete an element "t" from the elements associated with k Do nothing if the target does not exist for "k" |
| delete_all(k: KTP): SAME |
|---|
| **** | Delete all elements associated with element "k" |
| equals(b: $RO_MULTIMAP{KTP,ETP}): BOOL |
|---|
| **** | Returns true if all of "e"'s elements are equal to self's elts Ordering is an issue. Should be redefined to be more precise for particular descendants |
| get_all(k: KTP): FLIST{ETP} |
|---|
| **** | Return a copy of internal list associated with element "k" |
| has_ind(k: K): BOOL .. Included as has_ind |
|---|
| has_pair(k:KTP,t:ETP): BOOL |
|---|
| insert(k: KTP, t: ETP): SAME |
|---|
| **** | Insert a new element "t" associated with "k" |
| insert_pair(p: TUP{KTP,ETP}): SAME |
|---|
| is_empty:BOOL .. Included as is_empty |
|---|
| **** | True if the set is empty. Self may be void. |
| n_inds: INT is .. Included as n_inds |
|---|
| n_targets(k: KTP): INT |
|---|
| **** | Return the number of targets for the key "k" |
| n_targets: INT |
|---|
| **** | Return the total number of targets |
| size: INT |
|---|
| **** | Alias for n_targets to satisfy "CONTAINER{KTP}" |
| str: STR |
|---|
| **** | Prints out a string version of the array of the components that are under $STR, and their associated indices |
| elt!: ETP |
|---|
| ind!: K .. Included as ind! |
|---|
| pair!: TUP{KTP, ETP} |
|---|
| **** | Yields pairs of keys and elements - keys may repeat |
| target!(once k: KTP): ETP |
|---|
| **** | Return the elements associated with k |
| target!: ETP |
|---|
| **** | Return all the targets in the current multi-map |
| aclear .. Included as aclear |
|---|
| **** | Set each element of self to nil. Built-in. |
| acopy(src:SAME) .. Included as acopy |
|---|
| **** | Copy as many elements from `src' to self as will fit. Built-in. |
| acopy(beg:INT, src:SAME) .. Included as acopy |
|---|
| **** | Copy as many elements from `src' to self as will fit when starting at index `beg' of self. |
| acopy(beg,num:INT, src:SAME) .. Included as acopy |
|---|
| **** | Copy `num' elements from `src' to self starting at index `beg' of self. |
| acopy(beg,num,srcbeg:INT, src:SAME) .. Included as acopy |
|---|
| **** | Copy `num' elements from `src' to self starting at index `beg' of self and index `srcbeg' of `src'. Built-in. |
| aelt!(once beg:INT):T .. Included as aelt! |
|---|
| **** | Yield each element of self starting at `beg'. Built-in. |
| aelt!(once beg,once num:INT):T .. Included as aelt! |
|---|
| **** | Yield `num' successive elements of self starting at index `beg'. Built-in. |
| aelt!(once beg,once num,once step:INT):T .. Included as aelt! |
|---|
| **** | Yield `num' elements of self starting at `beg' and stepping by `step' which must not be zero. Built-in. |
| aelt!:T .. Included as aelt! |
|---|
| **** | Yield each element of self in order. Built-in. |
| aget(ind:INT):T .. Included as aget |
|---|
| **** | The element of self with index `ind'. Built-in. |
| aind!:INT .. Included as aind! |
|---|
| **** | Yield the indices of self in order. |
| allocate(n:INT):SAME .. Included as allocate |
|---|
| **** | Allocate `n' locations (must be power of 2 plus 1) and initialize to `(elt_nil,void)'. |
| array_ptr:C_PTR .. Included as array_ptr |
|---|
| aset!(val:T) .. Included as aset! |
|---|
| **** | Set successive elements of self to the values `val'. Built-in. |
| aset!(once beg:INT,val:T) .. Included as aset! |
|---|
| **** | Set successive elements of self starting at `beg' to the values `val'. |
| aset!(once beg,once num:INT,val:T) .. Included as aset! |
|---|
| **** | Set `num' successive elements of self starting at `beg' to the values `val'. |
| aset!(once beg,once num,once step:INT, val:T) .. Included as aset! |
|---|
| **** | Set `num' elements of self starting at `beg' stepping by `step' to the values `val'. `step' must not be zero. |
| aset(ind:INT, val:T) .. Included as aset |
|---|
| **** | Set the element of self with index `ind' to `val'. Built-in. |
| asize:INT .. Included as asize |
|---|
| **** | The number of elements in self. Classes which inherit this may replace this by a constant to get constant sized objects (and the compiler may optimize certain operations in this case). Built-in. |
| double_size:SAME |
|---|
| **** | A new table of twice the size of self with self's entries copied over. |
| elt_eq(e1,e2:ETP):BOOL .. Included as elt_eq |
|---|
| **** | The "less than" relation used in the sorting routines. Compares the object "id" by default. May be redefined in descendants. |
| elt_hash(e:ETP):INT .. Included as elt_hash |
|---|
| **** | A hash value associated with an element. Must have the property that if "elt_eq(e1,e2)" then "elt_hash(e1)=elt_hash(e2)". Can be defined to always return 0, but many routines will then become quadratic. Uses object "id" by default. May be redefined in descendants. |
| elt_lt(e1,e2:ETP):BOOL .. Included as elt_lt |
|---|
| **** | The "less than" relation used in the sorting routines. Compares the object "id" by default. May be redefined in descendants. |
| elt_nil: ETP .. Included as elt_nil |
|---|
| **** | Return the nil value. If the element is under $NIL then return e.nil. Otherwise, return void
_ |
| elt_str(e: ETP): STR |
|---|
| get_pair(k:K):TUP{K,T} .. Included as get_pair |
|---|
| **** | If `k' is a key, return the corresponding key/target pair. Otherwise return #(key_nil,void). Useful when different objects are treated as equal by `key_eq'. Self may be void. |
| halve_size:SAME |
|---|
| **** | A new table of half the size of self with self's entries copied over. |
| has(e:T):BOOL .. Included as has |
|---|
| **** | True if the self has an element which is `elt_eq' to `e'. |
| attr hsize:INT; .. Included as hsize |
|---|
| **** | Number of stored entries. |
| attr hsize:INT; .. Included as hsize |
|---|
| **** | Number of stored entries. |
| ind_str(i: KTP): STR |
|---|
| const initially_provide_for: INT := 1; |
|---|
| is_elt_nil(e:ETP):BOOL .. Included as is_elt_nil |
|---|
| is_elt_nil(e:ETP):BOOL .. Included as is_key_nil |
|---|
| is_legal_aelts_arg( beg, num, step:INT) :BOOL .. Included as is_legal_aelts_arg |
|---|
| **** | True if the arguments are legal values for `aelts'. |
| elt_eq(e1,e2:ETP):BOOL .. Included as key_eq |
|---|
| **** | The "less than" relation used in the sorting routines. Compares the object "id" by default. May be redefined in descendants. |
| elt_hash(e:ETP):INT .. Included as key_hash |
|---|
| **** | A hash value associated with an element. Must have the property that if "elt_eq(e1,e2)" then "elt_hash(e1)=elt_hash(e2)". Can be defined to always return 0, but many routines will then become quadratic. Uses object "id" by default. May be redefined in descendants. |
| elt_nil: ETP .. Included as key_nil |
|---|
| **** | Return the nil value. If the element is under $NIL then return e.nil. Otherwise, return void
_ |
| keys!:K .. Included as keys! |
|---|
| **** | Yield the keys in self in an arbitrary order. Do not insert or delete from self while calling this. Self may be void. |
| const load_ratio:INT:=4; .. Included as load_ratio |
|---|
| **** | Allow to get at most 1/load_ratio full. |
| delete(k:K):SAME .. Included as multi_delete |
|---|
| **** | A possibly new table which deletes the element with key `k' if it is contained in self. Usage: `tbl:=tbl.delete(k)'. Self may be void. |
| insert(k:K,t:T):SAME .. Included as multi_insert |
|---|
| **** | A possibly new table which includes the key/target pair `k', `t'. If `k' is already present, replaces the current key and target with `k,t'. Usage: `tbl:=tbl.insert(k,t)'. Creates a new table if void(self). |
| multi_insert_pair(p:TUP{KTP,FLIST{ETP}}):SAME |
|---|
| pair!:TUP{K,T} .. Included as multi_pair! |
|---|
| target!:T .. Included as multi_target! |
|---|
| not_too_many(start, finish:INT):BOOL .. Included as not_too_many |
|---|
| **** | A function called in an assert to check that really bad hashing isn't happening, which would probably be a performance bug. Since it is in an assert, this isn't called unless checking is on. |
| create(n:INT):SAME .. Included as old_create |
|---|
| **** | Make a table capable of dealing with `n' elements without expansion. You can simply insert into a void table to create one as well. Self may be void (and usually is). |
| create:SAME .. Included as old_create |
|---|
| pairs!:TUP{K,T} .. Included as pairs! |
|---|
| **** | Yield the input/output pairs of self in an arbitrary order. Do not insert or delete from self while calling this. Self may be void. |
| should_grow:BOOL .. Included as should_grow |
|---|
| should_shrink:BOOL .. Included as should_shrink |
|---|
| targets!:T .. Included as targets! |
|---|
| **** | Yield the target objects contained in self in an arbitrary order. Do not insert or delete from self while calling this. Self may be void. |
| test(k:K):BOOL .. Included as test |
|---|
| **** | True if the key `k' is mapped by self. Self may be void. |
| attr total_n_targets: INT; |
|---|
| attr total_n_targets: INT; |
|---|