Просмотр исходного кода

重构EventSystem,大大简化各种System的实现,并且提高了awake的性能

tanghai 4 лет назад
Родитель
Сommit
b728463786

+ 87 - 97
Unity/Assets/Model/Core/Object/EventSystem.cs

@@ -6,8 +6,52 @@ using System.Text;
 
 namespace ET
 {
+	using OneTypeSystems = UnOrderMultiMap<Type, object>;
+
 	public sealed class EventSystem: IDisposable
 	{
+		private class TypeSystems
+		{
+			private readonly Dictionary<Type, OneTypeSystems> typeSystemsMap = new Dictionary<Type, OneTypeSystems>();
+		
+			public OneTypeSystems GetOrCreateOneTypeSystems(Type type)
+			{
+				OneTypeSystems systems = null;
+				this.typeSystemsMap.TryGetValue(type, out systems);
+				if (systems != null)
+				{
+					return systems;
+				}
+
+				systems = new OneTypeSystems();
+				this.typeSystemsMap.Add(type, systems);
+				return systems;
+			}
+		
+			public OneTypeSystems GetOneTypeSystems(Type type)
+			{
+				OneTypeSystems systems = null;
+				this.typeSystemsMap.TryGetValue(type, out systems);
+				return systems;
+			}
+		
+			public List<object> GetSystems(Type type, Type systemType)
+			{
+				OneTypeSystems oneTypeSystems = null;
+				if (!this.typeSystemsMap.TryGetValue(type, out oneTypeSystems))
+				{
+					return null;
+				}
+
+				if (!oneTypeSystems.TryGetValue(systemType, out List<object> systems))
+				{
+					return null;
+				}
+				return systems;
+			}
+		}
+		
+		
 		private static EventSystem instance;
 
 		public static EventSystem Instance
@@ -25,23 +69,11 @@ namespace ET
 		private readonly UnOrderMultiMapSet<Type, Type> types = new UnOrderMultiMapSet<Type, Type>();
 
 		private readonly Dictionary<Type, List<object>> allEvents = new Dictionary<Type, List<object>>();
-
-		private readonly UnOrderMultiMap<Type, IAwakeSystem> awakeSystems = new UnOrderMultiMap<Type, IAwakeSystem>();
-
-		private readonly UnOrderMultiMap<Type, IDestroySystem> destroySystems = new UnOrderMultiMap<Type, IDestroySystem>();
-
-		private readonly UnOrderMultiMap<Type, ILoadSystem> loadSystems = new UnOrderMultiMap<Type, ILoadSystem>();
-
-		private readonly UnOrderMultiMap<Type, IUpdateSystem> updateSystems = new UnOrderMultiMap<Type, IUpdateSystem>();
-
-		private readonly UnOrderMultiMap<Type, ILateUpdateSystem> lateUpdateSystems = new UnOrderMultiMap<Type, ILateUpdateSystem>();
 		
-		private readonly UnOrderMultiMap<Type, IDeserializeSystem> deserializeSystems = new UnOrderMultiMap<Type, IDeserializeSystem>();
+		private TypeSystems typeSystems = new TypeSystems();
 		
 		private Queue<long> updates = new Queue<long>();
 		private Queue<long> updates2 = new Queue<long>();
-		
-		private readonly Queue<long> starts = new Queue<long>();
 
 		private Queue<long> loaders = new Queue<long>();
 		private Queue<long> loaders2 = new Queue<long>();
@@ -80,36 +112,16 @@ namespace ET
 				}
 			}
 
