public interface IMemory<T> extends IMemoryView<T>, Clearable
Refined by:
IMultiset
, which always contains values with a nonnegative multiplicity. IDeltaBag
, which may contain values with negative multiplicity. ISetMemory
, which is just a set (allowed multiplicities: 0 and 1). Modifier and Type | Method and Description |
---|---|
boolean |
addOne(T value)
Adds one value occurrence to the memory.
|
boolean |
addSigned(T value,
int count)
Adds the given number of occurrences to the memory.
|
void |
clear()
Empties out the memory.
|
void |
clearAllOf(T value)
Removes all occurrences of the given value from the memory.
|
boolean |
removeOne(T value)
Removes one occurrence of the given value from the memory.
|
asMap, asStream, containsNonZero, containsNonZeroUnsafe, distinctValues, entriesWithMultiplicities, equals, forEachEntryWithMultiplicities, fromMap, getCount, getCountUnsafe, hashCode, isEmpty, size, theContainedVersionOf, theContainedVersionOfUnsafe
boolean addOne(T value)
IDeltaBag
) is no longer present in the memoryboolean addSigned(T value, int count)
Precondition if IMultiset
: at least the given amount of occurrences exist, if count is negative.
Precondition if ISetMemory
: count is +1 or -1, the latter is only allowed if the set contains the value.
count
- the number of occurrencesjava.lang.IllegalStateException
- if IMultiset
or ISetMemory
and the number of occurrences in the memory would underflow to negativeboolean removeOne(T value)
Precondition if IMultiset
or ISetMemory
: the value must have a positive amount of occurrences in the memory.
IDeltaBag
) is the first negative occurrence of the valuejava.lang.IllegalStateException
- if IMultiset
or ISetMemory
and value had no occurrences in the memoryvoid clearAllOf(T value)