public class ProgressHandlerWithTotal extends ProgressHandler
FIXME Currently has nothing to do with the GUI progress classes; maybe the functionality could be merged later.
Example code with message to a Logger:
phwt = ProgressHandlerWithTotal( cTotal, 300, 500, 600 )
loop ...
-- Handle an entry.
phwt.tickAndProgressToLog( log )
end
Example code with own progress display:
phwt = ProgressHandlerWithTotal( cTotal, 300, 500, 600 )
loop ...
-- Handle an entry.
if phwt.tick() then
say 'Handled 'phwt.getCountHandled()' entries; 'L10n.formatDecimal( Double.valueOf( phwt.getPercent() ), '0' )'% done, estimated time to go 'L10n.formatTimespan( Long.valueOf( phwt.getTodoTime() * 1000 ), 'HH:mm:ss' )'...'
end
Constructor and Description |
---|
ProgressHandlerWithTotal(long _countTotal) |
ProgressHandlerWithTotal(long _countTotal,
int _updateInterval) |
ProgressHandlerWithTotal(long _countTotal,
int _updateInterval,
int _roundTo) |
ProgressHandlerWithTotal(long _countTotal,
int _updateInterval,
int _roundTo,
int _maxUpdateDelay) |
ProgressHandlerWithTotal(long _countTotal,
int _updateInterval,
int _roundTo,
int _maxUpdateDelay,
long _estimationBaseTotal) |
Modifier and Type | Method and Description |
---|---|
long |
getCountTotal() |
long |
getEstimationBaseHandled() |
long |
getEstimationBaseTotal() |
org.apache.log4j.Level |
getLogLevel()
Returns the current log level.
|
java.lang.String |
getMessage(java.lang.String thingsDesc)
Returns a standard progress message (FIXME in english only) with all the
info from the current state of this
ProgressHandler . |
java.lang.String |
getMessage(java.lang.String thingsDesc,
boolean forFinalResult) |
java.lang.String |
getMessage(java.lang.String thingsDesc,
boolean forFinalResult,
java.lang.String logPrefix) |
double |
getPercent() |
java.lang.String |
getPercentDefaultFormatted() |
long |
getTodoTime() |
void |
setCountTotal(long $1) |
void |
setEstimationBaseHandled(long $2) |
void |
setEstimationBaseTotal(long $3) |
boolean |
tick()
Must be called for every handled element.
|
boolean |
tick(long incrementEstimationBase) |
finalResultToLog, finalResultToLog, finalResultToLog, finalResultToLog, getCountHandled, getRunningTime, getStartedAt, isDone, printFinalResult, printFinalResult, printFinalResult, printFinalResult, printFinalResult, printProgress, printProgress, printProgress, printProgress, progressToLog, progressToLog, progressToLog, setCountHandled, setLogLevel, start, tick, tickAndPrintProgress, tickAndPrintProgress, tickAndPrintProgress, tickAndPrintProgress, tickAndProgressToLog, tickAndProgressToLog, tickAndProgressToLog
public ProgressHandlerWithTotal(long _countTotal)
_countTotal
- the total number of elements to be handled._updateInterval
- interval in which progress notifications should be
given, in seconds (defaults to 15)._roundTo
- progress notifications are only given if the number of
handled elements is a multiple of this (defaults to 100)_maxUpdateInterval
- maximum time in seconds to wait until progress notification
is shown; if this time has passed a notification will be given, no matter
if a "_roundTo compatible value" is reached or not. This can be used to
assure notifications are shown periodically even if progress is extremly
slow. If 0 this feature will be deactivated. Defaults to 20._estimationBaseTotal
- the total number that shall be used for
calculating the estimated remaining time to complete.public ProgressHandlerWithTotal(long _countTotal, int _updateInterval)
public ProgressHandlerWithTotal(long _countTotal, int _updateInterval, int _roundTo)
public ProgressHandlerWithTotal(long _countTotal, int _updateInterval, int _roundTo, int _maxUpdateDelay)
public ProgressHandlerWithTotal(long _countTotal, int _updateInterval, int _roundTo, int _maxUpdateDelay, long _estimationBaseTotal)
public boolean tick()
ProgressHandler
tick
in class ProgressHandler
public boolean tick(long incrementEstimationBase)
public org.apache.log4j.Level getLogLevel()
ProgressHandler
getLogLevel
in class ProgressHandler
public java.lang.String getMessage(java.lang.String thingsDesc)
ProgressHandler
ProgressHandler
.getMessage
in class ProgressHandler
thingsDesc
- a string with the name of the "things" currently
handled; used in the messageProgressHandler
public java.lang.String getMessage(java.lang.String thingsDesc, boolean forFinalResult)
getMessage
in class ProgressHandler
public java.lang.String getMessage(java.lang.String thingsDesc, boolean forFinalResult, java.lang.String logPrefix)
getMessage
in class ProgressHandler
public java.lang.String getPercentDefaultFormatted()
public double getPercent()
public long getTodoTime()
public long getCountTotal()
public void setCountTotal(long $1)
public long getEstimationBaseHandled()
public void setEstimationBaseHandled(long $2)
public long getEstimationBaseTotal()
public void setEstimationBaseTotal(long $3)
Copyright © 2000-2024 OAshi S.à r.l. All Rights Reserved.