using System;
using System.Collections;
using System.Collections.Generic;

namespace cakeslice
{
	// Token: 0x02000111 RID: 273
	public class LinkedSet<T> : IEnumerable<T>, IEnumerable
	{
		// Token: 0x06001666 RID: 5734 RVA: 0x0019E4AF File Offset: 0x0019C6AF
		public LinkedSet()
		{
			this.list = new LinkedList<T>();
			this.dictionary = new Dictionary<T, LinkedListNode<T>>();
		}

		// Token: 0x06001667 RID: 5735 RVA: 0x0019E4CD File Offset: 0x0019C6CD
		public LinkedSet(IEqualityComparer<T> comparer)
		{
			this.list = new LinkedList<T>();
			this.dictionary = new Dictionary<T, LinkedListNode<T>>(comparer);
		}

		// Token: 0x06001668 RID: 5736 RVA: 0x0019E4EC File Offset: 0x0019C6EC
		public bool Add(T t)
		{
			if (this.dictionary.ContainsKey(t))
			{
				return false;
			}
			LinkedListNode<T> linkedListNode = this.list.AddLast(t);
			this.dictionary.Add(t, linkedListNode);
			return true;
		}

		// Token: 0x06001669 RID: 5737 RVA: 0x0019E524 File Offset: 0x0019C724
		public bool Remove(T t)
		{
			LinkedListNode<T> linkedListNode;
			if (this.dictionary.TryGetValue(t, out linkedListNode))
			{
				this.dictionary.Remove(t);
				this.list.Remove(linkedListNode);
				return true;
			}
			return false;
		}

		// Token: 0x0600166A RID: 5738 RVA: 0x0019E55D File Offset: 0x0019C75D
		public void Clear()
		{
			this.list.Clear();
			this.dictionary.Clear();
		}

		// Token: 0x0600166B RID: 5739 RVA: 0x0019E575 File Offset: 0x0019C775
		public bool Contains(T t)
		{
			return this.dictionary.ContainsKey(t);
		}

		// Token: 0x17000058 RID: 88
		// (get) Token: 0x0600166C RID: 5740 RVA: 0x0019E583 File Offset: 0x0019C783
		public int Count
		{
			get
			{
				return this.list.Count;
			}
		}

		// Token: 0x0600166D RID: 5741 RVA: 0x0019E590 File Offset: 0x0019C790
		public IEnumerator<T> GetEnumerator()
		{
			return this.list.GetEnumerator();
		}

		// Token: 0x0600166E RID: 5742 RVA: 0x0019E5A2 File Offset: 0x0019C7A2
		IEnumerator IEnumerable.GetEnumerator()
		{
			return this.list.GetEnumerator();
		}

		// Token: 0x0400266C RID: 9836
		private LinkedList<T> list;

		// Token: 0x0400266D RID: 9837
		private Dictionary<T, LinkedListNode<T>> dictionary;
	}
}
