T
- the type of the objects in this multiset.public abstract class AbstractMultiSet<T,M extends java.util.Map<T,java.lang.Integer>> extends java.util.AbstractCollection<T> implements MultiSet<T>
HTMLToString.HTMLCellRenderer
Constructor and Description |
---|
AbstractMultiSet() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T par)
adds one object to the multiset.
|
java.lang.Integer |
add(T par,
java.lang.Integer weight)
Adds the given object to the multiset, as many times as indicated by the
given weight parameter.
|
boolean |
addAll(java.util.Collection<? extends T> collection)
Adds the given collection to this multiset.
|
java.util.Set<T> |
baseSet()
returns an unmodifiable set of unique objects in the multiset.
|
void |
clear() |
boolean |
contains(java.lang.Object o)
checks whether the number of occurrences of the given object is greater
or equal to 1.
|
boolean |
containsAll(java.util.Collection<?> c)
Checks whether the number of occurrences of elements in the given
collection is at most what is specified in this collection, i.e., this
method returns (new MultiSet(c)).isLessOrEqual(this)
|
protected boolean |
containsAtLeast(T element,
int occ) |
boolean |
equals(java.lang.Object o)
returns true if the multisets are equal, i.e.
|
int |
hashCode()
returns a hashCode for this multiset.
|
boolean |
isEmpty() |
boolean |
isLessOrEqual(MultiSet<T> multiSet)
returns true if this multiset is less or equal to the given multiset,
i.e.
|
java.util.Iterator<T> |
iterator()
returns an iterator over the elements of the multiset.
|
java.lang.Integer |
occurrences(java.lang.Object source)
returns the number of occurrences of the given object in this multiset.
|
boolean |
remove(java.lang.Object o)
removes the given object from this multiset, if it is in there.
|
boolean |
removeAll(java.util.Collection<?> collection)
removes the elements in the given multiset from this multiset.
|
protected <S extends MultiSet<T>> |
removeAllMultiSet(AbstractMultiSet<?,?> mset,
S removed) |
boolean |
retainAll(java.util.Collection<?> c)
Keeps all elements of the given collection in this multiset.
|
boolean |
retainAll(MultiSet<?> c)
Keeps all elements of the given collection in this multiset.
|
int |
size()
returns the size of the multiset, i.e.
|
java.lang.String |
toHTMLString(boolean includeHTMLTags) |
java.util.List<T> |
toList()
Converts this multiset to a list, such that each element occurs as often
as returned by the iterator of the multiset (its number of occurrences).
|
java.lang.String |
toString()
returns a string representing this multiset.
|
public boolean retainAll(java.util.Collection<?> c)
public boolean add(T par)
public boolean retainAll(MultiSet<?> c)
public java.lang.Integer add(T par, java.lang.Integer weight)
public boolean addAll(java.util.Collection<? extends T> collection)
public java.util.List<T> toList()
public boolean isLessOrEqual(MultiSet<T> multiSet)
isLessOrEqual
in interface MultiSet<T>
multiSet
- the multiset to testprotected boolean containsAtLeast(T element, int occ)
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection<T>
equals
in class java.lang.Object
public int size()
public java.lang.String toString()
toString
in class java.util.AbstractCollection<T>
public int hashCode()
hashCode
in interface java.util.Collection<T>
hashCode
in class java.lang.Object
public java.lang.Integer occurrences(java.lang.Object source)
occurrences
in interface MultiSet<T>
source
- the object to get the occurrences forpublic java.util.Iterator<T> iterator()
public java.util.Set<T> baseSet()
public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean remove(java.lang.Object o)
public boolean removeAll(java.util.Collection<?> collection)
removeAll
in interface java.util.Collection<T>
removeAll
in class java.util.AbstractCollection<T>
mset
- the multiset of elements needing to be removed.protected <S extends MultiSet<T>> S removeAllMultiSet(AbstractMultiSet<?,?> mset, S removed)
public java.lang.String toHTMLString(boolean includeHTMLTags)
toHTMLString
in interface HTMLToString
public void clear()