public long GetPositionToStartReadingFrom() { if (isComplete) { throw new InvalidOperationException("Complete range doesn't have a position to srart"); } return(LastReadPosition.GetValueOrDefault(desirableRange.Begin)); }
public override string ToString() { return(string.Format("({0}-{1}-{2},{3}){4}", desirableRange.Begin, LastReadPosition.GetValueOrDefault(desirableRange.Begin), desirableRange.End, desirableRange.Priority, host != null ? " open" : "")); }
public void TrimLeft(long newBegin) { CheckNotOpen(); if (!desirableRange.IsInRange(newBegin)) { throw new ArgumentException("Position specified is out of this range", "position"); } desirableRange = new FRange(newBegin, desirableRange.End, desirableRange.Priority); bool clearThisRange = false; if (newBegin > LastReadPosition.GetValueOrDefault(long.MinValue)) { clearThisRange = true; } else { PositionedLine pos = new PositionedLine(); foreach (PositionedLine p in ForwardIterator(newBegin)) { pos = p; break; } if (pos.Chunk != null) { pos.Chunk.TrimLeft(pos.Position); first = pos.Chunk; first.prev = null; } else { clearThisRange = true; } } if (clearThisRange) { first = null; last = null; } }