Package elki.database.query.distance
Class PrimitiveDistanceQuery<O>
- java.lang.Object
-
- elki.database.query.distance.PrimitiveDistanceQuery<O>
-
- Type Parameters:
O- Database object type.
- All Implemented Interfaces:
DistanceQuery<O>
- Direct Known Subclasses:
PrimitiveDistanceSimilarityQuery,SpatialPrimitiveDistanceQuery
public class PrimitiveDistanceQuery<O> extends java.lang.Object implements DistanceQuery<O>
Run a database query in a database context.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description protected PrimitiveDistance<? super O>distanceFunctionThe distance function we use.protected Relation<? extends O>relationThe data to use for this query
-
Constructor Summary
Constructors Constructor Description PrimitiveDistanceQuery(Relation<? extends O> relation, PrimitiveDistance<? super O> distanceFunction)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledistance(DBIDRef id1, DBIDRef id2)Returns the distance between the two objects specified by their object ids.doubledistance(DBIDRef id1, O o2)Returns the distance between the two objects specified by their object ids.doubledistance(O o1, DBIDRef id2)Returns the distance between the two objects specified by their object ids.doubledistance(O o1, O o2)Returns the distance between the two objects specified by their object ids.PrimitiveDistance<? super O>getDistance()Get the inner distance function.Relation<? extends O>getRelation()Access the underlying data query.
-
-
-
Field Detail
-
distanceFunction
protected final PrimitiveDistance<? super O> distanceFunction
The distance function we use.
-
-
Constructor Detail
-
PrimitiveDistanceQuery
public PrimitiveDistanceQuery(Relation<? extends O> relation, PrimitiveDistance<? super O> distanceFunction)
Constructor.- Parameters:
relation- Representation to use.distanceFunction- Our distance function
-
-
Method Detail
-
distance
public final double distance(DBIDRef id1, DBIDRef id2)
Description copied from interface:DistanceQueryReturns the distance between the two objects specified by their object ids.- Specified by:
distancein interfaceDistanceQuery<O>- Parameters:
id1- first object idid2- second object id- Returns:
- the distance between the two objects specified by their object ids
-
distance
public final double distance(O o1, DBIDRef id2)
Description copied from interface:DistanceQueryReturns the distance between the two objects specified by their object ids.- Specified by:
distancein interfaceDistanceQuery<O>- Parameters:
o1- first objectid2- second object id- Returns:
- the distance between the two objects specified by their object ids
-
distance
public final double distance(DBIDRef id1, O o2)
Description copied from interface:DistanceQueryReturns the distance between the two objects specified by their object ids.- Specified by:
distancein interfaceDistanceQuery<O>- Parameters:
id1- first object ido2- second object- Returns:
- the distance between the two objects specified by their object ids
-
distance
public double distance(O o1, O o2)
Description copied from interface:DistanceQueryReturns the distance between the two objects specified by their object ids.- Specified by:
distancein interfaceDistanceQuery<O>- Parameters:
o1- first objecto2- second object- Returns:
- the distance between the two objects specified by their object ids
-
getRelation
public Relation<? extends O> getRelation()
Description copied from interface:DistanceQueryAccess the underlying data query.- Specified by:
getRelationin interfaceDistanceQuery<O>- Returns:
- data query in use
-
getDistance
public PrimitiveDistance<? super O> getDistance()
Description copied from interface:DistanceQueryGet the inner distance function.- Specified by:
getDistancein interfaceDistanceQuery<O>- Returns:
- Distance function
-
-