2021-04-08 20:09:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* 封装MultiMap,用于重用
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public class MultiMapComponent<T, K>: Entity
|
|
|
|
|
{
|
|
|
|
|
public MultiMap<T, K> MultiMap = new MultiMap<T, K>();
|
|
|
|
|
|
|
|
|
|
public override void Dispose()
|
|
|
|
|
{
|
|
|
|
|
if (this.IsDisposed)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base.Dispose();
|
|
|
|
|
|
|
|
|
|
this.MultiMap.Clear();
|
|
|
|
|
}
|
2021-04-13 20:39:32 +08:00
|
|
|
|
} public class UnOrderMultiMapComponent<T, K>: Object
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-13 20:39:32 +08:00
|
|
|
|
private bool isDispose;
|
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
public UnOrderMultiMap<T, K> MultiMap = new UnOrderMultiMap<T, K>();
|
2021-04-13 20:39:32 +08:00
|
|
|
|
public static UnOrderMultiMapComponent<T, K> Create()
|
|
|
|
|
{
|
|
|
|
|
UnOrderMultiMapComponent<T, K> listComponent = ObjectPool.Instance.Fetch<UnOrderMultiMapComponent<T, K>>();
|
|
|
|
|
listComponent.isDispose = false;
|
|
|
|
|
return listComponent;
|
|
|
|
|
}
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
|
|
|
|
public override void Dispose()
|
|
|
|
|
{
|
2021-04-13 20:39:32 +08:00
|
|
|
|
if (this.isDispose)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-13 20:39:32 +08:00
|
|
|
|
this.isDispose = true;
|
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
base.Dispose();
|
2021-04-13 20:39:32 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
this.MultiMap.Clear();
|
2021-04-13 20:39:32 +08:00
|
|
|
|
ObjectPool.Instance.Recycle(this);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|