Search in sources :

Example 31 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class NormalFormRelationship method hasCommonExhaustiveSuperType.

private boolean hasCommonExhaustiveSuperType(final NormalFormRelationship other) {
    final InternalIdEdges inferredAncestors = reasonerTaxonomy.getInferredAncestors();
    final LongSet valueAncestors = inferredAncestors.getDestinations(getDestinationId(), false);
    final LongSet otherValueAncestors = inferredAncestors.getDestinations(other.getDestinationId(), false);
    final LongSet commonAncestors = LongSets.intersection(valueAncestors, otherValueAncestors);
    for (final LongIterator itr = commonAncestors.iterator(); itr.hasNext(); ) /* empty */
    {
        final long commonAncestor = itr.next();
        if (isExhaustive(commonAncestor)) {
            return true;
        }
    }
    return false;
}
Also used : InternalIdEdges(com.b2international.snowowl.snomed.datastore.index.taxonomy.InternalIdEdges) LongSet(com.b2international.collections.longs.LongSet) LongIterator(com.b2international.collections.longs.LongIterator)

Example 32 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class LongOpenHashSetTest method create_null_array.

@Test
public void create_null_array() {
    LongSet longSet = PrimitiveSets.newLongOpenHashSet((long[]) null);
    assertTrue("Long set should be empty.", longSet.isEmpty());
}
Also used : LongSet(com.b2international.collections.longs.LongSet) Test(org.junit.Test)

Example 33 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class LongOpenHashSetTest method retainAll_null.

@Test(expected = NullPointerException.class)
public void retainAll_null() {
    LongSet longSet = PrimitiveSets.newLongOpenHashSet();
    longSet.add(0L);
    longSet.add(5L);
    longSet.add(10L);
    longSet.retainAll(null);
}
Also used : LongSet(com.b2international.collections.longs.LongSet) Test(org.junit.Test)

Example 34 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class LongOpenHashSetTest method create_fill_factor.

@Test
public void create_fill_factor() {
    LongSet longSet = PrimitiveSets.newLongOpenHashSetWithExpectedSize(10, 0.5d);
    assertTrue("Long set should be empty.", longSet.isEmpty());
}
Also used : LongSet(com.b2international.collections.longs.LongSet) Test(org.junit.Test)

Example 35 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class LongOpenHashSetTest method create_null_collection.

@Test
public void create_null_collection() {
    LongSet longSet = PrimitiveSets.newLongOpenHashSet((LongCollection) null);
    assertTrue("Long set should be empty.", longSet.isEmpty());
}
Also used : LongSet(com.b2international.collections.longs.LongSet) Test(org.junit.Test)

Aggregations

LongSet (com.b2international.collections.longs.LongSet)63 Test (org.junit.Test)46 LongIterator (com.b2international.collections.longs.LongIterator)9 PrimitiveSets (com.b2international.collections.PrimitiveSets)3 LongList (com.b2international.collections.longs.LongList)3 Concepts (com.b2international.snowowl.snomed.common.SnomedConstants.Concepts)3 ImmutableList (com.google.common.collect.ImmutableList)3 Sets (com.google.common.collect.Sets)3 Collection (java.util.Collection)3 PrimitiveMaps (com.b2international.collections.PrimitiveMaps)2 IntIterator (com.b2international.collections.ints.IntIterator)2 LongKeyMap (com.b2international.collections.longs.LongKeyMap)2 LongSets (com.b2international.commons.collect.LongSets)2 CycleDetectedException (com.b2international.commons.exceptions.CycleDetectedException)2 RelationshipValue (com.b2international.snowowl.snomed.core.domain.RelationshipValue)2 ConcreteDomainFragment (com.b2international.snowowl.snomed.datastore.ConcreteDomainFragment)2 StatementFragment (com.b2international.snowowl.snomed.datastore.StatementFragment)2 StatementFragmentWithDestination (com.b2international.snowowl.snomed.datastore.StatementFragmentWithDestination)2 StatementFragmentWithValue (com.b2international.snowowl.snomed.datastore.StatementFragmentWithValue)2 List (java.util.List)2