org.basex.core.cmd
Class Optimize

java.lang.Object
  extended by org.basex.core.Proc
      extended by org.basex.core.Command
          extended by org.basex.core.cmd.ACreate
              extended by org.basex.core.cmd.Optimize

public final class Optimize
extends ACreate

Evaluates the 'optimize' command and optimizes the data structures of the currently opened database. Indexes and statistics are refreshed, which is especially helpful after updates.

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

Field Summary
 
Fields inherited from class org.basex.core.Command
args, context, in, mprop, out, perf, prop
 
Fields inherited from class org.basex.core.Proc
listen, updating
 
Constructor Summary
Optimize()
          Default constructor.
 
Method Summary
 java.lang.String det()
          Returns short information on this process.
static void optimize(Data data, boolean rebuild, Optimize cmd)
          Optimizes the structures of a database.
 double prog()
          Returns a progress value (0 - 1).
protected  boolean run()
          Executes the command and serializes the result (internal call).
 boolean stoppable()
          Returns true if this command can be stopped.
 
Methods inherited from class org.basex.core.cmd.ACreate
create, databases, drop, newData, sourceToIO, supportsProg
 
Methods inherited from class org.basex.core.Command
build, close, databases, error, execute, execute, getOption, getOption, info, info, result, run, run, setInput, setInput, toString, updated, updating
 
Methods inherited from class org.basex.core.Proc
abort, checkStop, detail, listen, proc, progress, registered, registered, startTimeout, stop, stopTimeout, tit, title
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Optimize

public Optimize()
Default constructor.

Method Detail

run

protected boolean run()
Description copied from class: Command
Executes the command and serializes the result (internal call).

Specified by:
run in class Command
Returns:
success of operation

prog

public double prog()
Description copied from class: Proc
Returns a progress value (0 - 1). Can be overwritten to give more detailed information.

Overrides:
prog in class Proc
Returns:
header information

stoppable

public boolean stoppable()
Description copied from class: Command
Returns true if this command can be stopped. This method is required by the progress dialog in the frontend.

Overrides:
stoppable in class ACreate
Returns:
result of check

det

public java.lang.String det()
Description copied from class: Proc
Returns short information on this process.

Overrides:
det in class Proc
Returns:
header information

optimize

public static void optimize(Data data,
                            boolean rebuild,
                            Optimize cmd)
                     throws java.io.IOException
Optimizes the structures of a database.

Parameters:
data - data
rebuild - rebuild all index structures
cmd - calling command instance (can be null)
Throws:
java.io.IOException - I/O Exception during index rebuild