public class AverageSubCalculationProgress extends Object
ITrackCalculationProgress
that averages the progress of a number of sub-calculations and
reports the result to another ITrackCalculationProgress
instance. The return value of AverageSubCalculationProgress.forSubCalculation(double)
should be passed to each sub-calculation.Constructor and Description |
---|
AverageSubCalculationProgress(ITrackCalculationProgress parentProgress)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
ITrackCalculationProgress |
forSubCalculation(double weight)
Gets an
ITrackCalculationProgress instance for a sub-calculation. |
boolean |
getCancellationPending()
Gets a value indicating whether cancellation of the calculation is requested.
|
int |
getLastProgress()
Gets the last value of the overall progress, averaged over the sub-calculations.
|
int[] |
getSubCalculationProgress()
Gets the set of progress values, each representing the progress of a sub-calculation.
|
public AverageSubCalculationProgress(@Nullable ITrackCalculationProgress parentProgress)
parentProgress
- The parent instance to which to report progress.@Nonnull public final ITrackCalculationProgress forSubCalculation(double weight)
ITrackCalculationProgress
instance for a sub-calculation.weight
- The weight of this sub-calculation relative to other sub-calculations.public final boolean getCancellationPending()
This method will not necessarily be called in the same thread that initiated the calculation, nor is it guaranteed to be called in the same thread each time it is called. However, a single calculation will not call this method in multiple threads simultaneously.
public final int getLastProgress()
@Nonnull public final int[] getSubCalculationProgress()