Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities
Class Progress

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.Progress

public class Progress
extends Object

A progress object for a given overal number of items to process. The number of already processed items at a point in time can be updated. The main feature of this class is to provide a String representation of the progress suitable as a message for printing to the command line interface.

Author:
Arthur Zimek

Field Summary
private  int processed
          The number of items already processed at a time being.
private  String task
          The task name.
private  int total
          The overall number of items to process.
private  int totalLength
          Holds the length of a String describing the total number.
 
Constructor Summary
Progress(String task, int total)
          A progress object for a given overal number of items to process.
 
Method Summary
 String getTask()
          Provides the name of the task.
 void setProcessed(int processed)
          Sets the number of items already processed at a time being.
 int status()
          Returns the progress status (percentage of progress).
 String toString()
          Returns a String representation of the progress suitable as a message for printing to the command line interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

total

private final int total
The overall number of items to process.


totalLength

private final int totalLength
Holds the length of a String describing the total number.


processed

private int processed
The number of items already processed at a time being.


task

private String task
The task name.

Constructor Detail

Progress

public Progress(String task,
                int total)
A progress object for a given overal number of items to process.

Parameters:
task - the name of the task
total - the overall number of items to process
Method Detail

setProcessed

public void setProcessed(int processed)
                  throws IllegalArgumentException
Sets the number of items already processed at a time being.

Parameters:
processed - the number of items already processed at a time being
Throws:
IllegalArgumentException - if the given number is negative or exceeds the overall number of items to process

status

public int status()
Returns the progress status (percentage of progress).

Returns:
the progress status (percentage of progress)

toString

public String toString()
Returns a String representation of the progress suitable as a message for printing to the command line interface.

Overrides:
toString in class Object
See Also:
Object.toString()

getTask

public String getTask()
Provides the name of the task.

Returns:
the name of the task

Release 0.1 (2008-07-10_1838)