public IsomorphismDeterminator(FieldTable Table1, FieldTable Table2) { if (Table1.Size != Table2.Size) { throw new Exception("Степень многочленов не совпадает"); } table1product = Table1.Content(FieldTable.FieldTableType.Multiplication); table2product = Table2.Content(FieldTable.FieldTableType.Multiplication); table1sum = Table1.Content(FieldTable.FieldTableType.Addition); table2sum = Table2.Content(FieldTable.FieldTableType.Addition); permutationGenerator = new PermutationGenerator(table1product.GetUpperBound(0), Table1.NeutralPairs, Table2.NeutralPairs); }
static public string CreateTableFile(FieldTable fieldTable, TableSaveMode savingMode, FieldTable.FieldTableType tableType) { string filenamePrefix = "GFTable"; string fileExtension = ""; string wordSeparator = ""; string sumMark = "Sum"; switch (savingMode) { case TableSaveMode.CSV: fileExtension = ".csv"; wordSeparator = ";"; break; case TableSaveMode.TXT: fileExtension = ".txt"; wordSeparator = " "; break; } string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string fileName = ""; if (tableType == FieldTable.FieldTableType.Multiplication) { fileName = filenamePrefix + fieldTable.Divisor.IntegerRepresentation + fileExtension; } else { fileName = filenamePrefix + sumMark + fieldTable.Size + fileExtension; } writer = new StreamWriter(path + "\\" + fileName); using (writer) { //Index of the last element in the line int tableBorderIndex = fieldTable.Size - 1; for (int i = 1; i < tableBorderIndex; i++) { writer.Write(i + wordSeparator); } writer.Write(tableBorderIndex + "\n"); int[,] tableContent = fieldTable.Content(tableType); for (int i = 1; i < fieldTable.Size; i++) { for (int j = 1; j < tableBorderIndex; j++) { writer.Write(tableContent[i, j] + wordSeparator); } writer.Write(tableContent[i, tableBorderIndex] + "\n"); } } return(fileName); }