Package ome.formats.importer.util
Class ProportionalTimeEstimatorImpl
- java.lang.Object
-
- ome.formats.importer.util.ProportionalTimeEstimatorImpl
-
- All Implemented Interfaces:
TimeEstimator
public class ProportionalTimeEstimatorImpl extends java.lang.Object implements TimeEstimator
Class implementing theTimeEstimator
interface. Uses the Exponential Moving Average equation to provide an estimate of the remaining upload time of binary data. A correction factor is used for minimal overestimation.- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description ProportionalTimeEstimatorImpl(long imageContainerSize)
Creates a new object of this class with a defined internal buffer size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getUploadTimeLeft()
void
start()
Starts the time counting.void
stop()
Stops the time counting and updates the internal time counter.void
stop(long uploadedBytes)
Stops the time counting and updates the internal updates the internal time counter and counter of total number of transmitted bytes.
-
-
-
Constructor Detail
-
ProportionalTimeEstimatorImpl
public ProportionalTimeEstimatorImpl(long imageContainerSize)
Creates a new object of this class with a defined internal buffer size.- Parameters:
imageContainerSize
- The total size in bytes of the data container for which upload time is being estimated.
-
-
Method Detail
-
start
public void start()
Description copied from interface:TimeEstimator
Starts the time counting.- Specified by:
start
in interfaceTimeEstimator
- See Also:
TimeEstimator.start()
-
stop
public void stop()
Description copied from interface:TimeEstimator
Stops the time counting and updates the internal time counter.- Specified by:
stop
in interfaceTimeEstimator
- See Also:
TimeEstimator.stop()
-
stop
public void stop(long uploadedBytes)
Description copied from interface:TimeEstimator
Stops the time counting and updates the internal updates the internal time counter and counter of total number of transmitted bytes.- Specified by:
stop
in interfaceTimeEstimator
- Parameters:
uploadedBytes
- Number of bytes uploaded in a single time frame that is being sampled.- See Also:
TimeEstimator.stop(long)
-
getUploadTimeLeft
public long getUploadTimeLeft()
Description copied from interface:TimeEstimator
- Specified by:
getUploadTimeLeft
in interfaceTimeEstimator
- Returns:
- The estimated time remaining. The value 0 is returned if
stop
hasn't been called at least once before calling this method. - See Also:
TimeEstimator.getUploadTimeLeft()
-
-