using System; using System.Collections.Generic; namespace CPF.ReoGrid.Outline { public class OutlineCollection : List> where T : IReoGridOutline { internal OutlineCollection() { this.Reset(); } public void Reset() { base.Clear(); base.Add(new OutlineGroup()); } public void IterateOutlines(Func iterator) { for (int i = 0; i < base.Count - 1; i++) { OutlineGroup outlineGroup = base[i]; foreach (T arg in outlineGroup) { bool flag = !iterator(arg); if (flag) { return; } } } } public void IterateReverseOutlines(Func iterator) { for (int i = base.Count - 1; i >= 0; i--) { OutlineGroup outlineGroup = base[i]; foreach (T arg in outlineGroup) { bool flag = !iterator(arg); if (flag) { return; } } } } public bool HasSame(IReoGridOutline target, IList exclusions) { for (int i = 0; i < base.Count - 1; i++) { OutlineGroup outlineGroup = base[i]; foreach (T t in outlineGroup) { IReoGridOutline reoGridOutline = t; bool flag = reoGridOutline != target && (exclusions == null || !exclusions.Contains(reoGridOutline)) && reoGridOutline.Start == target.Start && reoGridOutline.Count == target.Count; if (flag) { return true; } } } return false; } public bool HasOutlines { get { for (int i = base.Count - 1; i >= 0; i--) { OutlineGroup outlineGroup = base[i]; bool flag = outlineGroup.Count > 0; if (flag) { return true; } } return false; } } public int OutlineCount { get { int num = 0; for (int i = base.Count - 1; i >= 0; i--) { OutlineGroup outlineGroup = base[i]; num += outlineGroup.Count; } return num; } } } }