public static void ExportCSV(IMatrixModel matrix, System.IO.StreamWriter file, char separatorCVS)
 {
     for (int i = 0; i < matrix.Size; i++)
     {
         file.WriteLine(string.Join(separatorCVS.ToString(), matrix.Body[i]));
     }
 }
        public void GenerateMatrix(int size, IMatrixModel matrix)
        {
            matrix.Body = new int[size][];

            System.Random random = new System.Random();

            for (int i = 0; i < size; ++i)
            {
                matrix.Body[i] = new int[size];
                for (int j = 0; j < size; ++j)
                {
                    matrix.Body[i][j] = random.Next(10, 50);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// конструктор класса Presenter
        /// </summary>
        /// <param name="view">представление</param>
        /// <param name="model">модель</param>
        public MatrixModelPresenter(IView view, IMatrixModel model)
        {
            this.view  = view;
            this.model = model;



            model.EndSearchTornCurrent += Model_EndSearchTornCurrent;
            model.EndSearchСircuit     += Model_EndSearchСircuit;

            model.StartSearchTornCurrent += Model_StartSearchTornCurrent;
            model.StartSearchСircuit     += Model_StartSearchСircuit;

            model.StepSearchTornCurrent += Model_StepSearchTornCurrent;
            model.StepSearchСircuit     += Model_StepSearchСircuit;
        }
        public void RotateMatrixLeft(IMatrixModel matrix)
        {
            for (int i = 0; i < matrix.Size / 2; i++)
            {
                for (int j = 0; j < (matrix.Size - 1 - i); j++)
                {
                    if (i <= j)
                    {
                        int temp = matrix.Body[i][j];

                        matrix.Body[i][j] = matrix.Body[j][matrix.Size - 1 - i];
                        matrix.Body[j][matrix.Size - 1 - i] = matrix.Body[matrix.Size - 1 - i][
                            matrix.Size - 1 - j];
                        matrix.Body[matrix.Size - 1 - i][
                            matrix.Size - 1 - j]            = matrix.Body[matrix.Size - 1 - j][i];
                        matrix.Body[matrix.Size - 1 - j][i] = temp;
                    }
                }
            }
        }
Beispiel #5
0
 public HomeController(IMatrixActions matrixActions, IMatrixModel matrix)
 {
     _matrixActions = matrixActions;
     _matrix        = matrix;
 }