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) {
|
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) {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue