Exemplo n.º 1
0
        public bool Bump(int maxIndex)
        {
            if (IsGap)
            {
                Debug.Assert(maxIndex == EndIndex);
                if (IsNecessaryGap())
                {
                    maxIndex = EndIndex - 1;
                }
                return(Prev.Bump(maxIndex));
            }

            if (EndIndex >= maxIndex)
            {
                Debug.Assert(EndIndex == maxIndex, "Overlapping ConstraintSegments!");
                if (Prev == null)
                {
                    return(false); // Nothing before, and can't move current segment
                }
                return(Prev.Bump(StartIndex));
            }
            else //if (EndIndex < maxIndex)
            {
                StartIndex++;
                if (Next != null)
                {
                    Debug.Assert(Next.IsGap);
                    Next.ShrinkForBump();
                }

                if (Prev != null)
                {
                    Prev.GrowForBump();
                }

                ResetFolowing();
                return(true);
            }
        }