Package net.algart.arrays
Class CombinedMemoryModel.AbstractByteBufferCombinerInPlace<E>
java.lang.Object
net.algart.arrays.CombinedMemoryModel.AbstractByteBufferCombiner<E>
net.algart.arrays.CombinedMemoryModel.AbstractByteBufferCombinerInPlace<E>
- All Implemented Interfaces:
CombinedMemoryModel.Combiner<E>
,CombinedMemoryModel.CombinerInPlace<E>
- Enclosing class:
CombinedMemoryModel<E>
public abstract static class CombinedMemoryModel.AbstractByteBufferCombinerInPlace<E>
extends CombinedMemoryModel.AbstractByteBufferCombiner<E>
implements CombinedMemoryModel.CombinerInPlace<E>
A version of CombinedMemoryModel.AbstractByteBufferCombiner
skeleton class
implementing CombinedMemoryModel.CombinerInPlace
interface.
-
Field Summary
Fields inherited from class net.algart.arrays.CombinedMemoryModel.AbstractByteBufferCombiner
workStorage
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractByteBufferCombinerInPlace
(Class<?> elementType, ByteBuffer workStorageForOneElement, MemoryModel memoryModel) Creates a new instance of this combiner. -
Method Summary
Modifier and TypeMethodDescriptionabstract E
Creates a new element that can be stored in or loaded from the combined array.final void
getInPlace
(long index, E resultValue, Array[] storage) Loads an element #index of the combined array from the given set of arrays into resultValue object.protected abstract void
loadElementInPlace
(E resultElement) Should fill the passed element of the combined array fromCombinedMemoryModel.AbstractByteBufferCombiner.workStorage
.Methods inherited from class net.algart.arrays.CombinedMemoryModel.AbstractByteBufferCombiner
allocateStorage, get, loadElement, numbersOfElementsPerOneCombinedElement, set, storeElement
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.algart.arrays.CombinedMemoryModel.Combiner
allocateStorage, get, numbersOfElementsPerOneCombinedElement, set
-
Constructor Details
-
AbstractByteBufferCombinerInPlace
protected AbstractByteBufferCombinerInPlace(Class<?> elementType, ByteBuffer workStorageForOneElement, MemoryModel memoryModel) Creates a new instance of this combiner.- Parameters:
elementType
- the type of elements of the combined array.workStorageForOneElement
- a little ByteBuffer enough to store one element of the combined array. May be direct ByteBuffer, but the heap one usually provides better performance.memoryModel
- thememory model
which will be used for creating combined arrays.- Throws:
NullPointerException
- if one of the arguments is null.IllegalArgumentException
- if the passed ByteBuffer is read-only.
-
-
Method Details
-
allocateElement
Description copied from interface:CombinedMemoryModel.CombinerInPlace
Creates a new element that can be stored in or loaded from the combined array. Never returns null.- Specified by:
allocateElement
in interfaceCombinedMemoryModel.CombinerInPlace<E>
- Returns:
- some instance of an element of the combined array.
-
loadElementInPlace
Should fill the passed element of the combined array fromCombinedMemoryModel.AbstractByteBufferCombiner.workStorage
.- Parameters:
resultElement
- the object where the retrieved content will be stored.- Throws:
NullPointerException
- if the argument is null.
-
getInPlace
Description copied from interface:CombinedMemoryModel.CombinerInPlace
Loads an element #index of the combined array from the given set of arrays into resultValue object. This method is called byObjectInPlaceArray.getInPlace(long, Object)
method.- Specified by:
getInPlace
in interfaceCombinedMemoryModel.CombinerInPlace<E>
- Parameters:
index
- an index in the combined array.resultValue
- the object where the retrieved content will be stored.storage
- a set of arrays where the retrieved content is stored now.
-