1
|
package eu.dnetlib.pace.model;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import com.google.gson.Gson;
|
6
|
import eu.dnetlib.pace.condition.*;
|
7
|
import eu.dnetlib.pace.config.Cond;
|
8
|
|
9
|
public class CondDef {
|
10
|
|
11
|
private Cond name;
|
12
|
|
13
|
private List<String> fields;
|
14
|
|
15
|
public CondDef() {}
|
16
|
|
17
|
public ConditionAlgo getConditionAlgo(final List<FieldDef> fields) {
|
18
|
switch (getName()) {
|
19
|
case yearMatch:
|
20
|
return new YearMatch(getName(), fields);
|
21
|
case titleVersionMatch:
|
22
|
return new TitleVersionMatch(getName(), fields);
|
23
|
case sizeMatch:
|
24
|
return new SizeMatch(getName(), fields);
|
25
|
case exactMatch:
|
26
|
return new ExactMatch(getName(), fields);
|
27
|
case mustBeDifferent:
|
28
|
return new MustBeDifferent(getName(), fields);
|
29
|
case exactMatchIgnoreCase:
|
30
|
return new ExactMatchIgnoreCase(getName(), fields);
|
31
|
case doiExactMatch:
|
32
|
return new DoiExactMatch(getName(), fields);
|
33
|
case pidMatch:
|
34
|
return new PidMatch(getName(), fields);
|
35
|
default:
|
36
|
return new AlwaysTrueCondition(getName(), fields);
|
37
|
}
|
38
|
}
|
39
|
|
40
|
public Cond getName() {
|
41
|
return name;
|
42
|
}
|
43
|
|
44
|
public void setName(final Cond name) {
|
45
|
this.name = name;
|
46
|
}
|
47
|
|
48
|
public List<String> getFields() {
|
49
|
return fields;
|
50
|
}
|
51
|
|
52
|
public void setFields(final List<String> fields) {
|
53
|
this.fields = fields;
|
54
|
}
|
55
|
|
56
|
@Override
|
57
|
public String toString() {
|
58
|
return new Gson().toJson(this);
|
59
|
}
|
60
|
|
61
|
}
|