|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tranche.commons.Debuggable
org.tranche.timeestimator.TimeEstimator
public class TimeEstimator
A utility class to easily calculate the estimated completion time for work.
| Field Summary | |
|---|---|
protected long |
bytesCompleted
Represents the work done. |
protected long |
currentTime
The current time for the estimator. |
protected long |
filesCompleted
|
protected long |
startTime
The start time for the estimator. |
protected long |
totalBytes
Represented the amount of work to do. |
protected long |
totalFiles
|
| Constructor Summary | |
|---|---|
TimeEstimator()
|
|
| Method Summary | |
|---|---|
void |
addTotalBytes(long addTotalBytes)
|
void |
addTotalFiles(long addTotalFiles)
|
long |
getBytesDone()
|
long |
getFilesDone()
|
long |
getHours()
Returns the number of hours left to work. |
long |
getMinutes()
Returns the number of minutes left to work. |
double |
getPercentDone()
Returns the percentage of work complete as a number between 0 and 100, e.g. |
long |
getSeconds()
Returns the number of seconds left to work. |
long |
getStartTime()
Get the time the estimator started. |
java.lang.String |
getTimeLeftString()
|
long |
getTimeRunning()
Get the total time the estimator has been running. |
long |
getTotalBytes()
|
long |
getTotalFiles()
|
void |
subtractTotalBytes(long subtractTotalBytes)
|
void |
subtractTotalFiles(long subtractTotalFiles)
|
void |
update(long bytesCompleted,
long totalBytes,
long filesCompleted,
long totalFiles)
Updates the internal clock and provides a chance to update the amount of total work and the amount of work done. |
| Methods inherited from class org.tranche.commons.Debuggable |
|---|
debugErr, debugErr, debugOut, isDebug, setDebug |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected long totalBytes
Represented the amount of work to do.
protected long bytesCompleted
Represents the work done.
protected long totalFiles
protected long filesCompleted
protected long startTime
The start time for the estimator.
protected long currentTime
The current time for the estimator.
| Constructor Detail |
|---|
public TimeEstimator()
| Method Detail |
|---|
public void update(long bytesCompleted,
long totalBytes,
long filesCompleted,
long totalFiles)
Updates the internal clock and provides a chance to update the amount of total work and the amount of work done.
bytesCompleted - An arbitrary long that represents the amount of work completed. Must be between 0 and Long.MAX_VALUE.totalBytes - An arbitrary long that represents the amount of work to do. Must be between 0 and Long.MAX_VALUE.filesCompleted - totalFiles - public long getBytesDone()
public long getTotalBytes()
public long getFilesDone()
public long getTotalFiles()
public void addTotalBytes(long addTotalBytes)
addTotalBytes - public void subtractTotalBytes(long subtractTotalBytes)
subtractTotalBytes - public void addTotalFiles(long addTotalFiles)
addTotalFiles - public void subtractTotalFiles(long subtractTotalFiles)
subtractTotalFiles - public double getPercentDone()
Returns the percentage of work complete as a number between 0 and 100, e.g. 97.23%
public long getHours()
Returns the number of hours left to work. Might be more than 24.
public long getMinutes()
Returns the number of minutes left to work. Will be 0 through 60.
public long getSeconds()
Returns the number of seconds left to work. Will be 0 through 60.
public long getTimeRunning()
Get the total time the estimator has been running.
public long getStartTime()
Get the time the estimator started.
public java.lang.String getTimeLeftString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||