Ejemplo n.º 1
0
        public PrimaryMixedSection(Modification modification, IEnumerable<Modification> firstModifications, Color color)
            : base(modification, null, color)
        {
            List<string> lines = new List<string>();

            foreach (Modification firstModification in firstModifications)
            {
                lines.AddRange(firstModification.Primary.Lines);
            }

            Lines = lines.ToArray();
        }
Ejemplo n.º 2
0
        public Modification[] Merge(Modification other)
        {
            IList<Modification> result = new List<Modification>();

            if (other.Primary.StartIndex != Primary.StartIndex)
            {
                result.Add(this);

                return result.ToArray();
            }

            return DoMerge(other);
        }
Ejemplo n.º 3
0
            protected override Modification[] DoMerge(Modification other)
            {
                IList<Modification> result = new List<Modification>();

                if (other.IsAdded)
                {
                    // отдельная обработка добавленных
                    result.Add(other);

                    if (other.Next != null && ((Modification) other.Next).Primary.StartIndex == Primary.StartIndex)
                    {
                        result.Add((Modification)other.Next);
                    }

                    return result.ToArray();
                }

                return new[] {other};
            }
Ejemplo n.º 4
0
        public SecondaryMixedSection(Modification modification, IEnumerable<Modification> firstModifications, IEnumerable<Modification> secondModifications, Color color)
            : base(modification, null, color)
        {
            IList<string> lines = new List<string>();

            foreach (Modification firstModification in firstModifications)
            {
                foreach (string line in firstModification.Secondary.Lines)
                {
                    lines.Add("User1:" + line);
                }
            }

            foreach (Modification secondModification in secondModifications)
            {
                foreach (string line in secondModification.Secondary.Lines)
                {
                    lines.Add("User2:" + line);
                }
            }

            Lines = lines.ToArray();
        }
Ejemplo n.º 5
0
 public SecondarySection(Modification modification, IEnumerable<string> lines, Color color)
     : base(modification, lines, color)
 {
 }
Ejemplo n.º 6
0
 private static void ModificationAreEqual(
     Modification modification,
     string modificationName,
     int primaryIndex,
     int secondaryIndex,
     int length)
 {
     Assert.AreEqual(modification.Name, modificationName);
     //Assert.AreEqual(modification.PrimaryIndex, primaryIndex);
     //Assert.AreEqual(modification.SecondaryIndex, secondaryIndex);
     //Assert.AreEqual(modification.Length, length);
 }
Ejemplo n.º 7
0
 protected Section(Modification modification, IEnumerable<string> lines, Color color)
 {
     Modification = modification;
     Color = color;
     Lines = lines == null ? new string[0] : lines.ToArray();
 }
Ejemplo n.º 8
0
 protected override Modification[] DoMerge(Modification other)
 {
     // выходит за рамки задачи
     throw new System.NotImplementedException();
 }
Ejemplo n.º 9
0
        protected virtual Modification[] DoMerge(Modification other)
        {
            if (other.IsNoChanged)
            {
                return new[] {this};
            }

            return new[] {new MixedModification(new[] {this}, new[] {other})};
        }