code formatting

This commit is contained in:
Claudio Atzori 2020-05-26 09:54:13 +02:00
parent e87eca9300
commit 7b288a94cb
2 changed files with 9 additions and 8 deletions

View File

@ -244,20 +244,20 @@ public class Result extends OafEntity implements Serializable {
subject = mergeLists(subject, r.getSubject());
//merge title lists: main title with higher trust and distinct between the others
// merge title lists: main title with higher trust and distinct between the others
StructuredProperty baseMainTitle = null;
if(title != null) {
if (title != null) {
baseMainTitle = getMainTitle(title);
title.remove(baseMainTitle);
}
StructuredProperty newMainTitle = null;
if(r.getTitle() != null) {
if (r.getTitle() != null) {
newMainTitle = getMainTitle(r.getTitle());
r.getTitle().remove(newMainTitle);
}
if (newMainTitle != null && compareTrust(this, r) < 0 )
if (newMainTitle != null && compareTrust(this, r) < 0)
baseMainTitle = newMainTitle;
title = mergeLists(title, r.getTitle());
@ -314,8 +314,9 @@ public class Result extends OafEntity implements Serializable {
}
private StructuredProperty getMainTitle(List<StructuredProperty> titles) {
//need to check if the list of titles contains more than 1 main title? (in that case, we should chose which main title select in the list)
for (StructuredProperty title: titles) {
// need to check if the list of titles contains more than 1 main title? (in that case, we should chose which
// main title select in the list)
for (StructuredProperty title : titles) {
if (title.getQualifier() != null && title.getQualifier().getClassid() != null)
if (title.getQualifier().getClassid().equals("main title"))
return title;

View File

@ -91,9 +91,9 @@ public class EntityMergerTest implements Serializable {
assertEquals(pub_merged.getAuthor().size(), 9);
assertEquals(AuthorMerger.countAuthorsPids(pub_merged.getAuthor()), 4);
//verify title
// verify title
int count = 0;
for (StructuredProperty title: pub_merged.getTitle()){
for (StructuredProperty title : pub_merged.getTitle()) {
if (title.getQualifier().getClassid().equals("main title"))
count++;
}