Package elki.database.query.similarity
Class PrimitiveSimilarityQuery<O>
- java.lang.Object
-
- elki.database.query.similarity.PrimitiveSimilarityQuery<O>
-
- Type Parameters:
O
- Database object type.
- All Implemented Interfaces:
SimilarityQuery<O>
public class PrimitiveSimilarityQuery<O> extends java.lang.Object implements SimilarityQuery<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 Relation<? extends O>
relation
The data to use for this queryprotected PrimitiveSimilarity<? super O>
similarityFunction
The distance function we use.
-
Constructor Summary
Constructors Constructor Description PrimitiveSimilarityQuery(Relation<? extends O> relation, PrimitiveSimilarity<? super O> similarityFunction)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Relation<? extends O>
getRelation()
Access the underlying data query.PrimitiveSimilarity<? super O>
getSimilarity()
Get the inner similarity function.double
similarity(DBIDRef id1, DBIDRef id2)
Returns the similarity between the two objects specified by their object ids.double
similarity(DBIDRef id1, O o2)
Returns the similarity between the two objects specified by their object ids.double
similarity(O o1, DBIDRef id2)
Returns the similarity between the two objects specified by their object ids.double
similarity(O o1, O o2)
Returns the similarity between the two objects specified by their object ids.
-
-
-
Field Detail
-
similarityFunction
protected final PrimitiveSimilarity<? super O> similarityFunction
The distance function we use.
-
-
Constructor Detail
-
PrimitiveSimilarityQuery
public PrimitiveSimilarityQuery(Relation<? extends O> relation, PrimitiveSimilarity<? super O> similarityFunction)
Constructor.- Parameters:
relation
- Relation to use.similarityFunction
- Our similarity function
-
-
Method Detail
-
similarity
public final double similarity(DBIDRef id1, DBIDRef id2)
Description copied from interface:SimilarityQuery
Returns the similarity between the two objects specified by their object ids.- Specified by:
similarity
in interfaceSimilarityQuery<O>
- Parameters:
id1
- first object idid2
- second object id- Returns:
- the similarity between the two objects specified by their object ids
-
similarity
public final double similarity(O o1, DBIDRef id2)
Description copied from interface:SimilarityQuery
Returns the similarity between the two objects specified by their object ids.- Specified by:
similarity
in interfaceSimilarityQuery<O>
- Parameters:
o1
- first objectid2
- second object id- Returns:
- the similarity between the two objects specified by their object ids
-
similarity
public final double similarity(DBIDRef id1, O o2)
Description copied from interface:SimilarityQuery
Returns the similarity between the two objects specified by their object ids.- Specified by:
similarity
in interfaceSimilarityQuery<O>
- Parameters:
id1
- first object ido2
- second object- Returns:
- the similarity between the two objects specified by their object ids
-
similarity
public double similarity(O o1, O o2)
Description copied from interface:SimilarityQuery
Returns the similarity between the two objects specified by their object ids.- Specified by:
similarity
in interfaceSimilarityQuery<O>
- Parameters:
o1
- first objecto2
- second object- Returns:
- the similarity between the two objects specified by their object ids
-
getRelation
public Relation<? extends O> getRelation()
Description copied from interface:SimilarityQuery
Access the underlying data query.- Specified by:
getRelation
in interfaceSimilarityQuery<O>
- Returns:
- data query in use
-
getSimilarity
public PrimitiveSimilarity<? super O> getSimilarity()
Description copied from interface:SimilarityQuery
Get the inner similarity function.- Specified by:
getSimilarity
in interfaceSimilarityQuery<O>
- Returns:
- Similarity function
-
-