org.basex.core
Class Progress

java.lang.Object
  extended by org.basex.core.Progress
Direct Known Subclasses:
Builder, Command, IndexBuilder, Parser, QueryContext, QueryProcessor, Zip

public abstract class Progress
extends java.lang.Object

This class is implemented by all kinds of processes. It gives feedback on the current process. Moreover, it allows to interrupt the process by calling the stop() method.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
 InfoListener listen
          Listener, reacting on progress information.
 boolean updating
          This flag indicates that a command may perform updates.
 
Constructor Summary
Progress()
           
 
Method Summary
 void checkStop()
          Checks if the progress was interrupted; if yes, sends a runtime exception.
 java.lang.String detail()
          Returns detailed information on the current process or sub process.
 void listen(InfoListener il)
          Attaches the specified info listener.
 double progress()
          Returns a progress value from the interval [0, 1].
 void startTimeout(long sec)
          Starts a timeout thread.
 void stop()
          Stops a process or sub process.
 void stopTimeout()
          Stops the timeout thread.
 java.lang.String title()
          Returns short information on the current process or sub process.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listen

public InfoListener listen
Listener, reacting on progress information.


updating

public boolean updating
This flag indicates that a command may perform updates.

Constructor Detail

Progress

public Progress()
Method Detail

title

public final java.lang.String title()
Returns short information on the current process or sub process.

Returns:
header information

detail

public final java.lang.String detail()
Returns detailed information on the current process or sub process. Can be overwritten to give more detailed information.

Returns:
information in detail

progress

public final double progress()
Returns a progress value from the interval [0, 1].

Returns:
header information

listen

public final void listen(InfoListener il)
Attaches the specified info listener.

Parameters:
il - info listener

stop

public final void stop()
Stops a process or sub process.


checkStop

public final void checkStop()
Checks if the progress was interrupted; if yes, sends a runtime exception.


startTimeout

public final void startTimeout(long sec)
Starts a timeout thread.

Parameters:
sec - seconds to wait; deactivated if set to 0

stopTimeout

public final void stopTimeout()
Stops the timeout thread.