コード例 #1
0
            internal virtual ImmutableLongList GenerateKeyCollisions(int n)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long seed = rnd.nextLong();
                long seed = outerInstance.rnd.NextLong();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.list.primitive.MutableLongList elements;
                MutableLongList elements;

                using (LinearProbeLongLongHashMap s = new LinearProbeLongLongHashMap(outerInstance.memoryAllocator))
                {
                    long v = s.HashAndMask(seed);
                    while (s.HashAndMask(v) != 0 || v == 0 || v == 1)
                    {
                        ++v;
                    }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int h = s.hashAndMask(v);
                    int h = s.HashAndMask(v);
                    elements = LongLists.mutable.with(v);

                    while (elements.size() < n)
                    {
                        ++v;
                        if (s.HashAndMask(v) == h)
                        {
                            elements.add(v);
                        }
                    }
                }
                return(elements.toImmutable());
            }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void rehashWhenTooManyRemovals()
        internal virtual void RehashWhenTooManyRemovals()
        {
            _map = spy(_map);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int numOfElements = DEFAULT_CAPACITY / 2;
            int numOfElements = DEFAULT_CAPACITY / 2;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int removalsToTriggerRehashing = (int)(DEFAULT_CAPACITY * REMOVALS_FACTOR);
            int removalsToTriggerRehashing = ( int )(DEFAULT_CAPACITY * REMOVALS_FACTOR);

            for (int i = 0; i < numOfElements; i++)
            {
                _map.put(100 + i, i);
            }

            assertEquals(numOfElements, _map.size());
            verify(_map, never()).rehashWithoutGrow();
            verify(_map, never()).growAndRehash();

            for (int i = 0; i < removalsToTriggerRehashing; i++)
            {
                _map.remove(100 + i);
            }

            assertEquals(numOfElements - removalsToTriggerRehashing, _map.size());
            verify(_map).rehashWithoutGrow();
            verify(_map, never()).growAndRehash();
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void grow()
        internal virtual void Grow()
        {
            _map = spy(_map);

            for (int i = 0; i < DEFAULT_CAPACITY; i++)
            {
                _map.put(100 + i, i);
            }
            verify(_map).growAndRehash();
        }
コード例 #4
0
            public KeyValuesIterator(LinearProbeLongLongHashMap outerInstance)
            {
                this._outerInstance = outerInstance;

                if (!InstanceFieldsInitialized)
                {
                    InitializeInstanceFields();
                    InstanceFieldsInitialized = true;
                }
            }
コード例 #5
0
        public override MutableLongObjectMap <Value> NewValuesMap()
        {
            if (_valuesContainer == null)
            {
                _valuesContainer = new AppendOnlyValuesContainer(_allocator);
            }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final LinearProbeLongLongHashMap refs = new LinearProbeLongLongHashMap(allocator);
            LinearProbeLongLongHashMap refs = new LinearProbeLongLongHashMap(_allocator);

            _resources.Add(refs);
            return(new ValuesMap(refs, _valuesContainer));
        }
コード例 #6
0
 public KeyValuesView(LinearProbeLongLongHashMap outerInstance)
 {
     this._outerInstance = outerInstance;
 }