/// <summary> /// Sort jagged array by the <see cref="CompareRows"/> method /// <remarks>null sub-arrays go to the end of jagged array</remarks> /// </summary> /// <param name="array">Jagged array for sorting</param> /// <param name="Compare">Method, which allow compare two sub-arrays</param> public static void Sort(int[][] array, CompareRows Compare) { if (array == null) throw new ArgumentNullException(nameof(array)); if (Compare == null) throw new ArgumentNullException(nameof(Compare)); for (int i = array.Length - 1; i > 0; i--) { for (int j = 0; j < i; j++) { if (Compare(array[j], array[j + 1]) > 0) { Swap(ref array[j], ref array[j + 1]); } } } }
/// <summary> /// Compares the columns. /// </summary> /// <param name="table">The table.</param> /// <param name="ColumnCompare">The column compare.</param> /// <param name="token">The token.</param> public static void CompareColumns(CompareRows comparer, DataTable table, CompareModel model, CancellationTokenSource token) { var items = model.ColumnCompare.Where(w => w.IsPair() && w.Selected); foreach (var item in items) { if (table.Columns.Contains(item.LeftKey) && table.Columns.Contains(item.RightKey)) { var currentRow = model.ColumnCompare.IndexOf(item); var results = comparer.CompareColumns(currentRow, table, item, model, token); } } }
private static void Main(string[] args) { //Documents CompareDocumentsWithTables.WithTablesOnAppropriatePages(); CompareDocumentsWithTables.WithTablesOnDefferentPages(); CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfColumns(); CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfColumnsAndDifferentCountOfRows(); CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfColumns(); CompareDocumentsWithTables.WithTablesWitchContainsDifferentCountOfRows(); CompareDocumentsWithText.WithTextOnAppropriatePages(); CompareDocumentsWithText.WithTextOnDifferentPages(); CompareDocumentsWithHyperlinks.WithIgnoreLinkSetting(); CompareDocumentsWithHyperlinks.WithoutIgnoreLinkSetting(); //Settings ComparisonWithDifferentSettings.CompareDocumentsWithComparisonDepthSetChars(); ComparisonWithDifferentSettings.CompareDocumentsWithComparisonDepthSetWords(); ComparisonWithDifferentSettings.CompareDocumentsWithGenerationSummaryPage(); ComparisonWithDifferentSettings.CompareDocumentsWithOutGenerationSummaryPage(); ComparisonWithDifferentSettings.CompareDocumentsWithOutShowDeletedContent(); ComparisonWithDifferentSettings.CompareDocumentsWithShowDeletedContent(); ComparisonWithDifferentSettings.CompareDocumentsWithWordsSepCharsSetSpace(); ComparisonWithDifferentSettings.CompareDocumentsWithSettingStylesOnDelInsComponents(); //Components CompareParagraphs.CompareParagraphsFromDifferentDocuments(); CompareParagraphs.CompareParagraphFromDocumentWithCreatingParagraph(); CompareParagraphs.CompareTwoCreatingParagraphs(); CompareRows.CompareRowsFromDifferentDocuments(); CompareRows.CompareRowFromDocumentWithCreatingRow(); CompareRows.CompareTwoCreatingRows(); CompareColumns.CompareColumnFromDocumentWithCreatingColumn(); CompareColumns.CompareColumnsFromDifferentDocuments(); CompareColumns.CompareTwoCreatingColumns(); CompareCells.CompareCellFromDocumentWithCreatingCell(); CompareCells.CompareCellsFromDifferentDocuments(); CompareCells.CompareTwoCreatingCells(); CompareTables.CompareTableFromDocumentWithCreatingTable(); CompareTables.CompareTablesFromDifferentDocuments(); CompareTables.CompareTwoCreatingTables(); //Console.ReadKey(); }
/// <summary> /// Sorts jagged array according to chosen method of sorting. /// </summary> /// <param name="array">Sorting array</param> /// <param name="Compare">Method of sorting</param> /// <returns>Sorted array</returns> /// <exception cref="NullReferenceException"></exception> public static int[][] Sort(int[][] array, CompareRows Compare) { if (ReferenceEquals(array, null) || ReferenceEquals(Compare, null)) { throw new NullReferenceException(); } for (int i = array.Length - 1; i > 0; i--) { for (int j = 0; j < i; j++) { if (Compare(array[j], array[j + 1]) < 0) { ChangeRows(ref array[j], ref array[j + 1]); } } } return(array); }
private static void Main(string[] args) { //Components CompareSlides.CompareSlidesFromDifferentPresentations(); CompareSlides.CompareSlidesFromOnePresentations(); CompareSlides.CompareSlideFromPresentationsWithCreatingSlide(); CompareSlides.CompareTwoCreatingSlides(); CompareCells.CompareCellsFromDifferentPresentations(); CompareCells.CompareCellsFromOnePresentations(); CompareCells.CompareCellFromPresentationsWithCreatingCell(); CompareCells.CompareTwoCreatingCells(); CompareParagraphs.CompareParagraphFromPresentationsWithCreatingParagraph(); CompareParagraphs.CompareParagraphsFromDifferentPresentations(); CompareParagraphs.CompareParagraphsFromOnePresentations(); CompareParagraphs.CompareTwoCreatingParagraphs(); CompareAutoShapes.CompareAutoShapeFromPresentationsWithCreatingAutoShape(); CompareAutoShapes.CompareAutoShapesFromDifferentPresentations(); CompareAutoShapes.CompareAutoShapesFromOnePresentations(); CompareAutoShapes.CompareTwoCreatingAutoShapes(); CompareTables.CompareTableFromPresentationsWithCreatingTable(); CompareTables.CompareTablesFromDifferentPresentations(); CompareTables.CompareTablesFromOnePresentations(); CompareTables.CompareTwoCreatingTables(); CompareRows.CompareRowFromPresentationsWithCreatingRow(); CompareRows.CompareRowsFromDifferentPresentations(); CompareRows.CompareRowsFromOnePresentations(); CompareRows.CompareTwoCreatingRows(); CompareColumns.CompareColumnFromPresentationsWithCreatingColumn(); CompareColumns.CompareColumnsFromDifferentPresentations(); CompareColumns.CompareColumnsFromOnePresentations(); CompareColumns.CompareTwoCreatingColumns(); // Presentations ComparePresentationsWithAutoShapes.ComparePresentationsWithAutoShapesOnAppropriateSlides(); ComparePresentationsWithAutoShapes.ComparePresentationsWithAutoShapesOnDifferentSlides(); ComparePresentationsWithTables.ComparePresentationsWithTablesOnAppropriateSlides(); ComparePresentationsWithTables.ComparePresentationsWithTablesOnDifferentSlides(); ComparePresentationsWithTables.ComparePresentationsWithTablesWitchConyainsDifferentCountOfRows(); ComparePresentationsWithTables.ComparePresentationsWithTablesWitchConyainsDifferentCountOfColumns(); ComparePresentationsWithTables .ComparePresentationsWithTablesWitchConyainsDifferentCountOfColumnsAndDifferentCountOfRows(); //Settings ComparisonWithDifferentSettings.ComparePresentationsWithComparisonDepthSetChars(); ComparisonWithDifferentSettings.ComparePresentationsWithComparisonDepthSetWords(); ComparisonWithDifferentSettings.ComparePresentationsWithGenerationSummaryPage(); ComparisonWithDifferentSettings.ComparePresentationsWithOutGenerationSummaryPage(); ComparisonWithDifferentSettings.ComparePresentationsWithOutShowDeletedContent(); ComparisonWithDifferentSettings.ComparePresentationsWithShowDeletedContent(); ComparisonWithDifferentSettings.ComparePresentationsWithWordsSepCharsSetSpace(); ComparisonWithDifferentSettings.ComparePresentationsWithSettingStylesOnDelInsComponents(); //Console.ReadKey(); }