Esempio 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();
        }
Esempio 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);
        }
Esempio 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};
            }
Esempio 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();
        }
Esempio n. 5
0
 public SecondarySection(Modification modification, IEnumerable<string> lines, Color color)
     : base(modification, lines, color)
 {
 }
Esempio 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);
 }
Esempio n. 7
0
 protected Section(Modification modification, IEnumerable<string> lines, Color color)
 {
     Modification = modification;
     Color = color;
     Lines = lines == null ? new string[0] : lines.ToArray();
 }
Esempio n. 8
0
 protected override Modification[] DoMerge(Modification other)
 {
     // выходит за рамки задачи
     throw new System.NotImplementedException();
 }
Esempio n. 9
0
        protected virtual Modification[] DoMerge(Modification other)
        {
            if (other.IsNoChanged)
            {
                return new[] {this};
            }

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