/// <summary> /// The method BubbleSort for sort jagged array delegate captured overloaded method /// with strategy by interface /// </summary> /// <param name="jArr">jagArr is incomming jagged array for sort</param> /// <param name="comparator">comparator is delegate point for /// sorting strategy method</param> /// <exception cref="ArgumentNullException">If incomming array, /// or delegate point is null</exception> public static void BubbleSort(int[][] jArr, Comparator comparator) { if (jArr == null) { throw new ArgumentNullException(nameof(jArr)); } if (comparator == null) { throw new ArgumentNullException(nameof(comparator)); } IComparer comparerAdapter = new ComparerAdapter(comparator); BubbleSort(jArr, comparerAdapter); }
/// <summary> /// Sort method with delegate as parameter /// </summary> /// <param name="arr">Jagged array</param> /// <param name="comparer">Second array</param> public static void Sort(int[][] arr, Comparison <int[]> comparer) { Compare(arr, ComparerAdapter.Create(comparer)); }