Пример #1
0
 internal void UnmergeInPlace(PtrLenList unmergeWith)
 {
     if (unmergeWith == null)
     {
         return;
     }
     foreach (KeyValuePair <ulong, ulong> range in unmergeWith)
     {
         TryExclude(range.Key, range.Value);
     }
 }
Пример #2
0
 public void MergeInPlace(PtrLenList mergeWith)
 {
     if (mergeWith == null)
     {
         return;
     }
     foreach (KeyValuePair <ulong, ulong> range in mergeWith)
     {
         TryInclude(range.Key, range.Value);
     }
 }
Пример #3
0
        public PtrLenList Clone()
        {
            var res = new PtrLenList();

            if (_size == 0)
            {
                return(res);
            }
            res._size = _size;
            res._list = new KeyValuePair <ulong, ulong> [_size];
            Array.Copy(_list, res._list, _size);
            return(res);
        }
Пример #4
0
        public PtrLenList MergeIntoNew(PtrLenList mergeWith)
        {
            if (mergeWith == null || mergeWith.Empty)
            {
                return(Clone());
            }
            if (Empty)
            {
                return(mergeWith.Clone());
            }

            // TODO: optimize this
            var result = Clone();

            foreach (var range in mergeWith)
            {
                result.TryInclude(range.Key, range.Value);
            }
            return(result);
        }