Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.distance
Class AbstractMeasurementFunction<O extends DatabaseObject,D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.distance.AbstractMeasurementFunction<O,D>
Type Parameters:
D - the type of Distance used as measurement for comparing database objects
O - the type of DatabaseObject for which a measurement is provided for comparison
All Implemented Interfaces:
MeasurementFunction<O,D>
Direct Known Subclasses:
AbstractDistanceFunction, AbstractSimilarityFunction

public abstract class AbstractMeasurementFunction<O extends DatabaseObject,D extends Distance<D>>
extends AbstractLoggable
implements MeasurementFunction<O,D>

Abstract implementation of interface MeasurementFunction that provides some methods valid for any extending class.

Author:
Elke Achtert

Field Summary
private  Database<O> database
          The database that holds the objects for which the measurements should be computed.
protected  D distanceFactory
          The distance type
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
protected AbstractMeasurementFunction(D distance)
          Provides an abstract MeasurementFunction.
 
Method Summary
protected  Database<O> getDatabase()
          Returns the database holding the objects for which the measurements should be computed.
 D getDistanceFactory()
          Method to get the distance functions factory.
 D infiniteDistance()
          Provides an infinite distance.
 D nullDistance()
          Provides a null distance.
 void setDatabase(Database<O> database)
          Set the database that holds the associations for the DatabaseObject for which the measurements should be computed.
 D undefinedDistance()
          Provides an undefined distance.
 D valueOf(String val)
          Parse a string value into a distance
 
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

database

private Database<O extends DatabaseObject> database
The database that holds the objects for which the measurements should be computed.


distanceFactory

protected final D extends Distance<D> distanceFactory
The distance type

Constructor Detail

AbstractMeasurementFunction

protected AbstractMeasurementFunction(D distance)
Provides an abstract MeasurementFunction.

Parameters:
distance - Distance factory instance
Method Detail

setDatabase

public void setDatabase(Database<O> database)
Description copied from interface: MeasurementFunction
Set the database that holds the associations for the DatabaseObject for which the measurements should be computed.

Specified by:
setDatabase in interface MeasurementFunction<O extends DatabaseObject,D extends Distance<D>>
Parameters:
database - Database

getDatabase

protected Database<O> getDatabase()
Returns the database holding the objects for which the measurements should be computed.

Returns:
the database holding the objects for which the measurements should be computed

getDistanceFactory

public D getDistanceFactory()
Description copied from interface: MeasurementFunction
Method to get the distance functions factory.

Specified by:
getDistanceFactory in interface MeasurementFunction<O extends DatabaseObject,D extends Distance<D>>
Returns:
Factory for distance objects

infiniteDistance

public D infiniteDistance()
Description copied from interface: MeasurementFunction
Provides an infinite distance.

Specified by:
infiniteDistance in interface MeasurementFunction<O extends DatabaseObject,D extends Distance<D>>
Returns:
an infinite distance

nullDistance

public D nullDistance()
Description copied from interface: MeasurementFunction
Provides a null distance.

Specified by:
nullDistance in interface MeasurementFunction<O extends DatabaseObject,D extends Distance<D>>
Returns:
a null distance

undefinedDistance

public D undefinedDistance()
Description copied from interface: MeasurementFunction
Provides an undefined distance.

Specified by:
undefinedDistance in interface MeasurementFunction<O extends DatabaseObject,D extends Distance<D>>
Returns:
an undefined distance

valueOf

public D valueOf(String val)
                              throws IllegalArgumentException
Description copied from interface: MeasurementFunction
Parse a string value into a distance

Specified by:
valueOf in interface MeasurementFunction<O extends DatabaseObject,D extends Distance<D>>
Parameters:
val - input string
Returns:
parsed value
Throws:
IllegalArgumentException - on parsing error

Release 0.3 (2010-03-31_1612)