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 theTimeEstimatorinterface. 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 longgetUploadTimeLeft()voidstart()Starts the time counting.voidstop()Stops the time counting and updates the internal time counter.voidstop(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:TimeEstimatorStarts the time counting.- Specified by:
startin interfaceTimeEstimator- See Also:
TimeEstimator.start()
-
stop
public void stop()
Description copied from interface:TimeEstimatorStops the time counting and updates the internal time counter.- Specified by:
stopin interfaceTimeEstimator- See Also:
TimeEstimator.stop()
-
stop
public void stop(long uploadedBytes)
Description copied from interface:TimeEstimatorStops the time counting and updates the internal updates the internal time counter and counter of total number of transmitted bytes.- Specified by:
stopin 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:
getUploadTimeLeftin interfaceTimeEstimator- Returns:
- The estimated time remaining. The value 0 is returned if
stophasn't been called at least once before calling this method. - See Also:
TimeEstimator.getUploadTimeLeft()
-
-