Author:
Doug LeaFor an introduction to this package see Overview .
Returns:
condition:isEmpty() && Version change iff !PREV(this).isEmpty();
Returns:
condition:
let int delta = oldElement.equals(newElement)? 0 :
max(1, PREV(this).instances(oldElement) in
instances(oldElement) == PREV(this).instances(oldElement) - delta &&
instances(newElement) == (this instanceof Set) ?
max(1, PREV(this).instances(oldElement) + delta):
PREV(this).instances(oldElement) + delta) &&
no other element changes &&
Version change iff delta != 0
Throws:
IllegalElementException if has(oldElement) and !allows(newElement)Returns:
condition:
let int delta = oldElement.equals(newElement)? 0 :
PREV(this).instances(oldElement) in
instances(oldElement) == PREV(this).instances(oldElement) - delta &&
instances(newElement) == (this instanceof Set) ?
max(1, PREV(this).instances(oldElement) + delta):
PREV(this).instances(oldElement) + delta) &&
no other element changes &&
Version change iff delta != 0
Throws:
IllegalElementException if has(oldElement) and !allows(newElement)Example usage. One way to transfer all elements from Dispenser a to MutableBag b is:
while (!a.empty()) b.add(a.take());
Returns:
an element v such that PREV(this).has(v) and the postconditions of removeOneOf(v) hold.Throws:
NoSuchElementException iff isEmpty.while (e.more()) removeAll(e.value()); @param e the enumeration of elements to exclude.
Throws:
CorruptedIteratorException is propagated if thrownwhile (e.more()) remove (e.value()); @param e the enumeration of elements to remove.
Throws:
CorruptedIteratorException is propagated if thrownReturns:
condition:!has(element) && size() == PREV(this).size() - PREV(this).instances(element) && no other element changes && Version change iff PREV(this).has(element)
Returns:
condition:let occ = max(1, instances(element)) in size() == PREV(this).size() - occ && instances(element) == PREV(this).instances(element) - occ && no other element changes && version change iff occ == 1