Ejemplo n.º 1
0
        /// <summary>
        /// Clones the hash map.
        /// </summary>
        protected OpenReferenceHashMapBase(OpenReferenceHashMapBase <K, V> other, int newSize)
        {
            m_fillFactor = other.m_fillFactor;

            if (newSize < 0)
            {
                InitializeEmpty(DefaultSize);
                return;
            }

            if (newSize < other.m_size)
            {
                newSize = other.m_size;
            }

            if (newSize < DefaultSize)
            {
                newSize = DefaultSize;
            }

            m_mask      = other.m_mask;
            m_mask2     = other.m_mask2;
            m_threshold = other.m_threshold;

            // we need new references, to keep our referencequeue up to date.
            m_data = other.m_data;
            int newCapacity = Tools.ArraySize(newSize, other.m_fillFactor) * 2;

            Rehash(newCapacity);
        }
Ejemplo n.º 2
0
 public OpenWeakReferenceHashMap(OpenReferenceHashMapBase <TKey, TValue> other, int newSize)
     : base(other, newSize)
 {
 }