CPF/CPF.ReoGrid/Outline/OutlineCollection.cs

101 lines
1.9 KiB
C#
Raw Permalink Normal View History

2024-06-24 10:15:59 +08:00
using System;
using System.Collections.Generic;
namespace CPF.ReoGrid.Outline
{
public class OutlineCollection<T> : List<OutlineGroup<T>> where T : IReoGridOutline
{
internal OutlineCollection()
{
this.Reset();
}
public void Reset()
{
base.Clear();
base.Add(new OutlineGroup<T>());
}
public void IterateOutlines(Func<T, bool> iterator)
{
for (int i = 0; i < base.Count - 1; i++)
{
OutlineGroup<T> outlineGroup = base[i];
foreach (T arg in outlineGroup)
{
bool flag = !iterator(arg);
if (flag)
{
return;
}
}
}
}
public void IterateReverseOutlines(Func<T, bool> iterator)
{
for (int i = base.Count - 1; i >= 0; i--)
{
OutlineGroup<T> outlineGroup = base[i];
foreach (T arg in outlineGroup)
{
bool flag = !iterator(arg);
if (flag)
{
return;
}
}
}
}
public bool HasSame(IReoGridOutline target, IList<IReoGridOutline> exclusions)
{
for (int i = 0; i < base.Count - 1; i++)
{
OutlineGroup<T> 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<T> 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<T> outlineGroup = base[i];
num += outlineGroup.Count;
}
return num;
}
}
}
}