public abstract class AbstractProgress extends Object implements Progress
Modifier and Type | Field and Description |
---|---|
private long |
lastLogged
For logging rate control.
|
private AtomicInteger |
processed
The number of items already processed at a time being.
|
private String |
task
The task name.
|
Constructor and Description |
---|
AbstractProgress(String task)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract StringBuilder |
appendToBuffer(StringBuilder buf)
Serialize a description into a String buffer.
|
int |
getProcessed()
Get the number of items already processed at a time being.
|
String |
getTask()
Provides the name of the task.
|
void |
incrementProcessed()
Increment the processed counter.
|
void |
incrementProcessed(Logging logger)
Increment the processed counter.
|
void |
setProcessed(int processed)
Sets the number of items already processed at a time being.
|
void |
setProcessed(int processed,
Logging logger)
Sets the number of items already processed at a time being.
|
protected boolean |
testLoggingRate()
Logging rate control.
|
String |
toString()
Returns a String representation of the progress suitable as a message for
printing to the command line interface.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isComplete
private AtomicInteger processed
private String task
private long lastLogged
public AbstractProgress(String task)
task
- Task name.public String getTask()
public void setProcessed(int processed) throws IllegalArgumentException
processed
- the number of items already processed at a time beingIllegalArgumentException
- if an invalid value was passed.public void setProcessed(int processed, Logging logger) throws IllegalArgumentException
processed
- the number of items already processed at a time beinglogger
- Logger to report toIllegalArgumentException
- if an invalid value was passed.public int getProcessed()
public abstract StringBuilder appendToBuffer(StringBuilder buf)
appendToBuffer
in interface Progress
buf
- Buffer to serialize topublic String toString()
toString
in interface Progress
toString
in class Object
Object.toString()
public void incrementProcessed()
public void incrementProcessed(Logging logger)
logger
- Logger to report to.protected boolean testLoggingRate()