added the ignorecase option to each selection verb

This commit is contained in:
Miriam Baglioni 2020-04-27 12:31:05 +02:00
parent a303fc9f73
commit 986c97348d
6 changed files with 114 additions and 2 deletions

View File

@ -0,0 +1,28 @@
package eu.dnetlib.dhp.selectioncriteria;
import java.io.Serializable;
@VerbClass("contains_ignorecase")
public class ContainsVerbIgnoreCase implements Selection, Serializable {
private String param;
public ContainsVerbIgnoreCase() {}
public ContainsVerbIgnoreCase(final String param) {
this.param = param;
}
@Override
public boolean apply(String value) {
return value.toLowerCase().contains(param.toLowerCase());
}
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
}

View File

@ -15,7 +15,7 @@ public class EqualVerb implements Selection, Serializable {
@Override @Override
public boolean apply(String value) { public boolean apply(String value) {
return value.equalsIgnoreCase(param); return value.equals(param);
} }
public String getParam() { public String getParam() {

View File

@ -0,0 +1,28 @@
package eu.dnetlib.dhp.selectioncriteria;
import java.io.Serializable;
@VerbClass("equals_ignorecase")
public class EqualVerbIgnoreCase implements Selection, Serializable {
private String param;
public EqualVerbIgnoreCase() {}
public EqualVerbIgnoreCase(final String param) {
this.param = param;
}
@Override
public boolean apply(String value) {
return value.equalsIgnoreCase(param);
}
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
}

View File

@ -0,0 +1,28 @@
package eu.dnetlib.dhp.selectioncriteria;
import java.io.Serializable;
@VerbClass("not_contains_ignorecase")
public class NotContainsVerbIgnoreCase implements Selection, Serializable {
private String param;
public NotContainsVerbIgnoreCase() {}
public NotContainsVerbIgnoreCase(final String param) {
this.param = param;
}
@Override
public boolean apply(String value) {
return !(value.toLowerCase().contains(param.toLowerCase()));
}
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
}

View File

@ -23,6 +23,6 @@ public class NotEqualVerb implements Selection, Serializable {
@Override @Override
public boolean apply(String value) { public boolean apply(String value) {
return !value.equalsIgnoreCase(param); return !value.equals(param);
} }
} }

View File

@ -0,0 +1,28 @@
package eu.dnetlib.dhp.selectioncriteria;
import java.io.Serializable;
@VerbClass("not_equals_ignorecase")
public class NotEqualVerbIgnoreCase implements Selection, Serializable {
private String param;
public NotEqualVerbIgnoreCase(final String param) {
this.param = param;
}
public NotEqualVerbIgnoreCase() {}
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
@Override
public boolean apply(String value) {
return !value.equalsIgnoreCase(param);
}
}