D
- distance type@Title(value="Number Distance Parser") @Description(value="Parser for the following line format:\nid1 id2 distanceValue, where id1 and is2 are integers representing the two ids belonging to the distance value.\n The ids and the distance value are separated by whitespace. Empty lines and lines beginning with \"#\" will be ignored.") public class NumberDistanceParser<D extends NumberDistance<D,?>> extends AbstractParser implements DistanceParser<D>
Modifier and Type | Class and Description |
---|---|
static class |
NumberDistanceParser.Parameterizer<D extends NumberDistance<D,?>>
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
private D |
distanceFactory
The distance function.
|
private static Logging |
LOG
The logger for this class.
|
ATTRIBUTE_CONCATENATION, comment, COMMENT_PATTERN, DEFAULT_SEPARATOR, NUMBER_PATTERN, QUOTE_CHARS, tokenizer
DISTANCE_ID
Constructor and Description |
---|
NumberDistanceParser(Pattern colSep,
String quoteChars,
Pattern comment,
D distanceFactory)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(DBIDRef id1,
DBIDRef id2,
Map<DBIDPair,D> cache)
Returns true if the specified distance cache contains a distance
value for the specified ids.
|
protected Logging |
getLogger()
Get the logger for this class.
|
DistanceParsingResult<D> |
parse(InputStream in)
Returns a list of the objects parsed from the specified input stream
and a list of the labels associated with the objects.
|
private void |
put(DBID id1,
DBID id2,
D distance,
Map<DBIDPair,D> cache)
Puts the specified distance value for the given ids to the distance cache.
|
lengthWithoutLinefeed, toString
private static final Logging LOG
private final D extends NumberDistance<D,?> distanceFactory
public DistanceParsingResult<D> parse(InputStream in)
DistanceParser
parse
in interface DistanceParser<D extends NumberDistance<D,?>>
in
- the stream to parse objects fromprivate void put(DBID id1, DBID id2, D distance, Map<DBIDPair,D> cache)
id1
- the first idid2
- the second iddistance
- the distance valuecache
- the distance cachepublic boolean containsKey(DBIDRef id1, DBIDRef id2, Map<DBIDPair,D> cache)
id1
- the first idid2
- the second idcache
- the distance cacheprotected Logging getLogger()
AbstractParser
getLogger
in class AbstractParser