use of com.b2international.collections.ints.IntSet in project snow-owl by b2ihealthcare.
the class IntOpenHashSetTest method retainAll_disjoint_set.
@Test
public void retainAll_disjoint_set() {
IntSet intSet = PrimitiveSets.newIntOpenHashSet();
IntSet otherSet = PrimitiveSets.newIntOpenHashSet();
intSet.add(0);
intSet.add(5);
intSet.add(10);
otherSet.add(2);
otherSet.add(3);
otherSet.add(4);
intSet.retainAll(otherSet);
assertTrue("Integer set should be empty after retaining a disjoint set of elements.", intSet.isEmpty());
}
use of com.b2international.collections.ints.IntSet in project snow-owl by b2ihealthcare.
the class NormalFormGroupSet method fillNumbers.
public void fillNumbers() {
final IntSet numbersUsed = PrimitiveSets.newIntOpenHashSetWithExpectedSize(groups.size());
this.groups.stream().filter(group -> group.getGroupNumber() > 0).forEachOrdered(group -> numbersUsed.add(group.getGroupNumber()));
int groupNumber = 1;
for (final NormalFormGroup group : groups) {
if (group.getGroupNumber() == NormalFormGroup.UNKOWN_GROUP) {
while (numbersUsed.contains(groupNumber)) {
groupNumber++;
}
group.setGroupNumber(groupNumber);
groupNumber++;
}
// Always check if there are any union groups that need numbers
group.fillNumbers();
}
}
use of com.b2international.collections.ints.IntSet in project snow-owl by b2ihealthcare.
the class InternalSctIdMultimap method get.
@Override
public LongSet get(final long key) {
final int internalId = internalIdMap.getInternalId(key);
if (internalId == InternalIdMap.NO_INTERNAL_ID) {
return PrimitiveSets.newLongOpenHashSet();
}
final IntSet values = internalIdMultimap.get(internalId);
if (values == null) {
return PrimitiveSets.newLongOpenHashSet();
} else {
final LongSet sctIdValues = PrimitiveSets.newLongOpenHashSetWithExpectedSize(values.size());
for (final IntIterator itr = values.iterator(); itr.hasNext(); ) /*empty*/
{
final int valueInternalId = itr.next();
final long valueSctId = internalIdMap.getSctId(valueInternalId);
sctIdValues.add(valueSctId);
}
return sctIdValues;
}
}
Aggregations