public static class ArrayContext.Event
extends java.lang.Object
ArrayContext.updateProgress(Event)
method.Constructor and Description 

Event(java.lang.Class<?> elementType,
long[] readyCountPerTask,
long[] lengthPerTask)

Event(java.lang.Class<?> elementType,
long readyCount,
long length)
Creates new event with the specified
elementType() , length() ,
readyCount() for the case of 1 parallel task . 
Modifier and Type  Method and Description 

java.lang.Class<?> 
elementType()
Returns the type of elements in the source AlgART array, passed to
an array processing method alike
Arrays.ParallelExecutor.process() . 
long 
length()
Returns the total number of processed elements.

long[] 
lengthPerTask()
Returns the total number of elements, that must be processed
per each of parallel tasks, which the algorithm is split into.

int 
numberOfParallelTasks()
Returns the number of parallel tasks, which the algorithm is split into.

long 
readyCount()
Returns the number of elements that was already processed until this moment.

long[] 
readyCountPerTask()
Returns the number of elements, that was already processed until this moment
per each of parallel tasks, which the algorithm is split into.

double 
readyPart()
Returns the ready part of total algorithm execution.

public Event(java.lang.Class<?> elementType, long readyCount, long length)
elementType()
, length()
,
readyCount()
for the case of 1 parallel task
.
The readyPart()
method in the created instance returns
(double)readyCount/(double)length.
Equivalent to new Event(elementType, new long[] {length}, new long[] {readyCount}).elementType
 the result of elementType()
method in the created event;
may be null.readyCount
 the only element in the result of readyCountPerTask()
method
in the created event.length
 the result of length()
method in the created event.java.lang.IllegalArgumentException
 if length or readyCount is negative,
or if readyCount>length.public Event(java.lang.Class<?> elementType, long[] readyCountPerTask, long[] lengthPerTask)
elementType()
, lengthPerTask()
and readyCountPerTask()
.
The length()
method in the created instance returns
the sum of all elements of lengthPerTask argument.
The readyCount()
method returns
the sum of all elements of readyCountPerTask argument.
The numberOfParallelTasks()
method returns
the length of each of the passed arrays (their lengths must be equal).
The readyPart()
method returns
(double)readyCount()
/(double)length()
.
All elements of the readyCountPerTask array must not be greater than the corresponding elements of the lengthsPerTask array. All elements of these arrays must not be negative.
The passed lengthPerTask and readyCountPerTask arguments are cloned by this method: no references to them are maintained by the created instance.
elementType
 the result of elementType()
method in the created event;
may be null.readyCountPerTask
 the result of readyCountPerTask()
method in the created event.lengthPerTask
 the result of lengthPerTask()
method in the created event.java.lang.NullPointerException
 if lengthPerTask or readyCountPerTask is null.java.lang.IllegalArgumentException
 if lengthPerTask or readyCountPerTask is an empty array,
or if their lengths are not equal,
or if some their elements are negative,
or if readyCountPerTask[k] is than lengthPerTask[k]
for some index k,
or if the sum of all elements of one of these arrays is
greater than Long.MAX_VALUE.public java.lang.Class<?> elementType()
Arrays.ParallelExecutor.process()
.
If the context of using cannot define a suitable type of array elements,
this method may return null.Array.elementType()
public long[] lengthPerTask()
The returned array is a clone of the internal array stored in this object. The returned array is never empty (its length cannot be zero).
public long length()
lengthPerTask()
method.
For Arrays.copy(ArrayContext, UpdatableArray, Array)
method,
returns min(dest.length()
, src.length()
),
where dest and src are the AlgART arrays passed this method.
For Arrays.ParallelExecutor.process()
method and another methods based on it,
return src.Array.length()
,
where src is the processed AlgART array.
public long[] readyCountPerTask()
The returned array is a clone of the internal array stored in this object. The returned array is never empty (its length cannot be zero).
public long readyCount()
readyCountPerTask()
method.public int numberOfParallelTasks()
lengthPerTask()
and readyCountPerTask()
method.Arrays.copy(ArrayContext, UpdatableArray, Array)
,
Arrays.ParallelExecutor
public double readyPart()
readyCount()
/(double)length()
.
Returns 1.0 if and only if all calculations are finished.
Also returns 1.0 if length()
is zero.ArrayContext.part(double, double)