Interface CombinedMemoryModel.BufferedCombiner<E>
- All Superinterfaces:
CombinedMemoryModel.Combiner<E>
- Enclosing class:
CombinedMemoryModel<E>
Special version of CombinedMemoryModel.Combiner
interface allowing
to optimize block access to the combined array.
If the argument of CombinedMemoryModel.getInstance(Combiner)
method
implements this interface, then getData(...)
,
setData(...)
and
buffer-access
methods will use block get/set
methods declared in this interface. In other case, those methods
will call separate get/set method, declared in CombinedMemoryModel.Combiner
,
for every loaded/stored element of the combined array.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Reads count elements of the combined array, starting from te specified index, from the given set of AlgART arrays (storage).void
set
(long index, E[] values, int offset, int count, UpdatableArray[] storage) Stores count elements of the combined array, starting from te specified index, inside the given set of AlgART arrays (storage).Methods inherited from interface net.algart.arrays.CombinedMemoryModel.Combiner
allocateStorage, get, numbersOfElementsPerOneCombinedElement, set
-
Method Details
-
get
Reads count elements of the combined array, starting from te specified index, from the given set of AlgART arrays (storage). Loaded elements are placed into resultValues Java array at the positions #offset..#offset+count-1. This method is called byArray.getData(long, Object, int, int)
andDataObjectBuffer.map(long)
methods.Note: if resultValues[offset+k]!=null for some index k (0<=k<count), and the element type allows changing full element state, this method may not to allocate new object for this index, but load the corresponding combined element #index+k into resultValues[offset+k]. It can essentially optimize loading a large number of elements.
- Parameters:
index
- starting index in the combined array.resultValues
- the target Java array.offset
- starting position in the target Java array.count
- the number of elements to be retrieved.storage
- a set of arrays where the retrieved content is stored now.
-
set
Stores count elements of the combined array, starting from te specified index, inside the given set of AlgART arrays (storage). The elements are loaded from values Java array from at the positions #offset..#offset+count-1. This method is called byUpdatableArray.setData(long, Object, int, int)
andDataBuffer.force(long, long)
methods.Important: this method must not throw NullPointerException if some element of values Java array is null. Instead, it should store some "signal" value in the storage, that cannot be stored for any possible non-null elements, or just some default ("empty") value. In the first case, further
get(index, storage)
should return null for this element; in the second case, it should return an instance in the default state.- Parameters:
index
- starting index in the combined array.values
- the source Java array.offset
- starting position in the source Java array.count
- the number of elements to be stored.storage
- a set of arrays where the content will be stored.
-