Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.progress
Class FiniteProgress

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.progress.AbstractProgress
      extended by de.lmu.ifi.dbs.elki.utilities.progress.FiniteProgress
All Implemented Interfaces:
Progress

public class FiniteProgress
extends AbstractProgress

A progress object for a given overall 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 total
          The overall number of items to process.
private  int totalLength
          Holds the length of a String describing the total number.
 
Constructor Summary
FiniteProgress(String task, int total)
          A progress object for a given overall number of items to process.
 
Method Summary
 StringBuffer appendToBuffer(StringBuffer buf)
          Append a string representation of the progress to the given string buffer.
 boolean complete()
          Test whether the progress was completed.
 void setProcessed(int processed)
          Sets the number of items already processed at a time being.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.progress.AbstractProgress
getProcessed, getTask, toString
 
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.

Constructor Detail

FiniteProgress

public FiniteProgress(String task,
                      int total)
A progress object for a given overall 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.

Overrides:
setProcessed in class AbstractProgress
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

appendToBuffer

public StringBuffer appendToBuffer(StringBuffer buf)
Append a string representation of the progress to the given string buffer.

Specified by:
appendToBuffer in interface Progress
Specified by:
appendToBuffer in class AbstractProgress
Parameters:
buf - Buffer to serialize to
Returns:
Buffer the data was serialized to.

complete

public boolean complete()
Test whether the progress was completed.

Returns:
Whether the progress was completed.

Release 0.2.1 (2009-07-13_1605)