1
|
package eu.dnetlib.pace.condition;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import eu.dnetlib.pace.model.Field;
|
6
|
import eu.dnetlib.pace.model.FieldDef;
|
7
|
|
8
|
/**
|
9
|
* Returns true if the titles in the given documents contains the same numbers, false otherwise.
|
10
|
*
|
11
|
* @author claudio
|
12
|
*
|
13
|
*/
|
14
|
public class TitleVersionMatch extends AbstractCondition {
|
15
|
|
16
|
public TitleVersionMatch(final List<FieldDef> fields) {
|
17
|
super(fields);
|
18
|
}
|
19
|
|
20
|
@Override
|
21
|
protected int verify(final FieldDef fd, final Field a, final Field b) {
|
22
|
final String valueA = getFirstValue(a);
|
23
|
final String valueB = getFirstValue(b);
|
24
|
|
25
|
return notNull(valueA) && notNull(valueB) && !checkNumbers(valueA, valueB) ? 1 : -1;
|
26
|
}
|
27
|
|
28
|
@Override
|
29
|
public String toString() {
|
30
|
return getClass().getSimpleName() + ":" + super.toString();
|
31
|
}
|
32
|
|
33
|
}
|