@Title(value="File based double distance for database objects.") @Description(value="Loads double distance values from an external text file.") public class FileBasedDoubleDistanceFunction extends AbstractDBIDDistanceFunction<DoubleDistance>
Modifier and Type | Class and Description |
---|---|
static class |
FileBasedDoubleDistanceFunction.Parameterizer
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
private Map<DBIDPair,DoubleDistance> |
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 |
---|
FileBasedDoubleDistanceFunction(DistanceParser<DoubleDistance> parser,
File matrixfile)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
DoubleDistance |
distance(DBID id1,
DBID id2)
Returns the distance between the two objects specified by their objects
ids.
|
boolean |
equals(Object obj) |
DoubleDistance |
getDistanceFactory()
Method to get the distance functions factory.
|
DBIDs |
getIDs()
Return a collection of all IDs in the cache.
|
private void |
loadCache(DistanceParser<DoubleDistance> 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,DoubleDistance> cache
public FileBasedDoubleDistanceFunction(DistanceParser<DoubleDistance> parser, File matrixfile)
parser
- Parsermatrixfile
- input filepublic DoubleDistance distance(DBID id1, DBID id2)
distance
in interface DBIDDistanceFunction<DoubleDistance>
distance
in class AbstractDBIDDistanceFunction<DoubleDistance>
id1
- first object idid2
- second object idprivate void loadCache(DistanceParser<DoubleDistance> parser, File matrixfile) throws IOException
IOException
public DBIDs getIDs()
public DoubleDistance getDistanceFactory()
DistanceFunction
getDistanceFactory
in interface DistanceFunction<DBID,DoubleDistance>
getDistanceFactory
in class AbstractDBIDDistanceFunction<DoubleDistance>