Esempio n. 1
0
        protected override void SwapWithCurrent(uint index, SwapType swapType)
        {
            if (swapType == SwapType.Match)
            {
                return;
            }
            if (swapType == SwapType.Insert && _copier != null)
            {
                _currentKey = _copier.Copy(_currentKey);
            }
            if (swapType == SwapType.Insert && _currentIsNull)
            {
                _nullItemIndex = (int)index;
            }

            T   swapKey   = _keys[index];
            int swapValue = _values[index];

            _keys[index]   = _currentKey;
            _values[index] = _currentValue;

            _currentKey    = swapKey;
            _currentValue  = swapValue;
            _currentIsNull = (_nullItemIndex == index);
        }
Esempio n. 2
0
        public void Add(XArray keys, int firstRowIndex)
        {
            T[] keyArray = (T[])keys.Array;

            if (_valueCopier != null || keys.HasNulls)
            {
                for (int i = 0; i < keys.Count; ++i)
                {
                    int index = keys.Index(i);
                    if (keys.HasNulls && keys.NullRows[index])
                    {
                        continue;
                    }
                    T key = keyArray[index];
                    if (_valueCopier != null)
                    {
                        key = _valueCopier.Copy(key);
                    }
                    _dictionary[key] = firstRowIndex + i;
                }
            }
            else
            {
                for (int i = 0; i < keys.Count; ++i)
                {
                    int index = keys.Index(i);
                    T   key   = keyArray[index];
                    _dictionary[key] = firstRowIndex + i;
                }
            }
        }
Esempio n. 3
0
        public void SwapCurrent(uint index)
        {
            // Copy only new values and only when they become used
            if (_currentIsNewValue && _copier != null)
            {
                _current           = _copier.Copy(_current);
                _currentIsNewValue = false;
            }

            TColumnType temp = _values[index];

            _values[index] = _current;
            _current       = temp;
        }