Example #1
0
        public Coordinate(int gridSize, string value) : this()
        {
            _gridSize = gridSize;

            var coordinateValue   = new CoordinateValue(gridSize, value);
            var coordinateIndexes = coordinateValue.CreateIndexes();

            if (AreValueAndIndexesValid(coordinateValue, coordinateIndexes))
            {
                _value   = coordinateValue;
                _indexes = coordinateIndexes;
            }
        }
Example #2
0
        public Coordinate(int gridSize, int heightIndex, int widthIndex) : this()
        {
            _gridSize = gridSize;

            var coordinateIndexes = new CoordinateIndexes(gridSize, heightIndex, widthIndex);
            var coordinateValue   = coordinateIndexes.CreateValue();

            if (AreValueAndIndexesValid(coordinateValue, coordinateIndexes))
            {
                _indexes = coordinateIndexes;
                _value   = coordinateValue;
            }
        }
Example #3
0
 private bool AreValueAndIndexesValid(CoordinateValue value, CoordinateIndexes indexes) => value.IsValid() && indexes.AreValid();
Example #4
0
 private Coordinate()
 {
     _value   = new CoordinateValue();
     _indexes = new CoordinateIndexes();
 }