public RangedArray(int numberOfItems, TheFanciestMemory mem) { if (mem == null) throw new ArgumentNullException("mem"); _mem = mem; if (numberOfItems == 0) { _refNode = null; return; } _memInterval = mem.Malloc(numberOfItems); var root = NestingDepthTreeNode.Include(null, _memInterval.Offset, +1, +1).NewRoot; _refNode = NestingDepthTreeNode.Include(root, _memInterval.Offset + _memInterval.Length, -1, +1).AdjustedNode; }
public RangedArray(RangedArray other, Interval interval, TheFanciestMemory mem) { if (mem == null) throw new ArgumentNullException("mem"); _mem = mem; if (other._disposed) throw new ObjectDisposedException("other"); if (interval.Offset < 0) throw new ArgumentOutOfRangeException(); if (interval.Length < 0) throw new ArgumentOutOfRangeException(); if (interval.Offset + interval.Length > other._memInterval.Length) throw new ArgumentOutOfRangeException(); if (interval.Length == 0) { _refNode = null; return; } _memInterval = new Interval(other._memInterval.Offset + interval.Offset, interval.Length); var root = NestingDepthTreeNode.RootOf(other._refNode); root = NestingDepthTreeNode.Include(root, _memInterval.Offset, +1, +1).NewRoot; _refNode = NestingDepthTreeNode.Include(root, _memInterval.Offset + _memInterval.Length, -1, +1).AdjustedNode; }