Interface MultiSet<T>
-
- Type Parameters:
T
- the type of the objects in this multiset.
- All Superinterfaces:
java.util.Collection<T>
,HTMLToString
,java.lang.Iterable<T>
- All Known Subinterfaces:
SortedMultiSet<T>
- All Known Implementing Classes:
AbstractMultiSet
,HashMultiSet
,LinkedHashMultiSet
,TreeMultiSet
public interface MultiSet<T> extends java.util.Collection<T>, HTMLToString
This class implements a mutliset. The implementation is synchronized.- Author:
- bfvdonge
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.processmining.framework.util.HTMLToString
HTMLToString.HTMLCellRenderer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.java.util.Set<T>
baseSet()
returns an unmodifiable set of unique objects in the multiset.boolean
isLessOrEqual(MultiSet<T> multiSet)
returns true if this multiset is less or equal to the given multiset, i.e.java.lang.Integer
occurrences(java.lang.Object source)
returns the number of occurrences of the given object in this multiset.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).-
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
-
Methods inherited from interface org.processmining.framework.util.HTMLToString
toHTMLString
-
-
-
-
Method Detail
-
add
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.- Parameters:
par
- the object to addweight
- the number of times to add it- Returns:
- the new number of occurrences of the object (>0)
-
toList
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).- Returns:
- a list of objects as returned by the iterator
-
isLessOrEqual
boolean isLessOrEqual(MultiSet<T> multiSet)
returns true if this multiset is less or equal to the given multiset, i.e. all objects in this multiset should be contained in the given set and the number of occurrences in the given set is at least the number of occurrences in this multiset.- Parameters:
multiSet
- the multiset to test- Returns:
- true if the given multiset is less or equal.
-
occurrences
java.lang.Integer occurrences(java.lang.Object source)
returns the number of occurrences of the given object in this multiset.- Parameters:
source
- the object to get the occurrences for- Returns:
- the number of occurrences, 0 if the object does not occur.
-
baseSet
java.util.Set<T> baseSet()
returns an unmodifiable set of unique objects in the multiset.- Returns:
- an unmodifiable set of unique objects in the multiset.
-
-