@Title(value="File based float distance for database objects.") @Description(value="Loads float distance values from an external text file.") public class FileBasedFloatDistanceFunction extends AbstractDBIDDistanceFunction<FloatDistance>
NumberDistanceParser
for the default input format.Modifier and Type | Class and Description |
---|---|
static class |
FileBasedFloatDistanceFunction.Parameterizer
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
private Map<DBIDPair,FloatDistance> |
cache
The distance cache
|
static OptionID |
MATRIX_ID
Parameter that specifies the name of the distance matrix file.
|
static OptionID |
PARSER_ID
Optional parameter to specify the parsers to provide a database, must
extend
DistanceParser . |
Constructor and Description |
---|
FileBasedFloatDistanceFunction(DistanceParser<FloatDistance> parser,
File matrixfile)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
FloatDistance |
distance(DBIDRef id1,
DBIDRef id2)
Returns the distance between the two objects specified by their objects
ids.
|
boolean |
equals(Object obj) |
FloatDistance |
getDistanceFactory()
Method to get the distance functions factory.
|
private void |
loadCache(DistanceParser<FloatDistance> parser,
File matrixfile) |
getInputTypeRestriction, instantiate, isMetric, isSymmetric
public static final OptionID MATRIX_ID
Key: -distance.matrix
public static final OptionID PARSER_ID
DistanceParser
. If this parameter is not set,
NumberDistanceParser
is used as parser for all input files.
Key: -distance.parser
private Map<DBIDPair,FloatDistance> cache
public FileBasedFloatDistanceFunction(DistanceParser<FloatDistance> parser, File matrixfile)
parser
- Parsermatrixfile
- input filepublic FloatDistance distance(DBIDRef id1, DBIDRef id2)
distance
in interface DBIDDistanceFunction<FloatDistance>
distance
in class AbstractDBIDDistanceFunction<FloatDistance>
id1
- first object idid2
- second object idprivate void loadCache(DistanceParser<FloatDistance> parser, File matrixfile) throws IOException
IOException
public FloatDistance getDistanceFactory()
DistanceFunction
getDistanceFactory
in interface DistanceFunction<DBID,FloatDistance>
getDistanceFactory
in class AbstractDBIDDistanceFunction<FloatDistance>