/// <summary> /// 获取匹配分页集合 /// </summary> /// <param name="pageSize">分页长度</param> /// <param name="currentPage">当前页号</param> /// <param name="isValue">数据匹配器</param> /// <param name="count">匹配数据总数</param> /// <returns>匹配分页集合</returns> internal list <valueType> GetArrayPage(int pageSize, int currentPage, func <valueType, bool> isValue, out int count) { int valueCount = 0; array.page page = new array.page(Array.Length, pageSize, currentPage); int currentPageSize = page.CurrentPageSize; list <valueType> .unsafer values = new list <valueType>(page.CurrentPageSize).Unsafer; int skipCount = page.SkipCount; currentPageSize += skipCount; foreach (valueType value in Array) { if (isValue(value)) { if (valueCount >= skipCount && valueCount < currentPageSize) { values.Add(value); } ++valueCount; } } count = valueCount; return(values.List); }
/// <summary> /// 获取分页记录集合 /// </summary> /// <typeparam name="arrayType"></typeparam> /// <param name="getValue">数组转换</param> /// <param name="pageSize">分页长度</param> /// <param name="currentPage">分页页号</param> /// <param name="count">记录总数</param> /// <returns></returns> public arrayType[] GetPageDesc <arrayType>(Func <valueType, arrayType> getValue, int pageSize, int currentPage, out int count) { if (getValue == null) { fastCSharp.log.Default.Throw(fastCSharp.log.exceptionType.Null); } Monitor.Enter(SqlTool.Lock); try { array.page page = new array.page(count = Count, pageSize, currentPage); arrayType[] values = new arrayType[page.CurrentPageSize]; int startIndex = this.getIndex(Count - page.SkipCount - page.CurrentPageSize); for (int writeIndex = values.Length, index = startIndex; writeIndex != 0; ++index) { valueType value = this.values[index]; while (value == null) { value = this.values[++index]; } values[--writeIndex] = getValue(value); } return(values); } finally { Monitor.Exit(SqlTool.Lock); } }
/// <summary> /// 分页排序 /// </summary> /// <param name="array">数组子串</param> /// <param name="pageSize">分页尺寸</param> /// <param name="currentPage">页号</param> /// <returns>分页排序数据</returns> public static subArray </*Type[0]*/ ulong /*Type[0]*/> getPageSort/*Compare[0]*//*Compare[0]*/ (this subArray </*Type[0]*/ ulong /*Type[0]*/> array, int pageSize, int currentPage) { array.page page = new array.page(array.Count, pageSize, currentPage); int getCount = page.CurrentPageSize; if (getCount != 0) { return(fastCSharp.algorithm.quickSort.GetRangeSort/*Compare[0]*//*Compare[0]*/ (array.UnsafeArray, array.StartIndex, array.Count, page.SkipCount, getCount)); } return(default(subArray </*Type[0]*/ ulong /*Type[0]*/>)); }
/// <summary> /// 分页排序 /// </summary> /// <param name="list">待排序单向动态数组</param> /// <param name="pageSize">分页尺寸</param> /// <param name="currentPage">页号</param> /// <returns>分页排序数据</returns> public static collection </*Type[0]*/ ulong /*Type[0]*/> getPageSort/*Compare[0]*//*Compare[0]*/ (this list </*Type[0]*/ ulong /*Type[0]*/> list, int pageSize, int currentPage) { array.page page = new array.page(list.count(), pageSize, currentPage); int count = page.CurrentPageSize; if (count != 0) { return(algorithm.quickSort.GetRangeSort/*Compare[0]*//*Compare[0]*/ (list.Unsafer.Array, page.SkipCount, count)); } return(null); }
/// <summary> /// 获取分页数据集合 /// </summary> /// <param name="pageSize">分页大小</param> /// <param name="currentPage">分页页号</param> /// <param name="count">数据总数</param> /// <returns>分页数据集合</returns> public valueType[] GetPage(int pageSize, int currentPage, out int count) { valueType[] values = null; count = 0; Monitor.Enter(cache.SqlTool.Lock); try { array.page page = new array.page(count = tree.Count, pageSize, currentPage); values = tree.GetRange(page.SkipCount, page.CurrentPageSize); } finally { Monitor.Exit(cache.SqlTool.Lock); } return(values); }
/// <summary> /// 获取逆序分页数据集合 /// </summary> /// <typeparam name="arrayType"></typeparam> /// <param name="getValue"></param> /// <param name="pageSize">分页大小</param> /// <param name="currentPage">分页页号</param> /// <param name="count">数据总数</param> /// <returns>逆序分页数据集合</returns> public arrayType[] GetPageDesc <arrayType>(Func <valueType, arrayType> getValue, int pageSize, int currentPage, out int count) { arrayType[] values = null; count = 0; Monitor.Enter(cache.SqlTool.Lock); try { array.page page = new array.page(count = tree.Count, pageSize, currentPage); values = tree.GetRange(count - page.SkipCount - page.CurrentPageSize, page.CurrentPageSize, getValue); } finally { Monitor.Exit(cache.SqlTool.Lock); } return(values.reverse()); }
/// <summary> /// 获取逆序分页数据集合 /// </summary> /// <typeparam name="arrarType"></typeparam> /// <param name="index"></param> /// <param name="getValue"></param> /// <param name="pageSize">分页大小</param> /// <param name="currentPage">分页页号</param> /// <param name="count">数据总数</param> /// <returns>逆序分页数据集合</returns> public arrarType[] GetPageDesc <arrarType>(int index, Func <valueType, arrarType> getValue, int pageSize, int currentPage, out int count) { arrarType[] values = null; count = 0; fastCSharp.searchTree <sortType, valueType> tree = array[index].Value; if (tree != null) { Monitor.Enter(cache.SqlTool.Lock); try { array.page page = new array.page(count = tree.Count, pageSize, currentPage); values = tree.GetRange(count - page.SkipCount - page.CurrentPageSize, page.CurrentPageSize, getValue); } finally { Monitor.Exit(cache.SqlTool.Lock); } } return(values.reverse()); }
/// <summary> /// 获取逆序分页数据集合 /// </summary> /// <param name="key">关键字</param> /// <param name="pageSize">分页大小</param> /// <param name="currentPage">分页页号</param> /// <param name="count">数据总数</param> /// <returns>逆序分页数据集合</returns> public valueType[] GetPageDesc(keyType key, int pageSize, int currentPage, out int count) { valueType[] values = null; count = 0; Monitor.Enter(cache.SqlTool.Lock); try { list <valueType> list = get(key); if (list != null) { array.page page = new array.page(count = list.Count, pageSize, currentPage); values = list.GetSub(count - page.SkipCount - page.CurrentPageSize, page.CurrentPageSize); } } finally { Monitor.Exit(cache.SqlTool.Lock); } return(values.reverse()); }
///// <summary> ///// 获取逆序数据集合 ///// </summary> ///// <param name="key">关键字</param> ///// <returns>逆序数据集合</returns> //[MethodImpl((MethodImplOptions)fastCSharp.pub.MethodImplOptionsAggressiveInlining)] //public valueType[] GetArrayDesc(keyType key) //{ // return GetArray(key).reverse(); //} /// <summary> /// 获取逆序分页数据集合 /// </summary> /// <param name="key">关键字</param> /// <param name="pageSize">分页大小</param> /// <param name="currentPage">分页页号</param> /// <param name="count">数据总数</param> /// <returns>逆序分页数据集合</returns> public valueType[] GetPageDesc(keyType key, int pageSize, int currentPage, out int count) { valueType[] values = null; count = 0; fastCSharp.searchTree <sortType, valueType> tree; Monitor.Enter(cache.SqlTool.Lock); try { if (groups.TryGetValue(key, out tree)) { array.page page = new array.page(count = tree.Count, pageSize, currentPage); values = tree.GetRange(count - page.SkipCount - page.CurrentPageSize, page.CurrentPageSize); } } finally { Monitor.Exit(cache.SqlTool.Lock); } return(values.reverse()); }
/// <summary> /// 获取分页记录集合 /// </summary> /// <param name="pageSize">分页长度</param> /// <param name="currentPage">分页页号</param> /// <param name="count">记录总数</param> /// <returns>分页记录集合</returns> public valueType[] GetPageDesc(int pageSize, int currentPage, out int count) { Monitor.Enter(SqlTool.Lock); try { array.page page = new array.page(count = Count, pageSize, currentPage); valueType[] values = new valueType[page.CurrentPageSize]; for (int writeIndex = values.Length, index = getIndex(Count - page.SkipCount - page.CurrentPageSize); writeIndex != 0; values[--writeIndex] = this.values[index++]) { while (this.values[index] == null) { ++index; } } return(values); } finally { Monitor.Exit(SqlTool.Lock); } }
/// <summary> /// 获取逆序分页数据集合 /// </summary> /// <param name="key">关键字</param> /// <param name="pageSize">分页大小</param> /// <param name="currentPage">分页页号</param> /// <param name="isValue">数据匹配器,禁止锁操作</param> /// <param name="count">数据总数</param> /// <returns>逆序分页数据集合</returns> public subArray <valueType> GetPageDescLock (keyType key, int pageSize, int currentPage, Func <valueType, bool> isValue, out int count) { subArray <valueType> values = default(subArray <valueType>); count = 0; Monitor.Enter(cache.SqlTool.Lock); try { list <valueType> list = get(key); if (list != null) { valueType[] array = list.UnsafeArray; array.page page = new array.page(list.Count, pageSize, currentPage); for (int index = list.Count, skipCount = page.SkipCount, getCount = page.CurrentPageSize; --index >= 0;) { valueType value = array[index]; if (isValue(value)) { if (skipCount == 0) { if (getCount != 0) { if (values.UnsafeArray == null) { values = new subArray <valueType>(page.CurrentPageSize); } values.Add(value); --getCount; } } else { --skipCount; } ++count; } } } } finally { Monitor.Exit(cache.SqlTool.Lock); } return(values); }
public arrayType[] GetPageDesc <arrayType>(Func <valueType, arrayType> getValue, int pageSize, int currentPage, out int count) { if (getValue == null) { fastCSharp.log.Default.Throw(fastCSharp.log.exceptionType.Null); } array.page page = new array.page(count = length, pageSize, currentPage); if (page.CurrentPageSize != 0) { arrayType[] values = new arrayType[page.CurrentPageSize]; int startIndex = this.startIndex + page.DescSkipCount, readIndex = startIndex + page.CurrentPageSize, writeIndex = 0; do { values[writeIndex++] = getValue(array[--readIndex]); }while (readIndex != startIndex); return(values); } return(nullValue <arrayType> .Array); }
/// <summary> /// 获取分页数据集合 /// </summary> /// <param name="key">关键字</param> /// <param name="pageSize">分页大小</param> /// <param name="currentPage">分页页号</param> /// <param name="count">数据总数</param> /// <returns>分页数据集合</returns> public valueType[] GetPage(keyType key, int pageSize, int currentPage, out int count) { valueType[] values = null; Monitor.Enter(cache.SqlTool.Lock); try { list <valueType> list = get(key); if (list == null) { count = 0; } else { array.page page = new array.page(count = list.Count, pageSize, currentPage); values = list.GetSub(page.SkipCount, page.CurrentPageSize); } } finally { Monitor.Exit(cache.SqlTool.Lock); } return(values ?? nullValue <valueType> .Array); }
/// <summary> /// 获取逆序分页数据集合 /// </summary> /// <param name="key">关键字</param> /// <param name="pageSize">分页大小</param> /// <param name="currentPage">分页页号</param> /// <param name="isValue">数据匹配器,禁止锁操作</param> /// <param name="count">数据总数</param> /// <returns>逆序分页数据集合</returns> public list <valueType> GetPageDescLock (keyType key, int pageSize, int currentPage, func <valueType, bool> isValue, out int count) { list <valueType> values = null; count = 0; Monitor.Enter(cache.SqlTool.Lock); try { list <valueType> list = get(key); if (list != null) { valueType[] array = list.Unsafer.Array; array.page page = new array.page(count = list.Count, pageSize, currentPage); list <valueType> .unsafer valueList = new list <valueType>(pageSize).Unsafer; for (int index = list.Count, skipCount = page.SkipCount, getCount = page.CurrentPageSize; --index >= 0;) { valueType value = array[index]; if (isValue(value)) { if (skipCount == 0) { valueList.Add(value); if (--getCount == 0) { break; } } else { --skipCount; } } } values = valueList.List; } } finally { Monitor.Exit(cache.SqlTool.Lock); } return(values); }
/// <summary> /// 分页排序 /// </summary> /// <param name="array">待排序数组</param> /// <param name="pageSize">分页尺寸</param> /// <param name="currentPage">页号</param> /// <returns>分页排序数据</returns> public static collection </*Type[0]*/ ulong /*Type[0]*/> getPageSort/*Compare[0]*//*Compare[0]*/ (this /*Type[0]*/ ulong /*Type[0]*/[] array, int pageSize, int currentPage) { array.page page = new array.page(array.length(), pageSize, currentPage); return(algorithm.quickSort.GetRangeSort/*Compare[0]*//*Compare[0]*/ (array, page.SkipCount, page.CurrentPageSize)); }
/// <summary> /// 分页排序 /// </summary> /// <param name="array">待排序数组</param> /// <param name="pageSize">分页尺寸</param> /// <param name="currentPage">页号</param> /// <returns>分页排序数据</returns> public static valueType[] getPageSort/*Compare[0]*//*Compare[0]*/ <valueType> (this valueType[] array, func <valueType, /*Type[0]*/ ulong /*Type[0]*/> getKey, int pageSize, int currentPage) { array.page page = new array.page(array.length(), pageSize, currentPage); return(algorithm.quickSort.GetRangeSort/*Compare[0]*//*Compare[0]*/ (array, getKey, page.SkipCount, page.CurrentPageSize)); }
public valueType[] GetPageDesc(int pageSize, int currentPage, out int count) { array.page page = new array.page(count = length, pageSize, currentPage); return(subArray <valueType> .Unsafe(array, startIndex + page.DescSkipCount, page.CurrentPageSize).GetReverse()); }
public subArray <valueType> PageDesc(int pageSize, int currentPage) { array.page page = new array.page(length, pageSize, currentPage); return(subArray <valueType> .Unsafe(array, startIndex + page.DescSkipCount, page.CurrentPageSize).Reverse()); }
public subArray <valueType> Page(int pageSize, int currentPage, out int count) { array.page page = new array.page(count = length, pageSize, currentPage); return(subArray <valueType> .Unsafe(array, startIndex + page.SkipCount, page.CurrentPageSize)); }
public static valueType[] getPageSort/*Compare[0]*//*Compare[0]*/ <valueType> (this subArray <valueType> array, Func <valueType, /*Type[0]*/ ulong /*Type[0]*/> getKey, int pageSize, int currentPage, out int count) { array.page page = new array.page(count = array.Count, pageSize, currentPage); return(fastCSharp.algorithm.quickSort.GetRangeSort/*Compare[0]*//*Compare[0]*/ (array.UnsafeArray, 0, count, getKey, page.SkipCount, page.CurrentPageSize)); }
public static subArray </*Type[0]*/ ulong /*Type[0]*/> pageSort/*Compare[0]*//*Compare[0]*/ (this /*Type[0]*/ ulong /*Type[0]*/[] array, int pageSize, int currentPage) { array.page page = new array.page(array.length(), pageSize, currentPage); return(fastCSharp.algorithm.quickSort.RangeSort/*Compare[0]*//*Compare[0]*/ (array, page.SkipCount, page.CurrentPageSize)); }