class VBAG{ETP} < $VBAG{ETP} |
---|
**** | A bag with value semantics. All modifying operations return a new object, thus eliminating the possibility of aliasing problems |
$VBAG{_} | $HASH | $IS_EQ | $RO_BAG{_} | $CONTAINER{_} | $STR | $ELT{_} | $ELT |
add(e:ETP):SAME |
---|
as_array:ARRAY{ETP} .. Included as as_array |
---|
**** | Return the elements of the container as an array |
concat(arg:$ELT{ETP}):SAME .. Included as concat |
---|
**** | Returns a bag containing all the elements of self and 'arg'. For elements that occur multiple times, the result contains the sum of the number of occurences in self and 'arg'
_ result=bag of all e s.t. result.count(e)=self.count(e)+arg.count(e)>0 |
copy: SAME .. Included as copy |
---|
count(e:ETP): INT .. Included as count |
---|
**** | Return the number of occurences of element "e" |
create(arg:ARRAY{ETP}):SAME .. Included as create |
---|
**** | Create a new bag from the elements of the array 'arg' The reason for having a separate routine in this case is to permit type inference to be used so that a user may write
____a:BAG{INT}_:=_#(|1,2,3|); |
create(arg:$ELT{ETP}):SAME .. Included as create |
---|
**** | Create a new bag out of the elements of 'arg' |
create: SAME .. Included as create |
---|
delete(e:ETP):SAME |
---|
delete_all(e:ETP):SAME |
---|
elt_eq(e1,e2:ETP):BOOL .. Included as elt_eq |
---|
elt_hash(e:$OB):INT .. Included as elt_hash |
---|
elt_lt(e1,e2:ETP):BOOL .. Included as elt_lt |
---|
elt_nil:ETP .. Included as elt_nil |
---|
equals(c:$RO_BAG{ETP}):BOOL .. Included as equals |
---|
**** | Return true if self.value = c.value |
has(e:ETP): BOOL .. Included as has |
---|
hash:INT |
---|
intersection(arg: $RO_BAG{ETP}):SAME .. Included as intersection |
---|
**** | Returns a bag containing the elements common to self and 'arg' For elements that occur multiple times, the result contains the minimum number of occurrences in either self or 'arg'
_ result=bag of all e s.t. ______________result.count(e)=min(self.count(e),arg.count(e))_>_0_ |
is_elt_nil(e:ETP):BOOL .. Included as is_elt_nil |
---|
is_empty:BOOL .. Included as is_empty |
---|
**** | Return true if the size = 0. |
is_eq(a:$OB):BOOL |
---|
**** | Return true if 'self' and 'v' have the same value |
is_subset_of(arg:$RO_BAG{ETP}):BOOL .. Included as is_subset_of |
---|
**** | Returns true if 'self' is a subset of 'arg'. For elements that occur multiple times, the number of occurences of the element in 'arg' must be greater than or equal to the number of occurences in self
_ result=true iff for all e in self: count(e) <= arg.count(e) |
n_unique: INT .. Included as n_unique |
---|
**** | Return the number of unique indicies |
size:INT .. Included as size |
---|
str: STR .. Included as str |
---|
**** | Return a string representation of self |
union(arg: $RO_BAG{ETP}):SAME .. Included as union |
---|
**** | Returns a bag containing the elements of 'self' and 'arg'. For elements that occur multiple times, the result contains the maximum number of occurences in either self or 'arg' This definition permits the union of sets to be consistent with the union of bags.
_ result=bag of all e s.t. _____________result.count(e)=_max(self.count(e),arg.count(e))_>_0 |
elt!:ETP .. Included as elt! |
---|
map_key!: K .. Included as unique! |
---|
add(e:ETP) .. Included as add |
---|
map_aget(k:K): E .. Included as aget |
---|
**** | Returns the element equal to 'e' from the set. Returns void or T::nil if there is no such element. Self may not be void. |
map_aset(k:K,e:E) .. Included as aset |
---|
**** | Over-ride data if 'k' exists. Otherwise grow the bucket chain associated with hash(k) |
attr asize: INT; .. Included as asize |
---|
**** | The size of the fraction of the store which is currently in use. Array access beyond this bound is illegal. |
attr asize: INT; .. Included as asize |
---|
**** | The size of the fraction of the store which is currently in use. Array access beyond this bound is illegal. |
attr bound: INT; .. Included as bound |
---|
**** | Upper bound for split_pos. Is always initial_size * 2.pow(doubles) |
attr bound: INT; .. Included as bound |
---|
**** | Upper bound for split_pos. Is always initial_size * 2.pow(doubles) |
bucket(i:INT): BUCKET .. Included as bucket |
---|
create_sized(initial_size:INT): SAME .. Included as create_sized |
---|
**** | Creating a table with another minimal size. This might be useful to avoid shrinking of large table which might get very empty. |
data_nil: E .. Included as data_nil |
---|
dbg: STR .. Included as dbg |
---|
**** | Returns an interal string representation of the hashtable. For debugging only. |
delete(e:ETP) .. Included as delete |
---|
delete_all(e:ETP) .. Included as delete_all |
---|
**** | Delete all elements equal to "e" |
delete_and_return(e:ETP):ETP .. Included as delete_and_return |
---|
attr doubles: INT; .. Included as doubles |
---|
**** | Number of times the initial table size has been doubled. |
attr doubles: INT; .. Included as doubles |
---|
**** | Number of times the initial table size has been doubled. |
elt_eq(e1,e2:ETP):BOOL .. Included as elt_key_eq |
---|
elt_hash(e:$OB):INT .. Included as elt_key_hash |
---|
elt_nil:ETP .. Included as elt_key_nil |
---|
grow .. Included as grow |
---|
**** | Increases the size of the array by one. The functions changing the size of the bucket table: They are split into two parts. 1.) Splitting the next bucket into two. (update_*) 2.) Resizing the storage area. (shrink/grow) |
hash(e:E): INT .. Included as hash |
---|
**** | Returns the bucket to store e. This number will be generated from the hash-value and be normailzed through the actual size of the set. |
shared lower_fill_ratio: FLT := 0.800; .. Included as lower_fill_ratio |
---|
shared lower_fill_ratio: FLT := 0.800; .. Included as lower_fill_ratio |
---|
map_copy: SAME .. Included as map_copy |
---|
**** | Returns a copy of self with all properties set like self. |
map_delete(k:K): E .. Included as map_delete |
---|
**** | Removes an element from the set. Does nothing if there is no such element. |
map_elt!: E .. Included as map_elt! |
---|
map_has_ind(k:K): BOOL .. Included as map_has_ind |
---|
map_pair!: TUP{K,E} .. Included as map_pair! |
---|
attr minsize: INT; .. Included as minsize |
---|
**** | Lower bound for the store size. |
attr minsize: INT; .. Included as minsize |
---|
**** | Lower bound for the store size. |
attr n_inds: INT; .. Included as n_inds |
---|
**** | Returns the number of elements (resp. indices) in the table. |
attr n_inds: INT; .. Included as n_inds |
---|
**** | Returns the number of elements (resp. indices) in the table. |
create: SAME .. Included as old_create |
---|
set_bucket(i:INT,l:BUCKET) .. Included as set_bucket |
---|
shrink .. Included as shrink |
---|
**** | Decreases the size of the array by one. Resizes the storage area, if neccessary. If the size in use = minsize, do nothing. If the size in use is half the array size then shrink the array |
attr split_pos: INT; .. Included as split_pos |
---|
**** | Position of the next bucket to split. |
attr split_pos: INT; .. Included as split_pos |
---|
**** | Position of the next bucket to split. |
attr store: AREF{BUCKET}; .. Included as store |
---|
**** | Here is the data being stored. |
attr store: AREF{BUCKET}; .. Included as store |
---|
**** | Here is the data being stored. |
attr total_size: INT; .. Included as total_size |
---|
attr total_size: INT; .. Included as total_size |
---|
update_delete .. Included as update_delete |
---|
**** | Checks the actual fill ratio of the set. Removes a bucket from the hash table if the ratio is low enough. |
update_insert .. Included as update_insert |
---|
**** | Checks the actual fill ratio of the set. Adds a bucket to the hash table if the ratio is high enough. The functions changing the size of the bucket table are split into two parts. 1.) Splitting the next bucket into two. (update_*) 2.) Resizing the storage area. (shrink/grow) |
shared upper_fill_ratio: FLT := 1.000; .. Included as upper_fill_ratio |
---|
**** | For fast access one needs a low ratio between number of elements in the and number of cells. For efficient memory usage one needs a high ratio. The ratio should always be between these two bounds (unless the table is really small; where the ratio can get even lower.) |
shared upper_fill_ratio: FLT := 1.000; .. Included as upper_fill_ratio |
---|
**** | For fast access one needs a low ratio between number of elements in the and number of cells. For efficient memory usage one needs a high ratio. The ratio should always be between these two bounds (unless the table is really small; where the ratio can get even lower.) |