private void FindPreviousIncompleteRun() { List list = _isolatingList; int top = _isolatingTop; do { int limit = (list == _frontList ? _frontTop : 0); do { LevelRun levelRun = list.Runs[top]; if (levelRun.IsPartialIsolate) { _isolatingList = list; _isolatingTop = top; return; } } while (top-- > limit); list = list.previous; top = List.MaxIndex; } while (list != null); _isolatingList = null; _isolatingTop = -1; }
private void AttachOriginalLinks() { for (LevelRun current = BaseLevelRun; current != null; current = current.Next) { current.LastLink.ReplaceNext(current.SubsequentLink); } ; }
private void AttachLevelRunLinks() { LevelRun current; LevelRun next; _roller.ReplaceNext(BaseLevelRun.FirstLink); for (current = BaseLevelRun; (next = current.Next) != null; current = next) { current.LastLink.ReplaceNext(next.FirstLink); } current.LastLink.ReplaceNext(_roller); _lastRun = current; _level = BaseLevelRun.Level; _sos = BaseLevelRun.SOR; _eos = (!BaseLevelRun.IsPartialIsolate ? current.EOR : Level.MakeExtremeType(ParagraphLevel, _level) ); }
public void Enqueue(LevelRun levelRun) { if (_rearTop == List.MaxIndex) { List list = _rearList.next; if (list == null) { list = new List(); list.previous = _rearList; list.next = null; _rearList.next = list; } _rearList = list; _rearTop = 0; } else { ++_rearTop; } ++Count; _rearList.Runs[_rearTop] = levelRun; // Complete the latest isolating run with this terminating run. if (_isolatingTop != -1 && levelRun.IsIsolateTerminator) { LevelRun incompleteRun = _isolatingList.Runs[_isolatingTop]; incompleteRun.AttachLevelRun(levelRun); FindPreviousIncompleteRun(); } // Save the location of the isolating run. if (levelRun.IsIsolateInitiator) { _isolatingList = _rearList; _isolatingTop = _rearTop; } }
public void AttachLevelRun(LevelRun levelRun) { #if DEBUG if (this.Level != levelRun.Level) { throw (new ArgumentException("Cannot attach a level run of different level.")); } if (this.IsSimple) { throw (new ArgumentException("Cannot attach another level run to a default run.")); } if (!this.IsPartialIsolate && this.IsIsolateInitiator) { throw (new ArgumentException("Cannot attach another level run to a complete isolating run.")); } if (this.IsIsolateInitiator && !levelRun.IsIsolateTerminator) { throw (new ArgumentException("Cannot attach a non terminating level run to an initiating level run.")); } #endif if (levelRun.IsIsolateTerminator) { levelRun._kind |= Kind.Attached; } if (this.IsIsolateInitiator) { _kind &= ~Kind.Partial; } _next = levelRun; }