forked from D-Net/dnet-hadoop
trivial: avoid duplicated code
This commit is contained in:
parent
d8b5f43a7e
commit
6848d0c3d7
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue