trivial: avoid duplicated code

This commit is contained in:
Claudio Atzori 2020-12-23 12:21:58 +01:00
parent d8b5f43a7e
commit 6848d0c3d7
2 changed files with 3 additions and 17 deletions

View File

@ -52,21 +52,7 @@ public class AuthorMerger {
}
public static List<Author> mergeAuthor(final List<Author> a, final List<Author> b) {
int pa = countAuthorsPids(a);
int pb = countAuthorsPids(b);
List<Author> base, enrich;
int sa = authorsSize(a);
int sb = authorsSize(b);
if (sa == sb) {
base = pa > pb ? a : b;
enrich = pa > pb ? b : a;
} else {
base = sa > sb ? a : b;
enrich = sa > sb ? b : a;
}
enrichPidFromList(base, enrich, THRESHOLD);
return base;
return mergeAuthor(a, b, THRESHOLD);
}
private static void enrichPidFromList(List<Author> base, List<Author> enrich, Double threshold) {

View File

@ -22,9 +22,9 @@ import scala.Tuple2;
public class AuthorMergerTest {
String publicationsBasePath;
private String publicationsBasePath;
List<List<Author>> authors;
private List<List<Author>> authors;
@BeforeEach
public void setUp() throws Exception {