public static string convertResultsToString(List <TestDataAndFields> resultsToConvert, DMU.Math.Matrix weightsMatrix, string title)
        {
            string matrixNumberFormatting         = "F1";
            string matrixColumnDelimiteFormatting = "\t";
            string matrixRowDelimiterFormatting   = "\n";

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(title);
            stringBuilder.AppendLine("Macierz wag (W):");
            stringBuilder.Append(weightsMatrix.ToString(matrixNumberFormatting, matrixColumnDelimiteFormatting, matrixRowDelimiterFormatting));

            foreach (TestDataAndFields testDataAndFields in resultsToConvert)
            {
                stringBuilder.AppendLine("----------------------------------------------------");
                stringBuilder.AppendLine("--- Badanie nr. " + (testDataAndFields.index + 1) + " ---");
                stringBuilder.AppendLine("----------------------------------------------------");
                stringBuilder.AppendLine("Badany wektor:");
                stringBuilder.AppendLine(DMU.Math.Matrix.Transpose(testDataAndFields.startingValue).ToString(matrixNumberFormatting, matrixColumnDelimiteFormatting, matrixRowDelimiterFormatting));

                int i = 1;
                foreach (SingleIterationResult singleIterationResult in testDataAndFields.iterationHistory)
                {
                    stringBuilder.AppendLine("Krok: " + i + "-------------------");
                    stringBuilder.AppendLine("Potencjał wejściowy (U):");
                    stringBuilder.AppendLine(DMU.Math.Matrix.Transpose(singleIterationResult.matrixResult).ToString(matrixNumberFormatting, matrixColumnDelimiteFormatting, ""));
                    stringBuilder.AppendLine("Potencjał wyjściowy (V):");
                    stringBuilder.AppendLine(DMU.Math.Matrix.Transpose(singleIterationResult.matrixResultBiPolar).ToString(matrixNumberFormatting, matrixColumnDelimiteFormatting, matrixRowDelimiterFormatting));
                    stringBuilder.AppendLine("Energia(" + i + ")= " + singleIterationResult.energy);
                    stringBuilder.AppendLine();

                    i++;
                }

                stringBuilder.Append("Wniosek: Punkt [" + DMU.Math.Matrix.Transpose(testDataAndFields.startingValue).ToString(matrixNumberFormatting, " ", "") + "] " + resultTypeToString(testDataAndFields.resultType));
                switch (testDataAndFields.resultType)
                {
                case ResultType.GoesToPoint: {
                    stringBuilder.Append(": [" + DMU.Math.Matrix.Transpose(testDataAndFields.currentValue).ToString(matrixNumberFormatting, " ", "") + "]");
                }
                break;

                case ResultType.CreatesCycle:
                case ResultType.GoesToCycle: {
                    stringBuilder.Append(": ");
                    int index = 0;

                    foreach (SingleIterationResult patternElement in testDataAndFields.foundPattern)
                    {
                        stringBuilder.Append("[" + DMU.Math.Matrix.Transpose(patternElement.matrixResultBiPolar).ToString(matrixNumberFormatting, " ", "") + "]");

                        if (index < (testDataAndFields.foundPattern.Count - 1))
                        {
                            if (testDataAndFields.synchronousMode)
                            {
                                stringBuilder.Append(" <-> ");
                            }
                            else
                            {
                                stringBuilder.Append(" -> ");
                            }
                        }

                        index++;
                    }
                }
                break;
                }
                stringBuilder.AppendLine();
            }

            return(stringBuilder.ToString());
        }
        public void displayInformation(TestDataAndFields testDataAndFields)
        {
            DMU.Math.Matrix currentValue = testDataAndFields.startingValue;
            string          text         = "Badanie " + (testDataAndFields.index + 1) + " Wektor: " + currentValue.ToString("F0");

            this.Title        = text;
            SourceInfo.Header = text;
            List <Rectangle> rectangles = new List <Rectangle>();

            Label label = new Label();

            {
                label.VerticalAlignment   = VerticalAlignment.Center;
                label.HorizontalAlignment = HorizontalAlignment.Center;
                label.Content             = DataConverters.resultTypeToString(testDataAndFields.resultType);
            }
            results.Children.Add(label);

            UniformGrid uniformGrid = new UniformGrid();

            {
                uniformGrid.Rows = 1;
                for (int rectIndex = 0; rectIndex < testDataAndFields.iterationHistory.Count + 1; rectIndex++)
                {
                    Rectangle rect = new Rectangle();
                    {
                        rect.Width  = 20;
                        rect.Height = 20;
                        rectangles.Add(rect);
                    }
                    uniformGrid.Children.Add(rect);
                }
            }
            results.Children.Add(uniformGrid);
            rectangles[0].Fill = brushes[biPolarToNumber(testDataAndFields.startingValue.ToArray())];

            int i = 1;

            foreach (SingleIterationResult resultOfStep in testDataAndFields.iterationHistory)
            {
                GroupBox groupBox = new GroupBox();
                {
                    groupBox.Header    = "Krok " + i;
                    rectangles[i].Fill = brushes[biPolarToNumber(resultOfStep.matrixResultBiPolar.ToArray())];
                    Grid grid = new Grid();
                    {
                        LayoutGenerationHelpers.addNMStarWideColumnsToGrid(4, 1, ref grid);
                        LayoutGenerationHelpers.addNMStarHighRowsToGrid(3, 1, ref grid);
                        LayoutGenerationHelpers.addNMStarHighRowsToGrid(1, 1, ref grid);

                        label = new Label();
                        {
                            Grid.SetColumn(label, 0);
                            Grid.SetRow(label, 0);
                            label.VerticalAlignment   = VerticalAlignment.Center;
                            label.HorizontalAlignment = HorizontalAlignment.Center;
                            label.Content             = "Potencjał wejściowy (U):";
                        }
                        grid.Children.Add(label);

                        Grid gridOutputs = new Grid();
                        {
                            LayoutGenerationHelpers.addNMStarHighRowsToGrid(3, 1, ref gridOutputs);
                            Grid.SetColumn(gridOutputs, 1);
                            LayoutGenerationHelpers.addNLabelsToGridWithArrayAsContent(3, ref gridOutputs, resultOfStep.matrixResult.ToArray());
                        }
                        grid.Children.Add(gridOutputs);

                        label = new Label();
                        {
                            Grid.SetColumn(label, 2);
                            Grid.SetRow(label, 0);
                            label.VerticalAlignment   = VerticalAlignment.Center;
                            label.HorizontalAlignment = HorizontalAlignment.Center;
                            label.Content             = "Potencjał wyjściowy (V):";
                        }
                        grid.Children.Add(label);

                        Grid gridOutputsBiPolar = new Grid();
                        {
                            LayoutGenerationHelpers.addNMStarHighRowsToGrid(3, 1, ref gridOutputsBiPolar);
                            Grid.SetColumn(gridOutputsBiPolar, 3);
                            LayoutGenerationHelpers.addNLabelsToGridWithArrayAsContent(3, ref gridOutputsBiPolar, resultOfStep.matrixResultBiPolar.ToArray());
                        }
                        grid.Children.Add(gridOutputsBiPolar);

                        label = new Label();
                        {
                            Grid.SetColumn(label, 0);
                            Grid.SetRow(label, 1);
                            Grid.SetColumnSpan(label, 4);
                            label.VerticalAlignment   = VerticalAlignment.Center;
                            label.HorizontalAlignment = HorizontalAlignment.Center;
                            label.Content             = "Energia: " + resultOfStep.energy;
                        }
                        grid.Children.Add(label);
                    }
                    groupBox.Content = grid;
                }
                results.Children.Add(groupBox);

                i++;
            }
        }