Пример #1
0
        private int ParseInput()
        {
            var dimension  = tbDimension.Text;
            var rDimension = _defaultWidth;
            var counter    = 0;

            if (int.TryParse(dimension, out rDimension))
            {
                var element = (int)(rDimension / _square.Width);
                _elementsInRow = element;
                _matrix        = new SquareModel[element, element];
                _uiMatrix      = new int[element, element];

                for (var i = 0; i < element; i++)
                {
                    for (var j = 0; j < element; j++)
                    {
                        _matrix[i, j] = new SquareModel {
                            Value = counter++
                        };
                        _uiMatrix[i, j] = _emptyElement;
                    }
                }
            }
            else
            {
                MessageBox.Show("incorrect data");
            }

            return(rDimension);
        }
Пример #2
0
        private int ParseInput()
        {
            var dimension = tbDimension.Text;
            var rDimension = _defaultWidth;
            var counter = 0;
            if (int.TryParse(dimension, out rDimension))
            {
                var element = (int)(rDimension / _square.Width);
                _elementsInRow = element;
                _matrix = new SquareModel[element, element];
                _uiMatrix = new int[element,element];

                for (var i = 0; i < element; i++)
                {
                    for (var j = 0; j < element; j++)
                    {
                        _matrix[i, j] = new SquareModel {Value = counter++};
                        _uiMatrix[i, j] = _emptyElement;
                    }
                }
            }
            else
            {
                MessageBox.Show("incorrect data");
            }

            return rDimension;
        }
Пример #3
0
 public QuickFind(SquareModel[,] matrix)
 {
     _matrix = matrix;
     _size = (int)Math.Sqrt(_matrix.Length);
 }
Пример #4
0
 public WeightenedUnionStrategy(SquareModel[,] matrix)
 {
     _matrix = matrix;
 }
Пример #5
0
 public QuickUnionStrategy(SquareModel[,] matrix)
 {
     _matrix = matrix;
 }
Пример #6
0
 public QuickFindStrategy(SquareModel[,] matrix)
 {
     _matrix = matrix;
     Algorithm = new QuickFind(matrix);
 }