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) { public static List<Author> mergeAuthor(final List<Author> a, final List<Author> b) {
int pa = countAuthorsPids(a); return mergeAuthor(a, b, THRESHOLD);
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;
} }
private static void enrichPidFromList(List<Author> base, List<Author> enrich, Double 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 { public class AuthorMergerTest {
String publicationsBasePath; private String publicationsBasePath;
List<List<Author>> authors; private List<List<Author>> authors;
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {