Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.preprocessing
Class PreprocessorHandler<O extends DatabaseObject,P extends Preprocessor<O>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.preprocessing.PreprocessorHandler<O,P>
Type Parameters:
O - the type of DatabaseObject to run the Preprocessor on
P - the type of Preprocessor used
All Implemented Interfaces:
DatabaseListener

public class PreprocessorHandler<O extends DatabaseObject,P extends Preprocessor<O>>
extends AbstractLoggable
implements DatabaseListener

Handler class for all objects (e.g. distance functions) using a preprocessor running on a certain database.

Author:
Elke Achtert

Field Summary
private  AssociationID<?> associationID
          The association ID for the association to be set by the preprocessor.
private  Database<O> database
          The database to run the preprocessor on.
private  boolean omit
          Holds the value of OMIT_PREPROCESSING_FLAG.
private  Flag OMIT_PREPROCESSING_FLAG
          Flag to omit (a new) preprocessing if for each object the association has already been set.
static OptionID OMIT_PREPROCESSING_ID
          OptionID for OMIT_PREPROCESSING_FLAG
private  P preprocessor
          Holds the instance of the preprocessor specified by PREPROCESSOR_PARAM.
static OptionID PREPROCESSOR_ID
          OptionID for PREPROCESSOR_PARAM
private  ObjectParameter<P> PREPROCESSOR_PARAM
          Parameter to specify the preprocessor to be used, must extend at least Preprocessor.
private  boolean time
          Indicates if the time flag is set for preprocessing.
private  boolean verbose
          Indicates if the verbose flag is set for preprocessing.
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
PreprocessorHandler(Parameterization config, PreprocessorClient<P,O> preprocessorClient)
          Constructor, supporting Parameterizable
 
Method Summary
 P getPreprocessor()
          Returns the preprocessor.
 void objectsChanged(DatabaseEvent e)
          Invoked after objects of the database have been updated in some way.
 void objectsInserted(DatabaseEvent e)
          Invoked after an object has been inserted into the database.
 void objectsRemoved(DatabaseEvent e)
          Invoked after an object has been deleted from the database.
 void runPreprocessor(Database<O> database)
          Runs the preprocessor on the database if the omit flag is not set or the database does contain the association id neither for any id nor as global association.
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREPROCESSOR_ID

public static final OptionID PREPROCESSOR_ID
OptionID for PREPROCESSOR_PARAM


PREPROCESSOR_PARAM

private final ObjectParameter<P extends Preprocessor<O>> PREPROCESSOR_PARAM
Parameter to specify the preprocessor to be used, must extend at least Preprocessor.

Key: -distancefunction.preprocessor


preprocessor

private P extends Preprocessor<O> preprocessor
Holds the instance of the preprocessor specified by PREPROCESSOR_PARAM.


OMIT_PREPROCESSING_ID

public static final OptionID OMIT_PREPROCESSING_ID
OptionID for OMIT_PREPROCESSING_FLAG


OMIT_PREPROCESSING_FLAG

private final Flag OMIT_PREPROCESSING_FLAG
Flag to omit (a new) preprocessing if for each object the association has already been set.

Key: -distancefunction.omitPreprocessing


omit

private boolean omit
Holds the value of OMIT_PREPROCESSING_FLAG.


associationID

private AssociationID<?> associationID
The association ID for the association to be set by the preprocessor.


verbose

private boolean verbose
Indicates if the verbose flag is set for preprocessing.


time

private boolean time
Indicates if the time flag is set for preprocessing.


database

private Database<O extends DatabaseObject> database
The database to run the preprocessor on.

Constructor Detail

PreprocessorHandler

public PreprocessorHandler(Parameterization config,
                           PreprocessorClient<P,O> preprocessorClient)
Constructor, supporting Parameterizable

Parameters:
config - Parameterization
preprocessorClient - the class using this handler
Method Detail

objectsChanged

public void objectsChanged(DatabaseEvent e)
Invoked after objects of the database have been updated in some way. Runs the preprocessor if OMIT_PREPROCESSING_FLAG is not set.

Specified by:
objectsChanged in interface DatabaseListener
Parameters:
e - unused

objectsInserted

public void objectsInserted(DatabaseEvent e)
Invoked after an object has been inserted into the database. Runs the preprocessor if OMIT_PREPROCESSING_FLAG is not set.

Specified by:
objectsInserted in interface DatabaseListener
Parameters:
e - unused

objectsRemoved

public void objectsRemoved(DatabaseEvent e)
Invoked after an object has been deleted from the database. Runs the preprocessor if OMIT_PREPROCESSING_FLAG is not set.

Specified by:
objectsRemoved in interface DatabaseListener
Parameters:
e - unused

getPreprocessor

public P getPreprocessor()
Returns the preprocessor.

Returns:
the instance of the preprocessor specified by PREPROCESSOR_PARAM

runPreprocessor

public void runPreprocessor(Database<O> database)
Runs the preprocessor on the database if the omit flag is not set or the database does contain the association id neither for any id nor as global association.

Parameters:
database - the database to run the preprocessor on

Release 0.3 (2010-03-31_1612)