public static void ReadBitmap(long bitmap, long labelId, MutableLongList[] labelsPerNode) { while (bitmap != 0) { int relativeNodeId = Long.numberOfTrailingZeros(bitmap); if (labelsPerNode[relativeNodeId] == null) { labelsPerNode[relativeNodeId] = new LongArrayList(); } labelsPerNode[relativeNodeId].add(labelId); bitmap &= bitmap - 1; } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void verifyConstraintOn(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList nodeIds, org.neo4j.storageengine.api.NodePropertyAccessor nodePropertyAccessor, org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException private static void VerifyConstraintOn(LongArrayList nodeIds, NodePropertyAccessor nodePropertyAccessor, StoreIndexDescriptor descriptor) { MutableMap <Value, long> points = Maps.mutable.empty(); MutableLongIterator iter = nodeIds.longIterator(); try { while (iter.hasNext()) { long id = iter.next(); Value value = nodePropertyAccessor.GetNodePropertyValue(id, descriptor.Schema().PropertyId); long? other = points.getIfAbsentPut(value, id); if (other.Value != id) { throw new IndexEntryConflictException(other.Value, id, value); } } } catch (EntityNotFoundException e) { throw new Exception("Failed to validate uniqueness constraint", e); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void scanAndVerifyDuplicates(org.neo4j.storageengine.api.NodePropertyAccessor nodePropertyAccessor, org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor, org.neo4j.cursor.RawCursor<org.neo4j.index.internal.gbptree.Hit<SpatialIndexKey,NativeIndexValue>,java.io.IOException> seek) throws java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException private static void ScanAndVerifyDuplicates(NodePropertyAccessor nodePropertyAccessor, StoreIndexDescriptor descriptor, RawCursor <Hit <SpatialIndexKey, NativeIndexValue>, IOException> seek) { LongArrayList nodesWithCollidingPoints = new LongArrayList(); long prevRawBits = long.MinValue; // Bootstrap starting state if (seek.Next()) { Hit <SpatialIndexKey, NativeIndexValue> hit = seek.get(); prevRawBits = hit.Key().RawValueBits; nodesWithCollidingPoints.add(hit.Key().EntityId); } while (seek.Next()) { Hit <SpatialIndexKey, NativeIndexValue> hit = seek.get(); SpatialIndexKey key = hit.Key(); long currentRawBits = key.RawValueBits; long currentNodeId = key.EntityId; if (prevRawBits != currentRawBits) { if (nodesWithCollidingPoints.size() > 1) { VerifyConstraintOn(nodesWithCollidingPoints, nodePropertyAccessor, descriptor); } nodesWithCollidingPoints.clear(); } nodesWithCollidingPoints.add(currentNodeId); prevRawBits = currentRawBits; } // Verify the last batch if needed if (nodesWithCollidingPoints.size() > 1) { VerifyConstraintOn(nodesWithCollidingPoints, nodePropertyAccessor, descriptor); } }