use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class MutableLinearProbeLongHashSetTest method frozenIterator.
@Test
void frozenIterator() {
set.addAll(1, 2, 3, 100, 200, 300);
final LongIterator iter1 = set.freeze().longIterator();
set.removeAll(1, 100);
final LongIterator iter2 = set.freeze().longIterator();
set.removeAll(2, 200);
final LongSet values1 = drain(iter1);
final LongSet values2 = drain(iter2);
assertEquals(newSetWith(1, 2, 3, 100, 200, 300), values1);
assertEquals(newSetWith(2, 3, 200, 300), values2);
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class SchemaComplianceChecker method verifyIndexedUniquely.
private <ENTITY extends PrimitiveRecord> void verifyIndexedUniquely(ENTITY entity, Value[] propertyValues, IndexDescriptor indexRule, ValueIndexReader reader, Function<ENTITY, ConsistencyReport.PrimitiveConsistencyReport> reportSupplier) {
long nodeId = entity.getId();
PropertyIndexQuery[] query = seek(indexRule.schema(), propertyValues);
LongIterator indexedNodeIds = queryIndexOrEmpty(reader, query);
long count = 0;
while (indexedNodeIds.hasNext()) {
long indexedNodeId = indexedNodeIds.next();
if (nodeId == indexedNodeId) {
count++;
} else {
reportSupplier.apply(entity).uniqueIndexNotUnique(indexRule, Values.asObjects(propertyValues), indexedNodeId);
}
}
reportIncorrectIndexCount(entity, propertyValues, indexRule, count, reportSupplier);
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class PrimitiveLongCollectionsTest method count.
@Test
void count() {
// GIVEN
LongIterator items = PrimitiveLongCollections.iterator(1, 2, 3);
// WHEN
int count = PrimitiveLongCollections.count(items);
// THEN
assertEquals(3, count);
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class PrimitiveLongCollectionsTest method filter.
@Test
void filter() {
// GIVEN
LongIterator items = PrimitiveLongCollections.iterator(1, 2, 3);
// WHEN
LongIterator filtered = PrimitiveLongCollections.filter(items, item -> item != 2);
// THEN
assertItems(filtered, 1, 3);
}
use of org.eclipse.collections.api.iterator.LongIterator in project neo4j by neo4j.
the class IndexSamplingController method indexesToSample.
private LongList indexesToSample(IndexSamplingMode mode, IndexMap indexMap) {
MutableLongList indexesToSample = LongLists.mutable.of();
LongIterator allIndexes = indexMap.indexIds();
while (allIndexes.hasNext()) {
long indexId = allIndexes.next();
if (shouldSampleIndex(mode, indexId)) {
indexesToSample.add(indexId);
}
}
return indexesToSample;
}
Aggregations