Ejemplo n.º 1
0
 /// <summary>
 /// 获取数组
 /// </summary>
 /// <param name="array"></param>
 internal void GetDescArraySkip(ref PageArray <valueType> array)
 {
     if (Left != null)
     {
         int count = Left.Count;
         if (count > array.SkipCount)
         {
             Left.GetDescArraySkip(ref array);
             if (array.Index != 0 && array.AddDesc(Value) != 0)
             {
                 Right.getDescArray(ref array);
             }
             return;
         }
         array.SkipCount -= count;
     }
     if (array.SkipCount == 0)
     {
         if (array.AddDesc(Value) != 0)
         {
             Right.getDescArray(ref array);
         }
         return;
     }
     --array.SkipCount;
     Right.GetDescArraySkip(ref array);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取数组
 /// </summary>
 /// <typeparam name="arrayType"></typeparam>
 /// <param name="array"></param>
 internal void GetArraySkip <arrayType>(ref PageArray <valueType, arrayType> array)
 {
     if (Left != null)
     {
         int count = Left.Count;
         if (count > array.SkipCount)
         {
             Left.GetArraySkip(ref array);
             if (!array.IsArray && !array.Add(Value))
             {
                 Right.getArray(ref array);
             }
             return;
         }
         array.SkipCount -= count;
     }
     if (array.SkipCount == 0)
     {
         if (!array.Add(Value))
         {
             Right.getArray(ref array);
         }
         return;
     }
     --array.SkipCount;
     Right.GetArraySkip(ref array);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取范围数据集合
 /// </summary>
 /// <param name="skipCount">跳过记录数</param>
 /// <param name="getCount">获取记录数</param>
 /// <returns>数据集合</returns>
 internal valueType[] GetRange(int skipCount, int getCount)
 {
     if (Boot != null && skipCount < Boot.Count)
     {
         PageArray <valueType> array = new PageArray <valueType> {
             Array = new valueType[Math.Min(Boot.Count - skipCount, getCount)], SkipCount = skipCount
         };
         Boot.GetArraySkip(ref array);
         return(array.Array);
     }
     return(NullValue <valueType> .Array);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 获取逆序范围数据集合
 /// </summary>
 /// <param name="skipCount">跳过记录数</param>
 /// <param name="getCount">获取记录数</param>
 /// <returns>数据集合</returns>
 internal valueType[] GetRangeDesc(int skipCount, int getCount)
 {
     if (Boot != null && skipCount < Boot.Count)
     {
         getCount = Math.Min(Boot.Count - skipCount, getCount);
         PageArray <valueType> array = new PageArray <valueType> {
             Array = new valueType[getCount], SkipCount = Boot.Count - (skipCount + getCount), Index = getCount
         };
         Boot.GetDescArraySkip(ref array);
         return(array.Array);
     }
     return(NullValue <valueType> .Array);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 获取数组
 /// </summary>
 /// <param name="array"></param>
 private void getDescArray(ref PageArray <valueType> array)
 {
     if (Left != null)
     {
         Left.getDescArray(ref array);
         if (array.Index == 0)
         {
             return;
         }
     }
     if (array.AddDesc(Value) != 0)
     {
         Right.getDescArray(ref array);
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 获取数组
 /// </summary>
 /// <typeparam name="arrayType"></typeparam>
 /// <param name="array"></param>
 private void getArray <arrayType>(ref PageArray <valueType, arrayType> array)
 {
     if (Left != null)
     {
         Left.getArray(ref array);
         if (array.IsArray)
         {
             return;
         }
     }
     if (!array.Add(Value))
     {
         Right.getArray(ref array);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 获取分页数据
 /// </summary>
 /// <param name="pageSize">分页大小</param>
 /// <param name="page">分页号,从 1 开始</param>
 /// <param name="getValue">获取数据委托</param>
 /// <returns>分页数据</returns>
 internal arrayType[] GetPage <arrayType>(int pageSize, int page, Func <valueType, arrayType> getValue)
 {
     if (Boot != null)
     {
         int count = Boot.Count, skipCount = pageSize * (page - 1);
         if (skipCount < count)
         {
             PageArray <valueType, arrayType> array = new PageArray <valueType, arrayType> {
                 Array = new arrayType[Math.Min(count - skipCount, pageSize)], SkipCount = skipCount, GetValue = getValue
             };
             Boot.GetArraySkip(ref array);
             return(array.Array);
         }
     }
     return(NullValue <arrayType> .Array);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 获取分页数据
 /// </summary>
 /// <param name="pageSize">分页大小</param>
 /// <param name="page">分页号,从 1 开始</param>
 /// <returns>分页数据</returns>
 internal valueType[] GetPage(int pageSize, int page)
 {
     if (Boot != null)
     {
         int count = Boot.Count, skipCount = pageSize * (page - 1);
         if (skipCount < count)
         {
             PageArray <valueType> array = new PageArray <valueType> {
                 Array = new valueType[Math.Min(count - skipCount, pageSize)], SkipCount = skipCount
             };
             Boot.GetArraySkip(ref array);
             return(array.Array);
         }
     }
     return(EmptyArray <valueType> .Array);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 获取逆序分页数据
 /// </summary>
 /// <param name="pageSize">分页大小</param>
 /// <param name="page">分页号,从 1 开始</param>
 /// <returns>分页数据</returns>
 internal valueType[] GetPageDesc(int pageSize, int page)
 {
     if (Boot != null)
     {
         int count = Boot.Count, skipCount = pageSize * (page - 1);
         if (skipCount < count)
         {
             pageSize = Math.Min(count - skipCount, pageSize);
             PageArray <valueType> array = new PageArray <valueType> {
                 Array = new valueType[pageSize], SkipCount = count - (skipCount + pageSize), Index = pageSize
             };
             Boot.GetDescArraySkip(ref array);
             return(array.Array);
         }
     }
     return(NullValue <valueType> .Array);
 }