use of com.b2international.collections.longs.LongKeyLongMap in project snow-owl by b2ihealthcare.
the class LongTarjanTest method smallBatchSize.
@Test
public void smallBatchSize() throws Exception {
final LongKeyLongMap followerMap = PrimitiveMaps.newLongKeyLongOpenHashMap();
followerMap.put(1, 2);
followerMap.put(2, 3);
followerMap.put(3, 4);
followerMap.put(4, 1);
followerMap.put(5, 3);
followerMap.put(6, 2);
followerMap.put(7, 8);
followerMap.put(8, 6);
final LongTarjan tarjan = new LongTarjan(3, currentId -> LongCollections.singletonSet(followerMap.get(currentId)));
final List<LongSet> actual = tarjan.run(followerMap.keySet());
assertEquals(ImmutableList.of(PrimitiveSets.newLongOpenHashSet(1L, 2L, 3L, 4L), PrimitiveSets.newLongOpenHashSet(5L, 6L, 8L), PrimitiveSets.newLongOpenHashSet(7L)), actual);
}
use of com.b2international.collections.longs.LongKeyLongMap in project snow-owl by b2ihealthcare.
the class EquivalencyChecker method processResults.
@Override
protected LongKeyLongMap processResults(final String classificationId) {
final Set<String> conceptIdsToCheck = additionalConcepts.stream().map(SnomedConcept::getId).collect(Collectors.toSet());
final LongKeyLongMap equivalentConceptMap = PrimitiveMaps.newLongKeyLongOpenHashMap();
final ClassificationTask classificationTask = ClassificationRequests.prepareGetClassification(classificationId).setExpand("equivalentConceptSets()").build(repositoryId).execute(getEventBus()).getSync();
if (!ClassificationStatus.COMPLETED.equals(classificationTask.getStatus())) {
throw new ReasonerApiException("Selected reasoner could not start or failed to finish its job.");
}
if (!classificationTask.getEquivalentConceptsFound()) {
return equivalentConceptMap;
}
final EquivalentConceptSets equivalentConceptSets = classificationTask.getEquivalentConceptSets();
registerEquivalentConcepts(equivalentConceptSets, conceptIdsToCheck, equivalentConceptMap);
return equivalentConceptMap;
}
Aggregations