E - the class of the elements of this multi-set.
Created: Fri Oct 3 21:37:29 2014public interface MultiSetIterator<E> extends Iterator<E>
MultiSets.
Needed in addition: methods on multiplicity of element read last.
Not clear whether one should not allow addMult.
why not unify addMult and removeMult?
This would require a different implementation.
Problem is also that MultiSet is not (yet) a collection.
| Modifier and Type | Method and Description |
|---|---|
int |
getMult()
Returns the current multiplicity of the element
last read by
Iterator.next(),
provided that element was not removed in the meantime. |
MultiSet.Multiplicity |
getMultObj() |
void |
remove()
Removes from the underlying
MultiSet
the last element returned by Iterator.next(),
provided that element was not removed in the meantime
and this method is supported by this iterator. |
int |
removeMult(int removeMult)
Removes from the underlying
MultiSet
the last element returned by invocation of Iterator.next()
with multiplicity given by removeMult,
provided that element was not removed in the meantime
and this method is supported by this iterator. |
int |
setMult(int setMult)
Endows the element of the underlying
MultiSet
returned by the last invocation of Iterator.next()
with multiplicity given by setMult,
provided that element was not removed in the meantime
and this method is supported by this iterator. |
forEachRemaining, hasNext, nextvoid remove()
MultiSet
the last element returned by Iterator.next(),
provided that element was not removed in the meantime
and this method is supported by this iterator.
Invoking this method removes that element
from the set associated with MultiSet.
After this, neither setMult(int) nor removeMult(int)
nor getMult() may be invoked
before next invocation of Iterator.next().
The behavior of this iterator is unspecified
if the underlying MultiSet is modified
while the iteration is in progress
in any way other than by calling methods of an iterator.
remove in interface Iterator<E>UnsupportedOperationException - if removing is not supported by this iterator.
This is in particular true
if the underlying MultiSet is immutable.IllegalStateException - provided this method is supported by this iterator:
if the method Iterator.next() has not yet been called
or if, after last invocation of Iterator.next()
the element returned by this invocation has been removed
from the underlying MultiSet
invoking remove(), setMult(int)
or removeMult(int) or a combination in an appropriate way.int getMult()
Iterator.next(),
provided that element was not removed in the meantime.
This multiplicity could have been modified
after last invocation of Iterator.next()
by invoking remove(),
setMult(int) or removeMult(int).
If the multiplicity became zero,
this means that it has been completely removed
and so its multiplicity cannot be queried any more.IllegalStateException - if the method Iterator.next() has not yet been called
or if, after last invocation of Iterator.next()
the element returned by this invocation has been removed
from the underlying MultiSet
invoking remove(), setMult(int)
or removeMult(int) or a combination in an appropriate way.MultiSet.Multiplicity getMultObj()
int setMult(int setMult)
MultiSet
returned by the last invocation of Iterator.next()
with multiplicity given by setMult,
provided that element was not removed in the meantime
and this method is supported by this iterator.
For setMult=0, invoking this method removes that element
from the set associated with MultiSet.
After this, neither setMult(int) nor removeMult(int)
nor remove() nor getMult() may be invoked
before next invocation of Iterator.next().
The behavior of this iterator is unspecified
if the underlying MultiSet is modified
while the iteration is in progress
in any way other than by calling methods of an iterator.
setMult - a non-negative number signifying the new multiplicity
of the element read last by Iterator.next().UnsupportedOperationException - if setting multiplicity is not supported by this iterator.
This is in particular true
if the underlying MultiSet is immutable.IllegalStateException - provided this method is supported by this iterator:
if the method Iterator.next() has not yet been called
or if, after last invocation of Iterator.next()
the element returned by this invocation has been removed
from the underlying MultiSet
invoking remove(), setMult(int)
or removeMult(int) or a combination in an appropriate way.IllegalArgumentException - if setMult is negative
and if the abovementioned exceptions are not thrown.int removeMult(int removeMult)
MultiSet
the last element returned by invocation of Iterator.next()
with multiplicity given by removeMult,
provided that element was not removed in the meantime
and this method is supported by this iterator.
If removeMult is the multiplicity of that element,
invoking this method removes that element
from the set associated with MultiSet.
After this, neither setMult(int) nor remove()
nor remove() nor getMult() may be invoked
before next invocation of Iterator.next().
The behavior of this iterator is unspecified
if the underlying MultiSet is modified
while the iteration is in progress
in any way other than by calling methods of an iterator.
removeMult - a number signifying the multiplicity which which
the current element should be removed.
Negative values signify adding that element.UnsupportedOperationException - if removing multiplicity is not supported by this iterator.
This is in particular true
if the underlying MultiSet is immutable.IllegalStateException - if the method Iterator.next() has not yet been called
or if, after last invocation of Iterator.next()
the element returned by this invocation has been removed
from the underlying MultiSet
invoking remove(), setMult(int)
or removeMult(int) or a combination in an appropriate way.IllegalArgumentException - if removeMult or resulting multiplicity is negative
and if the abovementioned exceptions are not thrown.remove()Copyright © 2012–2018 Simuline Organization (l2r). All rights reserved.