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>
distanceFunction
The distance function we use.protected Relation<? extends O>
relation
The 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 double
distance(DBIDRef id1, DBIDRef id2)
Returns the distance between the two objects specified by their object ids.double
distance(DBIDRef id1, O o2)
Returns the distance between the two objects specified by their object ids.double
distance(O o1, DBIDRef id2)
Returns the distance between the two objects specified by their object ids.double
distance(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:DistanceQuery
Returns the distance between the two objects specified by their object ids.- Specified by:
distance
in 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:DistanceQuery
Returns the distance between the two objects specified by their object ids.- Specified by:
distance
in 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:DistanceQuery
Returns the distance between the two objects specified by their object ids.- Specified by:
distance
in 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:DistanceQuery
Returns the distance between the two objects specified by their object ids.- Specified by:
distance
in 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:DistanceQuery
Access the underlying data query.- Specified by:
getRelation
in interfaceDistanceQuery<O>
- Returns:
- data query in use
-
getDistance
public PrimitiveDistance<? super O> getDistance()
Description copied from interface:DistanceQuery
Get the inner distance function.- Specified by:
getDistance
in interfaceDistanceQuery<O>
- Returns:
- Distance function
-
-