Exemplo n.º 1
0
 /// <summary>
 /// 销毁子节点
 /// </summary>
 private void Purge(ref IntegerID <T> next, bool isDispose = true)
 {
     MaxID = 0;
     if (next != default && next.HasNext)
     {
         Utils.Reclaim(next);
     }
     next = default;
     if (isDispose)
     {
         Utils.Reclaim(ref mMap);
     }
     else
     {
         mMap.Clear();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 从子节点中查找id
        /// </summary>
        private int GetIDInNext(ref T target)
        {
            int           result = 0;
            IntegerID <T> next   = !HasNext?AddNext() : mNext;

            while (next != null)
            {
                result = next.GetID(ref target);
                if (result < int.MaxValue)
                {
                    return(result);
                }
                else
                {
                    next = next.Next;
                }
            }
            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 扩容
 /// </summary>
 private IntegerID <T> AddNext()
 {
     mNext = new IntegerID <T>();
     return(mNext);
 }
Exemplo n.º 4
0
 public IntegerMapper()
 {
     mIndexer = new IntegerID <MapperValueT>();
     mMapper  = new KeyValueList <int, MapperValueT>();
 }