Ejemplo n.º 1
0
        /// <summary>
        /// 添加数据集合
        /// </summary>
        /// <param name="list">单向动态数组</param>
        /// <param name="values">数据集合</param>
        /// <returns>单向动态数组</returns>
        public unsafe static list </*Type[0]*/ ulong /*Type[0]*/> add
            (this list </*Type[0]*/ ulong /*Type[0]*/> list, System.Collections.Generic.ICollection </*Type[0]*/ ulong /*Type[0]*/> values)
        {
            if (list != null)
            {
                int count = values.count();
                if (count != 0)
                {
                    int index = list.Count;
                    list.AddLength(count);
                    fixed(/*Type[0]*/ ulong /*Type[0]*/ *valueFixed = list.Unsafer.Array)
                    {
                        /*Type[0]*/
                        ulong /*Type[0]*/ *write = valueFixed + index;

                        foreach (/*Type[0]*/ ulong /*Type[0]*/ nextValue in values)
                        {
                            *write++ = nextValue;
                        }
                    }
                }
                return(list);
            }
            return(values.getList());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据集合内容返回数组
        /// </summary>
        /// <typeparam name="valueType">枚举值类型</typeparam>
        /// <param name="values">值集合</param>
        /// <param name="getValue">获取数组值的委托</param>
        /// <returns>数组</returns>
        public unsafe static /*Type[0]*/ ulong /*Type[0]*/[] getArray <valueType>
            (this System.Collections.Generic.ICollection <valueType> values, func <valueType, /*Type[0]*/ ulong /*Type[0]*/> getValue)
        {
            if (values.count() != 0)
            {
                if (getValue == null)
                {
                    log.Default.Throw(log.exceptionType.Null);
                }
                /*Type[0]*/
                ulong /*Type[0]*/[] newValues = new /*Type[0]*/ ulong /*Type[0]*/[values.Count];
                fixed(/*Type[0]*/ ulong /*Type[0]*/ *newValueFixed = newValues)
                {
                    /*Type[0]*/
                    ulong /*Type[0]*/ *write = newValueFixed;

                    foreach (valueType value in values)
                    {
                        *write++ = getValue(value);
                    }
                }

                return(newValues);
            }
            return(nullValue </*Type[0]*/ ulong /*Type[0]*/> .Array);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取最小值记录
 /// </summary>
 /// <typeparam name="valueType">值类型</typeparam>
 /// <param name="values">值集合</param>
 /// <param name="getKey">获取排序键的委托</param>
 /// <param name="key">最小值</param>
 /// <returns>是否存在最小值</returns>
 public static bool minKey <valueType>
     (this System.Collections.Generic.ICollection <valueType> values, func <valueType, /*Type[0]*/ ulong /*Type[0]*/> getKey
     , out /*Type[0]*/ ulong /*Type[0]*/ key)
 {
     if (values.count() != 0)
     {
         if (getKey == null)
         {
             log.Default.Throw(log.exceptionType.Null);
         }
         valueType value = default(valueType);
         int       count = -1;
         key = /*Type[0]*/ ulong /*Type[0]*/.MaxValue;
         foreach (valueType nextValue in values)
         {
             if (++count == 0)
             {
                 key = getKey(value = nextValue);
             }
             else
             {
                 /*Type[0]*/
                 ulong /*Type[0]*/ nextKey = getKey(nextValue);
                 if (nextKey < key)
                 {
                     value = nextValue;
                     key   = nextKey;
                 }
             }
         }
         return(true);
     }
     key = default(/*Type[0]*/ ulong /*Type[0]*/);
     return(false);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 查找符合条件的记录集合
        /// </summary>
        /// <param name="values">值集合</param>
        /// <param name="isValue">判断记录是否符合条件的委托</param>
        /// <returns>符合条件的记录集合</returns>
        public unsafe static list </*Type[0]*/ ulong /*Type[0]*/> getFind
            (this System.Collections.Generic.ICollection </*Type[0]*/ ulong /*Type[0]*/> values, func </*Type[0]*/ ulong /*Type[0]*/, bool> isValue)
        {
            if (values.count() != 0)
            {
                if (isValue == null)
                {
                    log.Default.Throw(log.exceptionType.Null);
                }
                /*Type[0]*/
                ulong /*Type[0]*/[] newValues = new /*Type[0]*/ ulong /*Type[0]*/[values.Count];
                fixed(/*Type[0]*/ ulong /*Type[0]*/ *newValueFixed = newValues)
                {
                    /*Type[0]*/
                    ulong /*Type[0]*/ *write = newValueFixed;

                    foreach (/*Type[0]*/ ulong /*Type[0]*/ value in values)
                    {
                        if (isValue(value))
                        {
                            *write++ = value;
                        }
                    }
                    return(new list </*Type[0]*/ ulong /*Type[0]*/>(newValues, 0, (int)(write - newValueFixed), true));
                }
            }
            return(null);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 查找符合条件的记录集合
        /// </summary>
        /// <param name="values">值集合</param>
        /// <param name="isValue">判断记录是否符合条件的委托</param>
        /// <returns>符合条件的记录集合</returns>
        public static LeftArray </*Type[0]*/ ulong /*Type[0]*/> getFind(this System.Collections.Generic.ICollection </*Type[0]*/ ulong /*Type[0]*/> values, Func </*Type[0]*/ ulong /*Type[0]*/, bool> isValue)
        {
            if (values.count() == 0)
            {
                return(default(LeftArray </*Type[0]*/ ulong /*Type[0]*/>));
            }
            /*Type[0]*/
            ulong /*Type[0]*/[] newValues = new /*Type[0]*/ ulong /*Type[0]*/[values.Count];
            fixed(/*Type[0]*/ ulong /*Type[0]*/ *newValueFixed = newValues)
            {
                /*Type[0]*/
                ulong /*Type[0]*/ *write = newValueFixed;

                foreach (/*Type[0]*/ ulong /*Type[0]*/ value in values)
                {
                    if (isValue(value))
                    {
                        *write++ = value;
                    }
                }
                return(new LeftArray </*Type[0]*/ ulong /*Type[0]*/> {
                    Array = newValues, Length = (int)(write - newValueFixed)
                });
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 连接字符串
 /// </summary>
 /// <param name="values">数据集合</param>
 /// <returns>字符串</returns>
 public static string[] getString(this System.Collections.Generic.ICollection </*Type[0]*/ ulong /*Type[0]*/> values)
 {
     if (values.count() != 0)
     {
         string[] newValues = new string[values.Count];
         int      index     = 0;
         foreach (/*Type[0]*/ ulong /*Type[0]*/ nextValue in values)
         {
             newValues[index++] = number.toString(nextValue);
         }
         return(newValues);
     }
     return(nullValue <string> .Array);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 获取最小值记录
 /// </summary>
 /// <param name="values">值集合</param>
 /// <param name="value">最小值</param>
 /// <returns>是否存在最小值</returns>
 public static bool min
     (this System.Collections.Generic.ICollection </*Type[0]*/ ulong /*Type[0]*/> values, out /*Type[0]*/ ulong /*Type[0]*/ value)
 {
     if (values.count() != 0)
     {
         value = /*Type[0]*/ ulong /*Type[0]*/.MinValue;
         foreach (/*Type[0]*/ ulong /*Type[0]*/ nextValue in values)
         {
             if (nextValue < value)
             {
                 value = nextValue;
             }
         }
         return(true);
     }
     value = /*Type[0]*/ ulong /*Type[0]*/.MinValue;
     return(false);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 根据集合内容返回数组
        /// </summary>
        /// <typeparam name="valueType">枚举值类型</typeparam>
        /// <param name="values">值集合</param>
        /// <param name="getValue">获取数组值的委托</param>
        /// <returns>数组</returns>
        public static ulong[] getArray <valueType>(this System.Collections.Generic.ICollection <valueType> values, Func <valueType, ulong> getValue)
        {
            if (values.count() == 0)
            {
                return(EmptyArray <ulong> .Array);
            }
            ulong[] newValues = new ulong[values.Count];
            fixed(ulong *newValueFixed = newValues)
            {
                ulong *write = newValueFixed;

                foreach (valueType value in values)
                {
                    *write++ = getValue(value);
                }
            }

            return(newValues);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 根据集合内容返回数组
        /// </summary>
        /// <param name="values">值集合</param>
        /// <returns>数组</returns>
        public static ulong[] getArray(this System.Collections.Generic.ICollection <ulong> values)
        {
            if (values.count() == 0)
            {
                return(EmptyArray <ulong> .Array);
            }
            ulong[] newValues = new ulong[values.Count];
            fixed(ulong *newValueFixed = newValues)
            {
                ulong *write = newValueFixed;

                foreach (ulong value in values)
                {
                    *write++ = value;
                }
            }

            return(newValues);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 根据集合内容返回数组
        /// </summary>
        /// <typeparam name="valueType">枚举值类型</typeparam>
        /// <param name="values">值集合</param>
        /// <param name="getValue">获取数组值的委托</param>
        /// <returns>数组</returns>
        public static /*Type[0]*/ ulong /*Type[0]*/[] getArray <valueType>(this System.Collections.Generic.ICollection <valueType> values, Func <valueType, /*Type[0]*/ ulong /*Type[0]*/> getValue)
        {
            if (values.count() == 0)
            {
                return(NullValue </*Type[0]*/ ulong /*Type[0]*/> .Array);
            }
            /*Type[0]*/
            ulong /*Type[0]*/[] newValues = new /*Type[0]*/ ulong /*Type[0]*/[values.Count];
            fixed(/*Type[0]*/ ulong /*Type[0]*/ *newValueFixed = newValues)
            {
                /*Type[0]*/
                ulong /*Type[0]*/ *write = newValueFixed;

                foreach (valueType value in values)
                {
                    *write++ = getValue(value);
                }
            }

            return(newValues);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 根据集合内容返回数组
        /// </summary>
        /// <param name="values">值集合</param>
        /// <returns>数组</returns>
        public unsafe static /*Type[0]*/ ulong /*Type[0]*/[] getArray
            (this System.Collections.Generic.ICollection </*Type[0]*/ ulong /*Type[0]*/> values)
        {
            if (values.count() != 0)
            {
                /*Type[0]*/
                ulong /*Type[0]*/[] newValues = new /*Type[0]*/ ulong /*Type[0]*/[values.Count];
                fixed(/*Type[0]*/ ulong /*Type[0]*/ *newValueFixed = newValues)
                {
                    /*Type[0]*/
                    ulong /*Type[0]*/ *write = newValueFixed;

                    foreach (/*Type[0]*/ ulong /*Type[0]*/ value in values)
                    {
                        *write++ = value;
                    }
                }

                return(newValues);
            }
            return(nullValue </*Type[0]*/ ulong /*Type[0]*/> .Array);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 查找符合条件的记录集合
        /// </summary>
        /// <param name="values">值集合</param>
        /// <param name="isValue">判断记录是否符合条件的委托</param>
        /// <returns>符合条件的记录集合</returns>
        public static LeftArray <ulong> getFind(this System.Collections.Generic.ICollection <ulong> values, Func <ulong, bool> isValue)
        {
            if (values.count() == 0)
            {
                return(new LeftArray <ulong>(0));
            }
            ulong[] newValues = new ulong[values.Count];
            fixed(ulong *newValueFixed = newValues)
            {
                ulong *write = newValueFixed;

                foreach (ulong value in values)
                {
                    if (isValue(value))
                    {
                        *write++ = value;
                    }
                }
                return(new LeftArray <ulong> {
                    Array = newValues, Length = (int)(write - newValueFixed)
                });
            }
        }