187 lines
4.1 KiB
C#
187 lines
4.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
namespace UnityEngine.UI.Collections
|
|
{
|
|
// Token: 0x020000A0 RID: 160
|
|
internal class IndexedSet<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
|
|
{
|
|
// Token: 0x060005D5 RID: 1493 RVA: 0x0001D6D3 File Offset: 0x0001BAD3
|
|
public void Add(T item)
|
|
{
|
|
this.m_List.Add(item);
|
|
this.m_Dictionary.Add(item, this.m_List.Count - 1);
|
|
}
|
|
|
|
// Token: 0x060005D6 RID: 1494 RVA: 0x0001D6FC File Offset: 0x0001BAFC
|
|
public bool AddUnique(T item)
|
|
{
|
|
bool flag;
|
|
if (this.m_Dictionary.ContainsKey(item))
|
|
{
|
|
flag = false;
|
|
}
|
|
else
|
|
{
|
|
this.m_List.Add(item);
|
|
this.m_Dictionary.Add(item, this.m_List.Count - 1);
|
|
flag = true;
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x060005D7 RID: 1495 RVA: 0x0001D750 File Offset: 0x0001BB50
|
|
public bool Remove(T item)
|
|
{
|
|
int num = -1;
|
|
bool flag;
|
|
if (!this.m_Dictionary.TryGetValue(item, out num))
|
|
{
|
|
flag = false;
|
|
}
|
|
else
|
|
{
|
|
this.RemoveAt(num);
|
|
flag = true;
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x060005D8 RID: 1496 RVA: 0x0001D789 File Offset: 0x0001BB89
|
|
public IEnumerator<T> GetEnumerator()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
// Token: 0x060005D9 RID: 1497 RVA: 0x0001D794 File Offset: 0x0001BB94
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return this.GetEnumerator();
|
|
}
|
|
|
|
// Token: 0x060005DA RID: 1498 RVA: 0x0001D7AF File Offset: 0x0001BBAF
|
|
public void Clear()
|
|
{
|
|
this.m_List.Clear();
|
|
this.m_Dictionary.Clear();
|
|
}
|
|
|
|
// Token: 0x060005DB RID: 1499 RVA: 0x0001D7C8 File Offset: 0x0001BBC8
|
|
public bool Contains(T item)
|
|
{
|
|
return this.m_Dictionary.ContainsKey(item);
|
|
}
|
|
|
|
// Token: 0x060005DC RID: 1500 RVA: 0x0001D7E9 File Offset: 0x0001BBE9
|
|
public void CopyTo(T[] array, int arrayIndex)
|
|
{
|
|
this.m_List.CopyTo(array, arrayIndex);
|
|
}
|
|
|
|
// Token: 0x17000192 RID: 402
|
|
// (get) Token: 0x060005DD RID: 1501 RVA: 0x0001D7FC File Offset: 0x0001BBFC
|
|
public int Count
|
|
{
|
|
get
|
|
{
|
|
return this.m_List.Count;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000193 RID: 403
|
|
// (get) Token: 0x060005DE RID: 1502 RVA: 0x0001D81C File Offset: 0x0001BC1C
|
|
public bool IsReadOnly
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060005DF RID: 1503 RVA: 0x0001D834 File Offset: 0x0001BC34
|
|
public int IndexOf(T item)
|
|
{
|
|
int num = -1;
|
|
this.m_Dictionary.TryGetValue(item, out num);
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x060005E0 RID: 1504 RVA: 0x0001D85B File Offset: 0x0001BC5B
|
|
public void Insert(int index, T item)
|
|
{
|
|
throw new NotSupportedException("Random Insertion is semantically invalid, since this structure does not guarantee ordering.");
|
|
}
|
|
|
|
// Token: 0x060005E1 RID: 1505 RVA: 0x0001D868 File Offset: 0x0001BC68
|
|
public void RemoveAt(int index)
|
|
{
|
|
T t = this.m_List[index];
|
|
this.m_Dictionary.Remove(t);
|
|
if (index == this.m_List.Count - 1)
|
|
{
|
|
this.m_List.RemoveAt(index);
|
|
}
|
|
else
|
|
{
|
|
int num = this.m_List.Count - 1;
|
|
T t2 = this.m_List[num];
|
|
this.m_List[index] = t2;
|
|
this.m_Dictionary[t2] = index;
|
|
this.m_List.RemoveAt(num);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000194 RID: 404
|
|
public T this[int index]
|
|
{
|
|
get
|
|
{
|
|
return this.m_List[index];
|
|
}
|
|
set
|
|
{
|
|
T t = this.m_List[index];
|
|
this.m_Dictionary.Remove(t);
|
|
this.m_List[index] = value;
|
|
this.m_Dictionary.Add(t, index);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060005E4 RID: 1508 RVA: 0x0001D960 File Offset: 0x0001BD60
|
|
public void RemoveAll(Predicate<T> match)
|
|
{
|
|
int i = 0;
|
|
while (i < this.m_List.Count)
|
|
{
|
|
T t = this.m_List[i];
|
|
if (match(t))
|
|
{
|
|
this.Remove(t);
|
|
}
|
|
else
|
|
{
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060005E5 RID: 1509 RVA: 0x0001D9B4 File Offset: 0x0001BDB4
|
|
public void Sort(Comparison<T> sortLayoutFunction)
|
|
{
|
|
this.m_List.Sort(sortLayoutFunction);
|
|
for (int i = 0; i < this.m_List.Count; i++)
|
|
{
|
|
T t = this.m_List[i];
|
|
this.m_Dictionary[t] = i;
|
|
}
|
|
}
|
|
|
|
// Token: 0x040002BF RID: 703
|
|
private readonly List<T> m_List = new List<T>();
|
|
|
|
// Token: 0x040002C0 RID: 704
|
|
private Dictionary<T, int> m_Dictionary = new Dictionary<T, int>();
|
|
}
|
|
}
|