abstract class $RO_MULTIMAP{ITP,TTP} < $RO_BAG{TUP{ITP,TTP}} |
---|
**** | An unordered container of tuples of {index:ITP,target:TTP}. It may be viewed as a mapping from indices of type ITP to targets fo type TTP, where each index may have multiple targets It is essentially a one-to-many mapping, that allows for repetitions.
_ Definition: A multimap is simply a bag of tuples. It imposes no additional constraints, but does provide some extra accessing mechanisms _ This is a read-only abstraction in which no modifying operations are available. However, subtypes may provide modifying operations For documentation see: ____The_overall_organization_of_container_classes ____The_organization_and_usage_of_multimaps_and_related_classes _ In the comments that follow, underscores are used to indicate a value that takes on all possible bindings. |
$RO_BAG{_} | $CONTAINER{_} | $STR | $ELT{_} | $ELT |
$RO_MAP{_,_} | $VMAP{_,_} | VMAP{_,_} | $MAP{_,_} | MAP{_,_} | $VMULTIMAP{_,_} | VMULTIMAP{_,_} |
add(k:ITP,e:TTP):$RO_MULTIMAP{ITP,TTP}; |
---|
**** | Shortcut for for add(#TUP{ITP,TTP}(k,e)) |
add(e:TUP{ITP,TTP}):$RO_MULTIMAP{ITP,TTP}; |
---|
**** | Result is a new multimap containing all the elements of self and 'e' |
as_array:ARRAY{TUP{ITP,TTP}}; |
---|
**** | Return the elements of the container in an array |
concat(arg:$ELT{TUP{ITP,TTP}}):$RO_MULTIMAP{ITP,TTP}; |
---|
**** | Returns a multimap 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=mmap of all e s.t. result.count(e)=self.count(e)+arg.count(e) |
copy: SAME; |
---|
**** | Return a copy of the current container |
count(e:TUP{ITP,TTP}):INT; |
---|
**** | Return the number of occurences of 'e' in self |
delete(k:ITP,e:TTP):$RO_MULTIMAP{ITP,TTP}; |
---|
**** | Shortcut for for delete(e:TUP{ITP,TTP}) |
delete(e:TUP{ITP,TTP}):$RO_MULTIMAP{ITP,TTP}; |
---|
**** | Result is a new multimap containing all the elements of self except for an element equal to 'e', if one exists. If more than one element is equal to 'e', delete only one of them |
delete_all(e:TUP{ITP,TTP}):$RO_MULTIMAP{ITP,TTP}; |
---|
**** | Result is a new multimap ontaining all the elements of self except for any elements equal to 'e' |
delete_ind(k:ITP):$RO_MULTIMAP{ITP,TTP}; |
---|
**** | Returns a new multimap in which all occurences of the tuple (k,_) have been deleted |
elt!:TUP{ITP,TTP}; |
---|
**** | Yield all the elements of self. The order is not defined. |
equals(c:$RO_BAG{TUP{ITP,TTP}}):BOOL; |
---|
**** | Return true if both containers contain the same elements with the same number of repetitions, irrespective of the order of the elements |
has(e: TUP{ITP,TTP}): BOOL; |
---|
**** | True if the container contains the element "e" |
has_ind(k:ITP): BOOL; |
---|
**** | Returns true if this map has an index equal to 'k'
_ return true iff self contains a tuple (k,_) |
ind!:ITP; |
---|
**** | Yields all the indices of self i.e. first elements of every tuple in self - but without repetitions, in an unspecified order
_ yield all i s.t. self.has((i,_)) |
intersection(arg: $RO_BAG{TUP{ITP,TTP}}):$RO_MULTIMAP{ITP,TTP}; |
---|
**** | Returns a multimap 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=mmap of all e s.t. result.count(e)=min(self.count(e),arg.count(e)) |
is_empty:BOOL; |
---|
**** | Returns true if the size of the container = 0 |
is_subset_of(arg: $RO_BAG{TUP{ITP,TTP}}): BOOL; |
---|
**** | 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
_ return true iff for all e in self: count(e) <= arg.count(e) |
n_ind:INT; |
---|
**** | Return the number of unique indices in 'self'
_ return size of {i s.t. self.has((i,_))} |
n_targets(k:ITP): INT; |
---|
**** | Returns the number of targets associated with the index 'k' |
n_unique: INT; |
---|
**** | Returns the number of unique elements in the bag |
pair!: TUP{ITP,TTP}; |
---|
**** | Yields all elements of self in an unspecified order. An alias for "elt!" |
size: INT; |
---|
**** | Number of elements contained |
str:STR; |
---|
**** | Yield a string version of self |
target!(once k:ITP):TTP; |
---|
**** | Yields all the target associated with index 'k'
_ yield all t s.t. self.has((k,t)) |
union(arg: $RO_BAG{TUP{ITP,TTP}}): $RO_MULTIMAP{ITP,TTP}; |
---|
**** | Returns a multimap 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'
_ result=mmap of all e s.t. result.count(e)=max(self.count(e),arg.count(e)) |
unique!:TUP{ITP,TTP}; |
---|
**** | Yield the unique elements of self. Equivalent to self.as_set.elt! |