de.lmu.ifi.dbs.elki.index.preprocessed.knn
Class AbstractMaterializeKNNPreprocessor<O,D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.index.AbstractIndex<O>
      extended by de.lmu.ifi.dbs.elki.index.preprocessed.AbstractPreprocessorIndex<O,List<DistanceResultPair<D>>>
          extended by de.lmu.ifi.dbs.elki.index.preprocessed.knn.AbstractMaterializeKNNPreprocessor<O,D>
Type Parameters:
O - Object type
D - Distance type
All Implemented Interfaces:
Index, KNNIndex<O>, Result
Direct Known Subclasses:
MaterializeKNNPreprocessor, MetricalIndexApproximationMaterializeKNNPreprocessor, PartitionApproximationMaterializeKNNPreprocessor, SpatialApproximationMaterializeKNNPreprocessor

public abstract class AbstractMaterializeKNNPreprocessor<O,D extends Distance<D>>
extends AbstractPreprocessorIndex<O,List<DistanceResultPair<D>>>
implements KNNIndex<O>

Abstract base class for KNN Preprocessors.


Nested Class Summary
static class AbstractMaterializeKNNPreprocessor.Factory<O,D extends Distance<D>>
          The parameterizable factory.
 
Field Summary
protected  DistanceFunction<? super O,D> distanceFunction
          The distance function to be used.
protected  DistanceQuery<O,D> distanceQuery
          The distance query we used.
protected  int k
          The query k value.
protected  EventListenerList listenerList
          Holds the listener.
 
Fields inherited from class de.lmu.ifi.dbs.elki.index.preprocessed.AbstractPreprocessorIndex
storage
 
Fields inherited from class de.lmu.ifi.dbs.elki.index.AbstractIndex
relation
 
Constructor Summary
AbstractMaterializeKNNPreprocessor(Relation<O> relation, DistanceFunction<? super O,D> distanceFunction, int k)
          Constructor.
 
Method Summary
 D getDistanceFactory()
          Get the distance factory.
 DistanceQuery<O,D> getDistanceQuery()
          The distance query we used.
 int getK()
          Get the value of 'k' supported by this preprocessor.
<S extends Distance<S>>
KNNQuery<O,S>
getKNNQuery(DistanceQuery<O,S> distanceQuery, Object... hints)
          Get a KNN query object for the given distance query and k.
protected abstract  void preprocess()
          Perform the preprocessing step.
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.preprocessed.AbstractPreprocessorIndex
getLogger
 
Methods inherited from class de.lmu.ifi.dbs.elki.index.AbstractIndex
delete, deleteAll, getLongName, getPageFileStatistics, getShortName, insert, insertAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.index.Index
delete, deleteAll, getPageFileStatistics, insert, insertAll
 
Methods inherited from interface de.lmu.ifi.dbs.elki.result.Result
getLongName, getShortName
 

Field Detail

k

protected final int k
The query k value.


distanceFunction

protected final DistanceFunction<? super O,D extends Distance<D>> distanceFunction
The distance function to be used.


distanceQuery

protected final DistanceQuery<O,D extends Distance<D>> distanceQuery
The distance query we used.


listenerList

protected final EventListenerList listenerList
Holds the listener.

Constructor Detail

AbstractMaterializeKNNPreprocessor

public AbstractMaterializeKNNPreprocessor(Relation<O> relation,
                                          DistanceFunction<? super O,D> distanceFunction,
                                          int k)
Constructor.

Parameters:
relation - Relation
distanceFunction - Distance function
k - k
Method Detail

getDistanceFactory

public D getDistanceFactory()
Get the distance factory.

Returns:
distance factory

getDistanceQuery

public DistanceQuery<O,D> getDistanceQuery()
The distance query we used.

Returns:
Distance query

getK

public int getK()
Get the value of 'k' supported by this preprocessor.

Returns:
k

preprocess

protected abstract void preprocess()
Perform the preprocessing step.


getKNNQuery

public <S extends Distance<S>> KNNQuery<O,S> getKNNQuery(DistanceQuery<O,S> distanceQuery,
                                                         Object... hints)
Description copied from interface: KNNIndex
Get a KNN query object for the given distance query and k. This function MAY return null, when the given distance is not supported!

Specified by:
getKNNQuery in interface KNNIndex<O>
Type Parameters:
S - Distance type
Parameters:
distanceQuery - Distance query
hints - Hints for the optimizer
Returns:
KNN Query object or null

Release 0.4.0 (2011-09-20_1324)