-			this.awakeSystems.Clear();
-			this.lateUpdateSystems.Clear();
-			this.updateSystems.Clear();
-			this.loadSystems.Clear();
-			this.destroySystems.Clear();
-			this.deserializeSystems.Clear();
+			this.typeSystems = new TypeSystems();
 			
 			foreach (Type type in this.GetTypes(typeof(ObjectSystemAttribute)))
 			{
 				object obj = Activator.CreateInstance(type);
-				switch (obj)
-				{
-					case IAwakeSystem objectSystem:
-						this.awakeSystems.Add(objectSystem.Type(), objectSystem);
-						break;
-					case IUpdateSystem updateSystem:
-						this.updateSystems.Add(updateSystem.Type(), updateSystem);
-						break;
-					case ILateUpdateSystem lateUpdateSystem:
-						this.lateUpdateSystems.Add(lateUpdateSystem.Type(), lateUpdateSystem);
-						break;
-					case IDestroySystem destroySystem:
-						this.destroySystems.Add(destroySystem.Type(), destroySystem);
-						break;
-					case ILoadSystem loadSystem:
-						this.loadSystems.Add(loadSystem.Type(), loadSystem);
-						break;
-					case IDeserializeSystem deserializeSystem:
-						this.deserializeSystems.Add(deserializeSystem.Type(), deserializeSystem);
-						break;
+
+				if (obj is ISystemType iSystemType)
+				{
+					OneTypeSystems oneTypeSystems = this.typeSystems.GetOrCreateOneTypeSystems(iSystemType.Type());
+					oneTypeSystems.Add(iSystemType.SystemType(), obj);
 				}
 			}
 
@@ -132,6 +144,8 @@ namespace ET
 			
 			this.Load();
 		}
