protected override void Expand()
        {
            // Build a selector of table values which were non-empty
            int[] indices = new int[_assignedIndices.Length];

            byte[] metadata = this.Metadata;
            int    count    = 0;

            for (int i = 0; i < indices.Length; ++i)
            {
                if (metadata[i] != 0)
                {
                    indices[count++] = i;
                }
            }

            // Save the old keys, ranks, and row indices in arrays
            XArray[] keyArrays = new XArray[_keys.Length];
            for (int i = 0; i < _keys.Length; ++i)
            {
                keyArrays[i] = XArray.All(_keys[i].Values).Reselect(ArraySelector.Map(indices, count));
            }

            XArray indicesArray = XArray.All(_assignedIndices).Reselect(ArraySelector.Map(indices, count));

            // Expand the table
            Reset(HashCore.ResizeToSize(_assignedIndices.Length));

            // Add items to the enlarged table
            FindOrAdd(keyArrays, indicesArray);
        }
Example #2
0
        protected override void Expand()
        {
            // Save the current Keys/Values/Metadata
            T[]    oldKeys     = _keys;
            U[]    oldValues   = _values;
            byte[] oldMetaData = this.Metadata;

            // Expand the table
            Reset(HashCore.ResizeToSize(_keys.Length));

            // Add items to the enlarged table
            for (int i = 0; i < oldMetaData.Length; ++i)
            {
                if (oldMetaData[i] > 0)
                {
                    Add(oldKeys[i], oldValues[i]);
                }
            }
        }