From 6848d0c3d7fa5230efd26b28c9e3d25e3465a45c Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Wed, 23 Dec 2020 12:21:58 +0100 Subject: [PATCH] trivial: avoid duplicated code --- .../eu/dnetlib/dhp/oa/merge/AuthorMerger.java | 16 +--------------- .../dnetlib/dhp/oa/merge/AuthorMergerTest.java | 4 ++-- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/dhp-common/src/main/java/eu/dnetlib/dhp/oa/merge/AuthorMerger.java b/dhp-common/src/main/java/eu/dnetlib/dhp/oa/merge/AuthorMerger.java index b3d84c40f..0b602b774 100644 --- a/dhp-common/src/main/java/eu/dnetlib/dhp/oa/merge/AuthorMerger.java +++ b/dhp-common/src/main/java/eu/dnetlib/dhp/oa/merge/AuthorMerger.java @@ -52,21 +52,7 @@ public class AuthorMerger { } public static List mergeAuthor(final List a, final List b) { - int pa = countAuthorsPids(a); - int pb = countAuthorsPids(b); - List 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 base, List enrich, Double threshold) { diff --git a/dhp-common/src/test/java/eu/dnetlib/dhp/oa/merge/AuthorMergerTest.java b/dhp-common/src/test/java/eu/dnetlib/dhp/oa/merge/AuthorMergerTest.java index 02e694770..d7b3bc36f 100644 --- a/dhp-common/src/test/java/eu/dnetlib/dhp/oa/merge/AuthorMergerTest.java +++ b/dhp-common/src/test/java/eu/dnetlib/dhp/oa/merge/AuthorMergerTest.java @@ -22,9 +22,9 @@ import scala.Tuple2; public class AuthorMergerTest { - String publicationsBasePath; + private String publicationsBasePath; - List> authors; + private List> authors; @BeforeEach public void setUp() throws Exception {