예제 #1
0
 private static void UpdateRadix(LongArray values, Radix radix, long highestSetIndex)
 {
     for (long dataIndex = 0; dataIndex <= highestSetIndex; dataIndex++)
     {
         radix.RegisterRadixOf(values.Get(dataIndex));
     }
 }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void buildCollisionInfo(System.Func<long, Object> inputIdLookup, long pessimisticNumberOfCollisions, org.neo4j.unsafe.impl.batchimport.input.Collector collector, org.neo4j.helpers.progress.ProgressListener progress) throws InterruptedException
        private void BuildCollisionInfo(System.Func <long, object> inputIdLookup, long pessimisticNumberOfCollisions, Collector collector, ProgressListener progress)
        {
            progress.Started("RESOLVE (~" + pessimisticNumberOfCollisions + " collisions)");
            Radix radix = _radixFactory.newInstance();

            _collisionNodeIdCache  = _cacheFactory.newByteArray(pessimisticNumberOfCollisions, new sbyte[COLLISION_ENTRY_SIZE]);
            _collisionTrackerCache = _trackerFactory.create(_cacheFactory, pessimisticNumberOfCollisions);
            _collisionValues       = _collisionValuesFactory.apply(pessimisticNumberOfCollisions);
            for (long nodeId = 0; nodeId <= _highestSetIndex; nodeId++)
            {
                long eId = _dataCache.get(nodeId);
                if (IsCollision(eId))
                {
                    // Store this collision input id for matching later in get()
                    long   collisionIndex         = _numberOfCollisions++;
                    object id                     = inputIdLookup(nodeId);
                    long   eIdFromInputId         = Encode(id);
                    long   eIdWithoutCollisionBit = ClearCollision(eId);
                    Debug.Assert(eIdFromInputId == eIdWithoutCollisionBit, format("Encoding mismatch during building of " + "collision info. input id %s (a %s) marked as collision where this id was encoded into " + "%d when put, but was now encoded into %d", id, id.GetType().Name, eIdWithoutCollisionBit, eIdFromInputId));
                    long offset = _collisionValues.add(id);
                    _collisionNodeIdCache.set5ByteLong(collisionIndex, 0, nodeId);
                    _collisionNodeIdCache.set6ByteLong(collisionIndex, 5, offset);

                    // The base of our sorting this time is going to be node id, so register that in the radix
                    radix.RegisterRadixOf(eIdWithoutCollisionBit);
                }
                progress.Add(1);
            }
            progress.Done();

            // Detect input id duplicates within the same group, with source information, line number and the works
            DetectDuplicateInputIds(radix, collector, progress);

            // We won't be needing these anymore
            _collisionTrackerCache.close();
            _collisionTrackerCache = null;
        }