org.javanetworkanalyzer.progress
Class DefaultProgressMonitor

java.lang.Object
  extended by org.javanetworkanalyzer.progress.DefaultProgressMonitor
All Implemented Interfaces:
ProgressMonitor

public class DefaultProgressMonitor
extends Object
implements ProgressMonitor

Default implementation of a progress monitor that prints a progress bar to the console.

Author:
Adam Gouge

Constructor Summary
DefaultProgressMonitor()
           
 
Method Summary
 void endTask()
          Does nothing.
 long getEnd()
          Gets the end value of the current task.
 int getPercentageComplete()
          Returns the percentage complete.
 boolean isCancelled()
          Returns true if the process is canceled and should end as quickly as possible.
 void setProgress(long count)
          Sets the progress and returns the percentage complete.
 void setProgress(long count, long startTime)
          Sets the progress, keeping track of the start time, and returns the percentage complete.
 void startTask(String taskName, long end)
          Sets the end and instantiates a ConsoleProgressBar for this task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultProgressMonitor

public DefaultProgressMonitor()
Method Detail

startTask

public void startTask(String taskName,
                      long end)
Sets the end and instantiates a ConsoleProgressBar for this task.

Specified by:
startTask in interface ProgressMonitor
Parameters:
taskName - The task name.
end - The end time.
See Also:
ProgressMonitor.startTask(java.lang.String, long).

endTask

public void endTask()
Does nothing.

Specified by:
endTask in interface ProgressMonitor
See Also:
ProgressMonitor.endTask().

isCancelled

public boolean isCancelled()
Returns true if the process is canceled and should end as quickly as possible.

Specified by:
isCancelled in interface ProgressMonitor
Returns:

setProgress

public void setProgress(long count)
Sets the progress and returns the percentage complete.

Specified by:
setProgress in interface ProgressMonitor
Parameters:
count - The count.

getPercentageComplete

public int getPercentageComplete()
Returns the percentage complete.

Specified by:
getPercentageComplete in interface ProgressMonitor

getEnd

public long getEnd()
Gets the end value of the current task.

Specified by:
getEnd in interface ProgressMonitor
Returns:
The end value of the current task.

setProgress

public void setProgress(long count,
                        long startTime)
Sets the progress, keeping track of the start time, and returns the percentage complete.

Specified by:
setProgress in interface ProgressMonitor
Parameters:
count - A counter to keep track of which iteration in a loop.
startTime - The System time in milliseconds when this task was started.


Copyright © 2014. All Rights Reserved.