Пример #1
0
 public void Recycle(ref DictionaryCopyable <TKey, TValue> value)
 {
     if (value != null)
     {
         PoolDictionaryCopyable <TKey, TValue> .Recycle(ref value);
     }
 }
Пример #2
0
        public static void Copy <TKey, T, TCopy>(DictionaryCopyable <TKey, T> fromDic, ref DictionaryCopyable <TKey, T> dic, TCopy copy) where TCopy : IArrayElementCopy <T>
        {
            if (fromDic == null)
            {
                if (dic != null)
                {
                    foreach (var kv in dic)
                    {
                        copy.Recycle(kv.Value);
                    }

                    PoolDictionaryCopyable <TKey, T> .Recycle(ref dic);
                }

                dic = null;
                return;
            }

            if (dic == null || fromDic.Count != dic.Count)
            {
                if (dic != null)
                {
                    foreach (var kv in dic)
                    {
                        copy.Recycle(kv.Value);
                    }

                    PoolDictionaryCopyable <TKey, T> .Recycle(ref dic);
                }

                dic = PoolDictionaryCopyable <TKey, T> .Spawn(fromDic.Count);
            }

            dic.CopyFrom(fromDic, copy);
        }
Пример #3
0
        public static void Copy <TKey, T>(DictionaryCopyable <TKey, T> fromDic, ref DictionaryCopyable <TKey, T> dic)
        {
            if (fromDic == null)
            {
                if (dic != null)
                {
                    PoolDictionaryCopyable <TKey, T> .Recycle(ref dic);
                }

                dic = null;
                return;
            }

            if (dic == null || fromDic.Count != dic.Count)
            {
                if (dic != null)
                {
                    PoolDictionaryCopyable <TKey, T> .Recycle(ref dic);
                }

                dic = PoolDictionaryCopyable <TKey, T> .Spawn(fromDic.Count);
            }

            dic.CopyFrom(fromDic);
        }
Пример #4
0
 public void Set(DictionaryCopyable <TKey, TValue> value)
 {
     this.dataObject.Set(value);
 }
Пример #5
0
 public DataDictionary(DictionaryCopyable <TKey, TValue> data)
 {
     this.dataObject = new DataObject <DictionaryCopyable <TKey, TValue>, DataDictionaryProvider <TKey, TValue> >(data);
 }
Пример #6
0
        public void Clone(DictionaryCopyable <TKey, TValue> from, ref DictionaryCopyable <TKey, TValue> to)
        {
            to = PoolDictionaryCopyable <TKey, TValue> .Spawn(from.Count);

            ArrayUtils.Copy(from, ref to);
        }
 public static void Recycle(ref DictionaryCopyable <TKey, TValue> dic)
 {
     Pools.current.PoolRecycle(ref dic);
 }
Пример #8
0
 public FiltersCache(World world)
 {
     this.world = world;
     this.hash  = PoolDictionaryCopyable <int, HashSetCopyable <Entity> > .Spawn(100);
 }