+
+
 		
 		public Assembly GetAssembly(string name)
 		{
@@ -173,17 +187,23 @@ namespace ET
 			
 			Type type = component.GetType();
 
-			if (this.loadSystems.ContainsKey(type))
+			OneTypeSystems oneTypeSystems = this.typeSystems.GetOneTypeSystems(type);
+			if (oneTypeSystems == null)
+			{
+				return;
+			}
+
+			if (oneTypeSystems.ContainsKey(typeof(ILoadSystem)))
 			{ 
 				this.loaders.Enqueue(component.InstanceId);
 			}
 
-			if (this.updateSystems.ContainsKey(type))
+			if (oneTypeSystems.ContainsKey(typeof(IUpdateSystem)))
 			{
 				this.updates.Enqueue(component.InstanceId);
 			}
 
-			if (this.lateUpdateSystems.ContainsKey(type))
+			if (oneTypeSystems.ContainsKey(typeof(ILateUpdateSystem)))
 			{
 				this.lateUpdates.Enqueue(component.InstanceId);
 			}
@@ -208,7 +228,7 @@ namespace ET
 		
 		public void Deserialize(Entity component)
 		{
-			List<IDeserializeSystem> iDeserializeSystems = this.deserializeSystems[component.GetType()];
+			List<object> iDeserializeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IDeserializeSystem));
 			if (iDeserializeSystems == null)
 			{
 				return;
@@ -234,7 +254,7 @@ namespace ET
 
 		public void Awake(Entity component)
 		{
-			List<IAwakeSystem> iAwakeSystems = this.awakeSystems[component.GetType()];
+			List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem));
 			if (iAwakeSystems == null)
 			{
 				return;
@@ -246,16 +266,10 @@ namespace ET
 				{
 					continue;
 				}
-				
-				IAwake iAwake = aAwakeSystem as IAwake;
-				if (iAwake == null)
-				{
-					continue;
-				}
 
 				try
 				{
-					iAwake.Run(component);
+					aAwakeSystem.Run(component);
 				}
 				catch (Exception e)
 				{
@@ -266,28 +280,22 @@ namespace ET
 
 		public void Awake<P1>(Entity component, P1 p1)
 		{
-			List<IAwakeSystem> iAwakeSystems = this.awakeSystems[component.GetType()];
+			List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1>));
 			if (iAwakeSystems == null)
 			{
 				return;
 			}
 
-			foreach (IAwakeSystem aAwakeSystem in iAwakeSystems)
+			foreach (IAwakeSystem<P1> aAwakeSystem in iAwakeSystems)
 			{
 				if (aAwakeSystem == null)
 				{
 					continue;
 				}
-				
-				IAwake<P1> iAwake = aAwakeSystem as IAwake<P1>;
-				if (iAwake == null)
-				{
-					continue;
-				}
 
 				try
 				{
-					iAwake.Run(component, p1);
+					aAwakeSystem.Run(component, p1);
 				}
 				catch (Exception e)
 				{
@@ -298,28 +306,22 @@ namespace ET
 
 		public void Awake<P1, P2>(Entity component, P1 p1, P2 p2)
 		{
-			List<IAwakeSystem> iAwakeSystems = this.awakeSystems[component.GetType()];
+			List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2>));
 			if (iAwakeSystems == null)
 			{
 				return;
 			}
 
-			foreach (IAwakeSystem aAwakeSystem in iAwakeSystems)
+			foreach (IAwakeSystem<P1, P2> aAwakeSystem in iAwakeSystems)
 			{
 				if (aAwakeSystem == null)
 				{
 					continue;
 				}
-				
-				IAwake<P1, P2> iAwake = aAwakeSystem as IAwake<P1, P2>;
-				if (iAwake == null)
-				{
-					continue;
-				}
 
 				try
 				{
-					iAwake.Run(component, p1, p2);
+					aAwakeSystem.Run(component, p1, p2);
 				}
 				catch (Exception e)
 				{
@@ -330,28 +332,22 @@ namespace ET
 
 		public void Awake<P1, P2, P3>(Entity component, P1 p1, P2 p2, P3 p3)
 		{
-			List<IAwakeSystem> iAwakeSystems = this.awakeSystems[component.GetType()];
+			List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2, P3>));
 			if (iAwakeSystems == null)
 			{
 				return;
 			}
 
-			foreach (IAwakeSystem aAwakeSystem in iAwakeSystems)
+			foreach (IAwakeSystem<P1, P2, P3> aAwakeSystem in iAwakeSystems)
 			{
 				if (aAwakeSystem == null)
 				{
 					continue;
 				}
 
-				IAwake<P1, P2, P3> iAwake = aAwakeSystem as IAwake<P1, P2, P3>;
-				if (iAwake == null)
-				{
-					continue;
-				}
-
 				try
 				{
-					iAwake.Run(component, p1, p2, p3);
+					aAwakeSystem.Run(component, p1, p2, p3);
 				}
 				catch (Exception e)
 				{
@@ -362,28 +358,22 @@ namespace ET
 
         public void Awake<P1, P2, P3, P4>(Entity component, P1 p1, P2 p2, P3 p3, P4 p4)
         {
-            List<IAwakeSystem> iAwakeSystems = this.awakeSystems[component.GetType()];
-            if (iAwakeSystems == null)
-            {
-                return;
-            }
+	        List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2, P3, P4>));
+	        if (iAwakeSystems == null)
+	        {
+		        return;
+	        }
 
-            foreach (IAwakeSystem aAwakeSystem in iAwakeSystems)
+            foreach (IAwakeSystem<P1, P2, P3, P4> aAwakeSystem in iAwakeSystems)
             {
                 if (aAwakeSystem == null)
                 {
                     continue;
                 }
 
-                IAwake<P1, P2, P3, P4> iAwake = aAwakeSystem as IAwake<P1, P2, P3, P4>;
-                if (iAwake == null)
-                {
-                    continue;
-                }
-
                 try
                 {
-                    iAwake.Run(component, p1, p2, p3, p4);
+	                aAwakeSystem.Run(component, p1, p2, p3, p4);
                 }
                 catch (Exception e)
                 {
@@ -407,7 +397,7 @@ namespace ET
 					continue;
 				}
 				
-				List<ILoadSystem> iLoadSystems = this.loadSystems[component.GetType()];
+				List<object> iLoadSystems = this.typeSystems.GetSystems(component.GetType(), typeof (ILoadSystem));
 				if (iLoadSystems == null)
 				{
 					continue;
@@ -433,7 +423,7 @@ namespace ET
 
 		public void Destroy(Entity component)
 		{
-			List<IDestroySystem> iDestroySystems = this.destroySystems[component.GetType()];
+			List<object> iDestroySystems = this.typeSystems.GetSystems(component.GetType(), typeof (IDestroySystem));
 			if (iDestroySystems == null)
 			{
 				return;
@@ -472,7 +462,7 @@ namespace ET
 					continue;
 				}
 				
-				List<IUpdateSystem> iUpdateSystems = this.updateSystems[component.GetType()];
+				List<object> iUpdateSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IUpdateSystem));
 				if (iUpdateSystems == null)
 				{
 					continue;
@@ -510,13 +500,13 @@ namespace ET
 				{
 					continue;
 				}
-
-				List<ILateUpdateSystem> iLateUpdateSystems = this.lateUpdateSystems[component.GetType()];
+				
+				List<object> iLateUpdateSystems = this.typeSystems.GetSystems(component.GetType(), typeof (ILateUpdateSystem));
 				if (iLateUpdateSystems == null)
 				{
 					continue;
 				}
-
+				
 				this.lateUpdates2.Enqueue(instanceId);
 
 				foreach (ILateUpdateSystem iLateUpdateSystem in iLateUpdateSystems)

+ 94 - 79
Unity/Assets/Model/Core/Object/IAwakeSystem.cs

@@ -1,98 +1,113 @@
-using System;
+using System;
 
 namespace ET
 {
-	public interface IAwakeSystem
-	{
-		Type Type();
-	}
-
-	public interface IAwake
-	{
-		void Run(object o);
-	}
+    public interface IAwakeSystem: ISystemType
+    {
+        void Run(object o);
+    }
 	
-	public interface IAwake<A>
-	{
-		void Run(object o, A a);
-	}
+    public interface IAwakeSystem<A>: ISystemType
+    {
+        void Run(object o, A a);
+    }
 	
-	public interface IAwake<A, B>
-	{
-		void Run(object o, A a, B b);
-	}
+    public interface IAwakeSystem<A, B>: ISystemType
+    {
+        void Run(object o, A a, B b);
+    }
 	
-	public interface IAwake<A, B, C>
-	{
-		void Run(object o, A a, B b, C c);
-	}
+    public interface IAwakeSystem<A, B, C>: ISystemType
+    {
+        void Run(object o, A a, B b, C c);
+    }
 	
-	public interface IAwake<A, B, C, D>
-	{
-		void Run(object o, A a, B b, C c, D d);
-	}
+    public interface IAwakeSystem<A, B, C, D>: ISystemType
+    {
+        void Run(object o, A a, B b, C c, D d);
+    }
 
-	[ObjectSystem]
-	public abstract class AwakeSystem<T> : IAwakeSystem, IAwake
-	{
-		public Type Type()
-		{
-			return typeof(T);
-		}
+    [ObjectSystem]
+    public abstract class AwakeSystem<T> : IAwakeSystem
+    {
+        public Type Type()
+        {
+            return typeof(T);
+        }
+		
+        public Type SystemType()
+        {
+            return typeof(IAwakeSystem);
+        }
 
-		public void Run(object o)
-		{
-			this.Awake((T)o);
-		}
+        public void Run(object o)
+        {
+            this.Awake((T)o);
+        }
 
-		public abstract void Awake(T self);
-	}
+        public abstract void Awake(T self);
+    }
 
-	[ObjectSystem]
-	public abstract class AwakeSystem<T, A> : IAwakeSystem, IAwake<A>
-	{
-		public Type Type()
-		{
-			return typeof(T);
-		}
+    [ObjectSystem]
+    public abstract class AwakeSystem<T, A> : IAwakeSystem<A>
+    {
+        public Type Type()
+        {
+            return typeof(T);
+        }
+		
+        public Type SystemType()
+        {
+            return typeof(IAwakeSystem<A>);
+        }
 
-		public void Run(object o, A a)
-		{
-			this.Awake((T)o, a);
-		}
+        public void Run(object o, A a)
+        {
+            this.Awake((T)o, a);
+        }
 
-		public abstract void Awake(T self, A a);
-	}
+        public abstract void Awake(T self, A a);
+    }
 
-	[ObjectSystem]
-	public abstract class AwakeSystem<T, A, B> : IAwakeSystem, IAwake<A, B>
-	{
-		public Type Type()
-		{
-			return typeof(T);
-		}
+    [ObjectSystem]
+    public abstract class AwakeSystem<T, A, B> : IAwakeSystem<A, B>
+    {
+        public Type Type()
+        {
+            return typeof(T);
+        }
+		
+        public Type SystemType()
+        {
+            return typeof(IAwakeSystem<A, B>);
+        }
 
-		public void Run(object o, A a, B b)
-		{
-			this.Awake((T)o, a, b);
-		}
+        public void Run(object o, A a, B b)
+        {
+            this.Awake((T)o, a, b);
+        }
 
-		public abstract void Awake(T self, A a, B b);
-	}
+        public abstract void Awake(T self, A a, B b);
+    }
 
-	[ObjectSystem]
-	public abstract class AwakeSystem<T, A, B, C> : IAwakeSystem, IAwake<A, B, C>
-	{
-		public Type Type()
-		{
-			return typeof(T);
-		}
+    [ObjectSystem]
+    public abstract class AwakeSystem<T, A, B, C> : IAwakeSystem<A, B, C>
+    {
+        public Type Type()
+        {
+            return typeof(T);
+        }
+		
+        public Type SystemType()
+        {
+            return typeof(IAwakeSystem<A, B, C>);
+        }
 
-		public void Run(object o, A a, B b, C c)
-		{
-			this.Awake((T)o, a, b, c);
-		}
+        public void Run(object o, A a, B b, C c)
+        {
+            this.Awake((T)o, a, b, c);
+        }
 
-		public abstract void Awake(T self, A a, B b, C c);
-	}
-}
+        public abstract void Awake(T self, A a, B b, C c);
+    }
+}

+ 6 - 2
Unity/Assets/Model/Core/Object/IDeserializeSystem.cs

@@ -2,9 +2,8 @@
 
 namespace ET
 {
-	public interface IDeserializeSystem
+	public interface IDeserializeSystem: ISystemType
 	{
-		Type Type();
 		void Run(object o);
 	}
 
@@ -20,6 +19,11 @@ namespace ET
 		{
 			this.Deserialize((T)o);
 		}
+		
+		public Type SystemType()
+		{
+			return typeof(IDeserializeSystem);
+		}
 
 		public Type Type()
 		{

+ 6 - 2
Unity/Assets/Model/Core/Object/IDestroySystem.cs

@@ -2,9 +2,8 @@
 
 namespace ET
 {
-	public interface IDestroySystem
+	public interface IDestroySystem: ISystemType
 	{
-		Type Type();
 		void Run(object o);
 	}
 
@@ -15,6 +14,11 @@ namespace ET
 		{
 			this.Destroy((T)o);
 		}
+		
+		public Type SystemType()
+		{
+			return typeof(IDestroySystem);
+		}
 
 		public Type Type()
 		{

+ 6 - 2
Unity/Assets/Model/Core/Object/ILateUpdateSystem.cs

@@ -2,9 +2,8 @@
 
 namespace ET
 {
-	public interface ILateUpdateSystem
+	public interface ILateUpdateSystem: ISystemType
 	{
-		Type Type();
 		void Run(object o);
 	}
 
@@ -20,6 +19,11 @@ namespace ET
 		{
 			return typeof(T);
 		}
+		
+		public Type SystemType()
+		{
+			return typeof(ILateUpdateSystem);
+		}
 
 		public abstract void LateUpdate(T self);
 	}

+ 7 - 3
Unity/Assets/Model/Core/Object/ILoadSystem.cs

@@ -2,9 +2,8 @@
 
 namespace ET
 {
-	public interface ILoadSystem
+	public interface ILoadSystem: ISystemType
 	{
-		Type Type();
 		void Run(object o);
 	}
 
@@ -15,11 +14,16 @@ namespace ET
 		{
 			this.Load((T)o);
 		}
-
+		
 		public Type Type()
 		{
 			return typeof(T);
 		}
+		
+		public Type SystemType()
+		{
+			return typeof(ILoadSystem);
+		}
 
 		public abstract void Load(T self);
 	}

+ 10 - 0
Unity/Assets/Model/Core/Object/ISystemType.cs

@@ -0,0 +1,10 @@
+using System;
+
+namespace ET
+{
+    public interface ISystemType
+    {
+        Type Type();
+        Type SystemType();
+    }
+}

+ 11 - 0
Unity/Assets/Model/Core/Object/ISystemType.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7a41991127e6045fbbf74a261c4622c6
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 6 - 2
Unity/Assets/Model/Core/Object/IUpdateSystem.cs

@@ -2,9 +2,8 @@
 
 namespace ET
 {
-	public interface IUpdateSystem
+	public interface IUpdateSystem: ISystemType
 	{
-		Type Type();
 		void Run(object o);
 	}
 
@@ -20,6 +19,11 @@ namespace ET
 		{
 			return typeof(T);
 		}
+		
+		public Type SystemType()
+		{
+			return typeof(IUpdateSystem);
+		}
 
 		public abstract void Update(T self);
 	}

+ 14 - 85
Unity/Assets/Model/Core/UnOrderMultiMap.cs

@@ -1,71 +1,26 @@
-using System.Collections.Generic;
-using System.Linq;
+using System;
+using System.Collections.Generic;
 
 namespace ET
 {
-	public class UnOrderMultiMap<T, K>
+	public class UnOrderMultiMap<T, K>: Dictionary<T, List<K>>
 	{
-		private readonly Dictionary<T, List<K>> dictionary = new Dictionary<T, List<K>>();
-
-		// 重用list
-		private readonly Queue<List<K>> queue = new Queue<List<K>>();
-
-		public Dictionary<T, List<K>> GetDictionary()
-		{
-			return this.dictionary;
-		}
-
 		public void Add(T t, K k)
 		{
 			List<K> list;
-			this.dictionary.TryGetValue(t, out list);
+			this.TryGetValue(t, out list);
 			if (list == null)
 			{
-				list = this.FetchList();
-				this.dictionary[t] = list;
+				list = new List<K>();
+				base[t] = list;
 			}
 			list.Add(k);
 		}
 
-		public KeyValuePair<T, List<K>> First()
-		{
-			return this.dictionary.First();
-		}
-
-		public int Count
-		{
-			get
-			{
-				return this.dictionary.Count;
-			}
-		}
-
-		private List<K> FetchList()
-		{
-			if (this.queue.Count > 0)
-			{
-				List<K> list = this.queue.Dequeue();
-				list.Clear();
-				return list;
-			}
-			return new List<K>();
-		}
-
-		private void RecycleList(List<K> list)
-		{
-			// 防止暴涨
-			if (this.queue.Count > 100)
-			{
-				return;
-			}
-			list.Clear();
-			this.queue.Enqueue(list);
-		}
-
 		public bool Remove(T t, K k)
 		{
 			List<K> list;
-			this.dictionary.TryGetValue(t, out list);
+			this.TryGetValue(t, out list);
 			if (list == null)
 			{
 				return false;
@@ -76,23 +31,11 @@ namespace ET
 			}
 			if (list.Count == 0)
 			{
-				this.RecycleList(list);
-				this.dictionary.Remove(t);
+				this.Remove(t);
 			}
 			return true;
 		}
 
-		public bool Remove(T t)
-		{
-			List<K> list = null;
-			this.dictionary.TryGetValue(t, out list);
-			if (list != null)
-			{
-				this.RecycleList(list);
-			}
-			return this.dictionary.Remove(t);
-		}
-
 		/// <summary>
 		/// 不返回内部的list,copy一份出来
 		/// </summary>
@@ -101,10 +44,10 @@ namespace ET
 		public K[] GetAll(T t)
 		{
 			List<K> list;
-			this.dictionary.TryGetValue(t, out list);
+			this.TryGetValue(t, out list);
 			if (list == null)
 			{
-				return new K[0];
+				return Array.Empty<K>();
 			}
 			return list.ToArray();
 		}
@@ -114,12 +57,12 @@ namespace ET
 		/// </summary>
 		/// <param name="t"></param>
 		/// <returns></returns>
-		public List<K> this[T t]
+		public new List<K> this[T t]
 		{
 			get
 			{
 				List<K> list;
-				this.dictionary.TryGetValue(t, out list);
+				this.TryGetValue(t, out list);
 				return list;
 			}
 		}
@@ -127,7 +70,7 @@ namespace ET
 		public K GetOne(T t)
 		{
 			List<K> list;
-			this.dictionary.TryGetValue(t, out list);
+			this.TryGetValue(t, out list);
 			if (list != null && list.Count > 0)
 			{
 				return list[0];
@@ -138,26 +81,12 @@ namespace ET
 		public bool Contains(T t, K k)
 		{
 			List<K> list;
-			this.dictionary.TryGetValue(t, out list);
+			this.TryGetValue(t, out list);
 			if (list == null)
 			{
 				return false;
 			}
 			return list.Contains(k);
 		}
-
-		public bool ContainsKey(T t)
-		{
-			return this.dictionary.ContainsKey(t);
-		}
-
-		public void Clear()
-		{
-			foreach (KeyValuePair<T, List<K>> keyValuePair in this.dictionary)
-			{
-				this.RecycleList(keyValuePair.Value);
-			}
-			this.dictionary.Clear();
-		}
 	}
 }