private int[][] Sort(int[][] jaggedArray, FuncFilter filter, OrderdBy orderdBy) { if (jaggedArray == null) { throw new ArgumentNullException(nameof(jaggedArray)); } if (filter == null) { throw new ArgumentNullException(nameof(filter)); } int length = jaggedArray.Length; int[] filterArray = new int[length]; for (int i = 0; i < length; i++) { filterArray[i] = filter(jaggedArray[i]); } BubbleSort(jaggedArray, filterArray, GetOrderBy(orderdBy)); return(jaggedArray); }
DataTable FilterChartDataPoints(DataTable table, IEnumerable <FRange> ranges) { DataTable ft = InitChartTable(); IEnumerable <FPoint> points = table.AsEnumerable().Select(r => new FPoint((int)r["Months"], (int)r["Score"])); foreach (FPoint p in FuncFilter.Filter(points, ranges)) { AddDataPoint(ft, (int)p.x, (int)p.y); } return(ft); }
private static Polynomial FactoryInitialization(Polynomial first, Polynomial second, FuncFilter filter, FuncFilterFromMinLengthToMaxLength maxFilter = null) { if (first == null) { throw new ArgumentNullException(nameof(first)); } if (second == null) { throw new ArgumentNullException(nameof(second)); } int firstLength = first._coefficients.Length; int secondLength = second._coefficients.Length; int minLength = firstLength < secondLength ? firstLength : secondLength; int maxLength = firstLength > secondLength ? firstLength : secondLength; double[] firstCoefficients = first._coefficients; double[] secondCoefficients = second._coefficients; double[] result = new double[maxLength]; for (int i = 0; i < minLength; i++) { result[i] = filter(firstCoefficients[i], secondCoefficients[i]); } firstCoefficients = firstLength == maxLength ? firstCoefficients : secondCoefficients; bool IsFirstLengthMoreThanSecondLength = firstLength == maxLength ? true : false; for (int i = minLength; i < maxLength; i++) { result[i] = maxFilter != null? maxFilter(firstCoefficients[i], IsFirstLengthMoreThanSecondLength) : firstCoefficients[i]; } return(new Polynomial(result)); }
public static void PrintFuncFilter() { FuncFilter funcFilter = new FuncFilter(); funcFilter.QueryCities(); }