use of com.b2international.collections.longs.LongIterator in project snow-owl by b2ihealthcare.
the class LongTarjan method run.
public List<LongSet> run(final LongCollection ids) {
for (final LongIterator itr = ids.iterator(); itr.hasNext(); ) /* empty */
{
final long currentId = itr.next();
indexMap.put(currentId, -1);
}
for (final LongIterator itr = ids.iterator(); itr.hasNext(); ) /* empty */
{
final long currentId = itr.next();
if (indexMap.get(currentId) == -1) {
visit(currentId, ids);
}
}
if (currentSize() > 0) {
flushBatch();
}
return components;
}
use of com.b2international.collections.longs.LongIterator in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method iterator.
@Test
public void iterator() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
longSet.add(0L);
longSet.add(5L);
longSet.add(10L);
LongIterator itr = longSet.iterator();
long[] values = new long[3];
for (int i = 0; i < 3; i++) {
assertTrue("Iterator should indicate that the next value is available.", itr.hasNext());
values[i] = itr.next();
}
assertFalse("Iterator should indicate that there are no more elements.", itr.hasNext());
Arrays.sort(values);
assertEquals("Iterator should return first element.", 0L, values[0]);
assertEquals("Iterator should return second element.", 5L, values[1]);
assertEquals("Iterator should return third element.", 10L, values[2]);
}
use of com.b2international.collections.longs.LongIterator in project snow-owl by b2ihealthcare.
the class EmptyLongListTest method iterator_empty.
@Test
public void iterator_empty() {
LongList emptyList = LongCollections.emptyList();
LongIterator itr = emptyList.iterator();
assertFalse("Iterator should indicate that there are no elements.", itr.hasNext());
}
use of com.b2international.collections.longs.LongIterator in project snow-owl by b2ihealthcare.
the class LongSets method toStringArray.
/**
* Returns with an array containing all long values as a string.
* @param collection the collection of primitive longs.
* @return an array of strings.
*/
public static String[] toStringArray(final LongCollection collection) {
checkNotNull(collection, "Long collection argument cannot be null.");
final String[] ids = new String[collection.size()];
int i = 0;
for (final LongIterator iterator = collection.iterator(); iterator.hasNext(); ) /*nothing*/
{
ids[i++] = Long.toString(iterator.next());
}
return ids;
}
use of com.b2international.collections.longs.LongIterator in project snow-owl by b2ihealthcare.
the class EquivalentConceptSetConverter method toResource.
@Override
protected EquivalentConceptSet toResource(final EquivalentConceptSetDocument entry) {
final EquivalentConceptSet resource = new EquivalentConceptSet();
resource.setClassificationId(entry.getClassificationId());
resource.setUnsatisfiable(entry.isUnsatisfiable());
final List<SnomedConcept> items = newArrayList();
for (final LongIterator itr = entry.getConceptIds().iterator(); itr.hasNext(); ) /* empty */
{
items.add(new SnomedConcept(Long.toString(itr.next())));
}
final SnomedConcepts equivalentConcepts = new SnomedConcepts(items, null, items.size(), items.size());
resource.setEquivalentConcepts(equivalentConcepts);
return resource;
}
Aggregations