public static interface GeneralizedBitProcessing.SliceOperation
GeneralizedBitProcessing
class.Modifier and Type  Method and Description 

boolean 
isInPlaceProcessingAllowed()
Indicates whether this algorithm can work in place.

void 
processBits(ArrayContext context,
UpdatableBitArray destBits,
BitArray srcBits,
long sliceIndex,
int threadIndex,
int numberOfThreads)
Processes the source bit array srcBits and saves the results in destBits bit array.

void processBits(ArrayContext context, UpdatableBitArray destBits, BitArray srcBits, long sliceIndex, int threadIndex, int numberOfThreads)
GeneralizedBitProcessing.process(UpdatablePArray, PArray, Range, long)
method
for every bit slice
of the source nonbit array.
It is the main method, which you should implement to generalize some bit algorithm for nonbit case.
The destBits and srcBits arrays will be different bit arrays, allocated by
process
method
(according to the memory model, recommended by the context
),
if the isInPlaceProcessingAllowed()
method returns false.
If that method returns true, the destBits and srcBits arguments
will be references to the same bit array.
The index i of the slice, processed by this method, is passed via sliceIndex argument. In other words, the threshold, corresponding to this slice, is
t_{i} = a_{min} + i * (a_{max}−a_{min})/n, i = sliceIndex(here a_{min}..a_{max} is the range of processed values and n+1 is the desired number of slices, passed via range and numberOfSlices arguments of
process
method).
In the rounddown mode sliceIndex is always in range 1..n,
and in the roundup mode it is always in range 0..n1.
The slice with index i=0 (rounddown mode) or i=n (roundup mode)
is never processed, because the end result does not depend on it.
See comments to GeneralizedBitProcessing
class for more details.
Please note that this method can be called simultaneously in different threads,
when GeneralizedBitProcessing
class uses multithreading optimization.
In this case, threadIndex argument will be the index of the thread,
in which this method is called, i.e. an integer in
0..min(n1,GeneralizedBitProcessing.numberOfTasks()
−1)
range, where n+1 is the desired number of slices. The high bound of this range, increased by 1, is also passed via numberOfThreads argument. The threadIndex can be very useful if your algorithm requires some work memory or other objects: in this case, your should allocate different work memory for different threads.
If multithreading optimization is not used, in particular, if the arrays, processed by
process
method,
are bit arrays
, then threadIndex=0 and numberOfThreads=1.
context
 the context of execution. It will be null, if (and only if)
the same argument of
process
method is null; in this case, the context should be ignored.
The main purpose of the context is to allow interruption of this method via
ArrayContext.checkInterruption()
and to allocate
work memory via ArrayContext.getMemoryModel()
.destBits
 the destination bit array, where results of processing should be stored.srcBits
 the source bit array for processing.sliceIndex
 the index of the currently processed slice,
from 1 to n in the rounddown mode or
from 0 to n1 the roundup mode
(n is the desired number of slices minus 1).threadIndex
 the index of the current thread (different for different threads in a case of
multithreading optimization).numberOfThreads
 the maximal possible value of threadIndex+1: equal to
GeneralizedBitProcessing.numberOfTasks()
)process
method.java.lang.NullPointerException
 if srcBits or destBits argument is null.boolean isInPlaceProcessingAllowed()
Some algorithms, processing bit arrays, can work in place, when the results are stored in the source
array. In this case, this method should return true. If it returns true,
GeneralizedBitProcessing.process(UpdatablePArray, PArray, Range, long)
method
saves memory and time by passing the same bit array as destBits and srcBits arguments
of processBits
method.
If it returns false,
GeneralizedBitProcessing.process(UpdatablePArray, PArray, Range, long)
method
allocates 2 different bit arrays for source and resulting bit arrays and passes
them as destBits and srcBits arguments
of processBits
method.
processBits
method can work correctly when destBits==srcBits or false
if that method requires different source and destination arrays.
Https://vympelmeteor.com https://vympelmeteor.com ультрас в интернет магазине  магазин для ультрас. vympelmeteor.com 