abstract class $VSET{ETP} < $RO_SET{ETP}, $VBAG{ETP} |
---|
**** | An unordered container in which the elements are unique. Corresponds to a mathematical set.
_ IMPORTANT: This is a value abstraction and is stricter than the read-only abstraction. Subtypes must not support *any* operations that modify self. The language cannot enforce this restriction. _ For pointers to other documentation please see the class comment in the read-only abstraction $RO_SET{ETP} |
$VBAG{_} | $HASH | $IS_EQ | $RO_BAG{_} | $CONTAINER{_} | $STR | $ELT{_} | $ELT | $RO_SET{_} |
VSET{_} |
add(e:ETP):$VBAG{ETP}; |
---|
**** | Result is a new bag containing all the elements of self and 'e' |
as_array:ARRAY{ETP}; |
---|
**** | Return the elements of the container in an array |
concat(arg:$ELT{ETP}): $VBAG{ETP}; |
---|
**** | 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; |
---|
**** | Return a copy of the current container |
count(e:ETP):INT; |
---|
**** | Return the number of occurences of 'e' in self |
delete(e:ETP):$VSET{ETP}; |
---|
**** | Result is a new set containing all the elements of self except for an element equal to 'e', if one exists. |
delete_all(e:ETP):$VSET{ETP}; |
---|
**** | Result is a new set containing all the elements of self except for any elements equal to 'e' |
diff(arg: $RO_SET{ETP}): $VSET{ETP}; |
---|
**** | Returns a set containing the elements of 'self' not in 'arg'
_ result=set of all e s.t. self.has(e) and ~arg.has(e) |
elt!:ETP; |
---|
**** | Yield all the elements of self. The order is not defined. |
equals(c:$RO_BAG{ETP}):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: ETP): BOOL; |
---|
**** | True if the container contains the element "e" |
insert(e:ETP):$VSET{ETP}; |
---|
**** | Result is a new set containing all the elements of self and 'e' |
intersection(arg:$RO_BAG{ETP}):$VBAG{ETP}; |
---|
**** | 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_ |
intersection(arg: $RO_SET{ETP}): $VSET{ETP}; |
---|
**** | Returns a set containing the elements of 'self' and in 'arg'
_ result=set of all e s.t. self.has(e) and arg.has(e) |
is_empty:BOOL; |
---|
**** | Returns true if the size of the container = 0 |
is_subset_of(arg: $RO_BAG{ETP}): 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
_ result=true iff for all e in self: count(e) <= arg.count(e) |
n_unique: INT; |
---|
**** | Returns the number of elements in the set. Same as size |
size: INT; |
---|
**** | Number of elements contained |
str:STR; |
---|
**** | Yield a string version of self |
sym_diff(arg: $RO_SET{ETP}): $VSET{ETP}; |
---|
**** | Returns a set containing the elements of 'self' and not in 'arg' or in 'arg' but not in self
_ result=set of all e s.t. self.has(e) xor arg.has(e) |
union(arg:$RO_BAG{ETP}): $VBAG{ETP}; |
---|
**** | 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'
_ result=bag of all e s.t. _____________result.count(e)=_max(self.count(e),arg.count(e))_>_0 |
union(arg: $RO_SET{ETP}): $VSET{ETP}; |
---|
**** | Returns a set containing all elements in 'self' or 'arg'.
_ result=set of all e s.t. self.has(e) or arg.has(e) |
unique!:ETP; |
---|
**** | Yield the elements of 'self' |