code formatting

This commit is contained in:
Claudio Atzori 2024-07-01 09:22:35 +02:00
parent ea1841fbd2
commit b822b34abe
1 changed files with 28 additions and 27 deletions

View File

@ -1,3 +1,4 @@
package eu.dnetlib.pace.tree; package eu.dnetlib.pace.tree;
import java.util.Map; import java.util.Map;
@ -11,37 +12,37 @@ import eu.dnetlib.pace.tree.support.ComparatorClass;
@ComparatorClass("countryMatch") @ComparatorClass("countryMatch")
public class CountryMatch extends AbstractStringComparator { public class CountryMatch extends AbstractStringComparator {
public CountryMatch(Map<String, String> params) { public CountryMatch(Map<String, String> params) {
super(params, new com.wcohen.ss.JaroWinkler()); super(params, new com.wcohen.ss.JaroWinkler());
} }
public CountryMatch(final double weight) { public CountryMatch(final double weight) {
super(weight, new com.wcohen.ss.JaroWinkler()); super(weight, new com.wcohen.ss.JaroWinkler());
} }
protected CountryMatch(final double weight, final AbstractStringDistance ssalgo) { protected CountryMatch(final double weight, final AbstractStringDistance ssalgo) {
super(weight, ssalgo); super(weight, ssalgo);
} }
@Override @Override
public double distance(final String a, final String b, final Config conf) { public double distance(final String a, final String b, final Config conf) {
if (a.isEmpty() || b.isEmpty()) { if (a.isEmpty() || b.isEmpty()) {
return -1.0; // return -1 if a field is missing return -1.0; // return -1 if a field is missing
} }
if (a.equalsIgnoreCase("unknown") || b.equalsIgnoreCase("unknown")) { if (a.equalsIgnoreCase("unknown") || b.equalsIgnoreCase("unknown")) {
return -1.0; // return -1 if a country is UNKNOWN return -1.0; // return -1 if a country is UNKNOWN
} }
return a.equals(b) ? 1.0 : 0; return a.equals(b) ? 1.0 : 0;
} }
@Override @Override
public double getWeight() { public double getWeight() {
return super.weight; return super.weight;
} }
@Override @Override
protected double normalize(final double d) { protected double normalize(final double d) {
return d; return d;
} }
} }