Package one.microstream.collections
Class SubProcessor<E>
- java.lang.Object
-
- one.microstream.collections.SubView<E>
-
- one.microstream.collections.SubProcessor<E>
-
- All Implemented Interfaces:
Iterable<E>
,CapacityCarrying
,ConsolidatableCollection
,ExtendedCollection<E>
,ExtendedSequence<E>
,OptimizableCollection
,ReleasingCollection<E>
,Sized
,Truncateable
,XGettingCollection<E>
,XGettingSequence<E>
,XIndexIterable<E>
,XIterable<E>
,XJoinable<E>
,XProcessingCollection<E>
,XProcessingSequence<E>
,XRemovingCollection<E>
,XRemovingSequence<E>
,Processable<E>
,Clearable
,Copyable
public class SubProcessor<E> extends SubView<E> implements XProcessingSequence<E>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface one.microstream.typing.Copyable
Copyable.Static
-
Nested classes/interfaces inherited from interface one.microstream.collections.interfaces.ExtendedCollection
ExtendedCollection.Creator<E,C extends ExtendedCollection<E>>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingCollection
XGettingCollection.Creator<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingSequence
XGettingSequence.Factory<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XIterable
XIterable.Executor<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XProcessingSequence
XProcessingSequence.Factory<E>
-
-
Constructor Summary
Constructors Constructor Description SubProcessor()
-
Method Summary
Modifier and Type Method Description void
clear()
Clears all elements from the collection while leaving the capacity as it is.long
consolidate()
Consolidates the internal storage of this collection by discarding all elements of the internal storage that have become obsolete or otherwise unneeded anymore.SubProcessor<E>
copy()
Creates a true copy of this list which references th same elements in the same order as this list does at the time the method is called.E
fetch()
<C extends Consumer<? super E>>
CmoveSelection(C target, long... indices)
<C extends Consumer<? super E>>
CmoveTo(C target, Predicate<? super E> predicate)
long
nullRemove()
OldCollection<E>
old()
long
optimize()
Optimizes internal memory usage by rebuilding the storage to only occupy as much memory as needed to store the currently contained elements in terms of the collection's current memory usage configuration (e.g.E
pick()
E
pinch()
E
pop()
<P extends Consumer<? super E>>
Pprocess(P procedure)
long
remove(E element)
long
removeAll(XGettingCollection<? extends E> elements)
E
removeAt(long index)
long
removeBy(Predicate<? super E> predicate)
long
removeDuplicates()
long
removeDuplicates(Equalator<? super E> equalator)
boolean
removeOne(E element)
XProcessingSequence<E>
removeRange(long offset, long length)
long
removeSelection(long[] indices)
long
retainAll(XGettingCollection<? extends E> elements)
XProcessingSequence<E>
retainRange(long offset, long length)
E
retrieve(E element)
E
retrieveBy(Predicate<? super E> predicate)
SubProcessor<E>
toReversed()
void
truncate()
Clears (and reinitializes if needed) this collection in the fastest possible way, i.e.SubProcessor<E>
view()
-
Methods inherited from class one.microstream.collections.SubView
applies, at, contains, containsAll, containsId, containsSearched, copySelection, copyTo, count, countBy, distinct, distinct, equality, equals, equalsContent, except, filterTo, first, get, hasVolatileElements, immure, indexBy, indexOf, intersect, isEmpty, isFull, isSorted, iterate, iterateIndexed, iterator, join, last, lastIndexBy, lastIndexOf, max, maximumCapacity, maxIndex, min, minIndex, nullAllowed, nullContained, peek, poll, range, remainingCapacity, scan, search, seek, size, toArray, toArray, union, view
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface one.microstream.collections.interfaces.CapacityCarrying
isFull, maximumCapacity, remainingCapacity
-
Methods inherited from interface one.microstream.collections.interfaces.ExtendedCollection
nullAllowed
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface one.microstream.collections.types.XGettingCollection
applies, contains, containsAll, containsId, containsSearched, copyTo, count, countBy, distinct, distinct, equality, equals, equals, equalsContent, except, filterTo, hashCode, hasVolatileElements, intersect, intSize, iterator, join, max, min, nullContained, search, seek, size, toArray, toArray, union
-
Methods inherited from interface one.microstream.collections.types.XGettingSequence
at, copySelection, first, get, hasIndex, immure, indexBy, indexOf, isSorted, last, lastIndexBy, lastIndexOf, maxIndex, minIndex, peek, poll, range, scan
-
Methods inherited from interface one.microstream.collections.types.XIndexIterable
iterateIndexed
-
Methods inherited from interface one.microstream.collections.types.XProcessingCollection
iterate
-
Methods inherited from interface one.microstream.collections.types.XProcessingSequence
view
-
-
-
-
Method Detail
-
fetch
public E fetch()
- Specified by:
fetch
in interfaceXProcessingCollection<E>
-
moveSelection
public <C extends Consumer<? super E>> C moveSelection(C target, long... indices)
- Specified by:
moveSelection
in interfaceXProcessingSequence<E>
-
pick
public E pick()
- Specified by:
pick
in interfaceXProcessingSequence<E>
-
pinch
public E pinch()
- Specified by:
pinch
in interfaceXProcessingCollection<E>
-
pop
public E pop()
- Specified by:
pop
in interfaceXProcessingSequence<E>
-
removeAt
public E removeAt(long index)
- Specified by:
removeAt
in interfaceXProcessingSequence<E>
-
removeRange
public XProcessingSequence<E> removeRange(long offset, long length)
- Specified by:
removeRange
in interfaceXRemovingSequence<E>
-
retainRange
public XProcessingSequence<E> retainRange(long offset, long length)
- Specified by:
retainRange
in interfaceXRemovingSequence<E>
-
removeSelection
public long removeSelection(long[] indices)
- Specified by:
removeSelection
in interfaceXRemovingSequence<E>
-
retrieve
public E retrieve(E element)
- Specified by:
retrieve
in interfaceXProcessingCollection<E>
-
retrieveBy
public E retrieveBy(Predicate<? super E> predicate)
- Specified by:
retrieveBy
in interfaceXProcessingCollection<E>
-
removeOne
public boolean removeOne(E element)
- Specified by:
removeOne
in interfaceXRemovingCollection<E>
-
moveTo
public <C extends Consumer<? super E>> C moveTo(C target, Predicate<? super E> predicate)
- Specified by:
moveTo
in interfaceXProcessingCollection<E>
-
process
public final <P extends Consumer<? super E>> P process(P procedure)
- Specified by:
process
in interfaceProcessable<E>
-
removeBy
public long removeBy(Predicate<? super E> predicate)
- Specified by:
removeBy
in interfaceXProcessingCollection<E>
-
removeDuplicates
public long removeDuplicates(Equalator<? super E> equalator)
- Specified by:
removeDuplicates
in interfaceXProcessingCollection<E>
-
clear
public void clear()
Description copied from interface:XRemovingCollection
Clears all elements from the collection while leaving the capacity as it is.- Specified by:
clear
in interfaceClearable
- Specified by:
clear
in interfaceXRemovingCollection<E>
-
consolidate
public long consolidate()
Description copied from interface:XRemovingCollection
Consolidates the internal storage of this collection by discarding all elements of the internal storage that have become obsolete or otherwise unneeded anymore. (e.g.WeakReference
entries whose reference has been cleared).If this is not possible or not needed in the concrete implementation, this method does nothing and returns 0.
- Specified by:
consolidate
in interfaceConsolidatableCollection
- Specified by:
consolidate
in interfaceXRemovingCollection<E>
- Returns:
- the number of discarded entries.
-
nullRemove
public long nullRemove()
- Specified by:
nullRemove
in interfaceXRemovingCollection<E>
-
optimize
public long optimize()
Description copied from interface:XRemovingCollection
Optimizes internal memory usage by rebuilding the storage to only occupy as much memory as needed to store the currently contained elements in terms of the collection's current memory usage configuration (e.g. hash density).If this is not possible or not needed in the concreate implementation, this method does nothing.
Note that this method can consume a considerable amount of time depending on the implementation and should only be called intentionally and accurately when reducing occupied memory is needed.
- Specified by:
optimize
in interfaceOptimizableCollection
- Specified by:
optimize
in interfaceXRemovingCollection<E>
- Returns:
- the amount of elements that can be added before the internal storage has to be adjusted.
-
remove
public long remove(E element)
- Specified by:
remove
in interfaceXRemovingCollection<E>
-
removeAll
public long removeAll(XGettingCollection<? extends E> elements)
- Specified by:
removeAll
in interfaceXRemovingCollection<E>
-
removeDuplicates
public long removeDuplicates()
- Specified by:
removeDuplicates
in interfaceXRemovingCollection<E>
-
retainAll
public long retainAll(XGettingCollection<? extends E> elements)
- Specified by:
retainAll
in interfaceXRemovingCollection<E>
-
truncate
public void truncate()
Description copied from interface:XRemovingCollection
Clears (and reinitializes if needed) this collection in the fastest possible way, i.e. by allocating a new and empty internal storage of default capacity. The collection will be empty after calling this method.- Specified by:
truncate
in interfaceTruncateable
- Specified by:
truncate
in interfaceXRemovingCollection<E>
-
copy
public SubProcessor<E> copy()
Description copied from interface:XGettingSequence
Creates a true copy of this list which references th same elements in the same order as this list does at the time the method is called. The elements themselves are NOT copied (no deep copying).
The type of the returned list is the same as of this list if possible (i.e.: a SubList can not meaningful return a true copy that references its elements but still is a SubList)
-
view
public SubProcessor<E> view()
- Specified by:
view
in interfaceXGettingCollection<E>
- Specified by:
view
in interfaceXGettingSequence<E>
- Overrides:
view
in classSubView<E>
-
old
public OldCollection<E> old()
-
toReversed
public SubProcessor<E> toReversed()
- Specified by:
toReversed
in interfaceXGettingSequence<E>
- Specified by:
toReversed
in interfaceXProcessingSequence<E>
- Overrides:
toReversed
in classSubView<E>
-
-