1
|
package eu.dnetlib.pace.distance.algo;
|
2
|
|
3
|
import java.util.Collections;
|
4
|
import java.util.List;
|
5
|
|
6
|
import com.google.common.collect.Lists;
|
7
|
import com.wcohen.ss.AbstractStringDistance;
|
8
|
|
9
|
import eu.dnetlib.pace.distance.SecondStringDistanceAlgo;
|
10
|
import eu.dnetlib.pace.model.Field;
|
11
|
import eu.dnetlib.pace.model.FieldList;
|
12
|
|
13
|
/**
|
14
|
* For the rest of the fields delegate the distance measure to the second string library.
|
15
|
*/
|
16
|
public abstract class SortedSecondStringDistanceAlgo extends SecondStringDistanceAlgo {
|
17
|
|
18
|
/**
|
19
|
* Instantiates a new sorted second string distance algo.
|
20
|
*
|
21
|
* @param weight
|
22
|
* the weight
|
23
|
* @param ssalgo
|
24
|
* the ssalgo
|
25
|
*/
|
26
|
protected SortedSecondStringDistanceAlgo(final double weight, final AbstractStringDistance ssalgo) {
|
27
|
super(weight, ssalgo);
|
28
|
}
|
29
|
|
30
|
/*
|
31
|
* (non-Javadoc)
|
32
|
*
|
33
|
* @see eu.dnetlib.pace.distance.SecondStringDistanceAlgo#toList(eu.dnetlib.pace.model.Field)
|
34
|
*/
|
35
|
@Override
|
36
|
protected List<String> toList(final Field list) {
|
37
|
FieldList fl = (FieldList) list;
|
38
|
List<String> values = Lists.newArrayList(fl.stringList());
|
39
|
Collections.sort(values);
|
40
|
return values;
|
41
|
}
|
42
|
|
43
|
}
|