2023-07-06 10:28:53 +02:00
|
|
|
|
2019-08-09 15:41:49 +02:00
|
|
|
package eu.dnetlib.pace.tree;
|
|
|
|
|
2023-07-06 10:28:53 +02:00
|
|
|
import java.util.Map;
|
|
|
|
|
2019-10-29 16:38:42 +01:00
|
|
|
import eu.dnetlib.pace.config.Config;
|
2023-07-18 11:38:56 +02:00
|
|
|
import eu.dnetlib.pace.tree.support.AbstractStringComparator;
|
2019-08-09 15:41:49 +02:00
|
|
|
import eu.dnetlib.pace.tree.support.ComparatorClass;
|
|
|
|
|
|
|
|
@ComparatorClass("exactMatchIgnoreCase")
|
2023-07-18 11:38:56 +02:00
|
|
|
public class ExactMatchIgnoreCase extends AbstractStringComparator {
|
2019-08-09 15:41:49 +02:00
|
|
|
|
2023-07-06 10:28:53 +02:00
|
|
|
public ExactMatchIgnoreCase(Map<String, String> params) {
|
|
|
|
super(params);
|
|
|
|
}
|
2019-08-09 15:41:49 +02:00
|
|
|
|
2023-07-06 10:28:53 +02:00
|
|
|
@Override
|
2023-07-18 11:38:56 +02:00
|
|
|
public double compare(String a, String b, final Config conf) {
|
2019-08-09 15:41:49 +02:00
|
|
|
|
2023-07-18 11:38:56 +02:00
|
|
|
if (a.isEmpty() || b.isEmpty())
|
2023-07-06 10:28:53 +02:00
|
|
|
return -1;
|
2019-08-09 15:41:49 +02:00
|
|
|
|
2023-07-18 11:38:56 +02:00
|
|
|
return a.equalsIgnoreCase(b) ? 1 : 0;
|
2023-07-06 10:28:53 +02:00
|
|
|
}
|
2019-08-09 15:41:49 +02:00
|
|
|
|
2023-07-18 11:38:56 +02:00
|
|
|
protected String toString(final Object object) {
|
|
|
|
return toFirstString(object);
|
2023-07-06 10:28:53 +02:00
|
|
|
}
|
|
|
|
}
|