Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 private void AttachOriginalLinks()
 {
     for (LevelRun current = _baseRun; current != null; current = current.Next)
     {
         current.LastLink.ReplaceNext(current.SubsequentLink);
     }
     ;
 }
Esempio n. 3
0
        private void AttachLevelRunLinks()
        {
            LevelRun current;
            LevelRun next;

            _roller.ReplaceNext(_baseRun.FirstLink);

            for (current = _baseRun; (next = current.Next) != null; current = next)
            {
                current.LastLink.ReplaceNext(next.FirstLink);
            }
            current.LastLink.ReplaceNext(_roller);

            _lastRun = current;
            _level   = _baseRun.Level;
            _sos     = _baseRun.SOR;
            _eos     = (!_baseRun.IsPartialIsolate
                    ? current.EOR
                    : Level.MakeExtremeType(_paragraphLevel, _level)
                        );
        }
Esempio n. 4
0
        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;
            }

            ++_size;
            _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;
            }
        }
Esempio n. 5
0
        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;
        }