public void Setup() { _specialOneDimensionalArrayAlgorithms = SpecialOneDimensionalArrayAlgorithmsFactoryObject .GetSpecialOneDimensionalArrayAlgorithms(); _array = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); }
public void Setup() { _oneDimensionalArraysWorkflow = OneDimensionalArraysWorkflowFactoryObject.GetOneDimensionalArraysWorkflowObject(); _oneDimensionalArray = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); }
public IAbstractOneDimensionalArrayObject BoostDownArray(IAbstractOneDimensionalArrayObject array, int booster) { var result = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); for (var it = 0; it < array.GetLengthOfOneDimensionalArray(); it++) { array.GetOneDimensionalArray()[it] /= booster; } result.SetOneDimensionalArray(array.GetOneDimensionalArray()); return(result); }
public IAbstractOneDimensionalArrayObject ReadOneDimensionalArray(int size) { var array = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); array.SetLengthOfOneDimensionalArray(size); for (var it = 0; it < size; it++) { array.GetOneDimensionalArray()[it] = Convert.ToInt32(Console.ReadLine()); } return(array); }
public IAbstractOneDimensionalArrayObject AddValueInArray(IAbstractOneDimensionalArrayObject array, int value) { var result = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); var newArray = new int[array.GetLengthOfOneDimensionalArray() + 1]; SetupNewArray(array, newArray); newArray[array.GetLengthOfOneDimensionalArray()] = value; result.SetOneDimensionalArray(newArray); return(result); }
public void Test_AreArraysEqual_() { var arrayOne = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); var arrayTwo = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); arrayOne.SetOneDimensionalArray(new [] { 1, 2, 3, 4, 5 }); arrayTwo.SetOneDimensionalArray(new [] { 1, 2, 3, 4, 5 }); Assert.IsTrue(_oneDimensionalArraysWorkflow.AreArraysEqual(arrayOne, arrayTwo)); arrayOne.SetOneDimensionalArray(new [] { -1, 2, -3, 4, -5 }); arrayTwo.SetOneDimensionalArray(new [] { -1, 2, -3, 4, -5 }); Assert.IsTrue(_oneDimensionalArraysWorkflow.AreArraysEqual(arrayOne, arrayTwo)); }
public void Test_GetArraysDivision_() { var arrayOne = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); arrayOne.SetOneDimensionalArray(new [] { 10, 22, 33, 44 }); var arrayTwo = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); arrayTwo.SetOneDimensionalArray(new [] { 2, 3, 4, 10 }); var result = _oneDimensionalArraysWorkflow.GetArraysDivision(arrayOne, arrayTwo); var expected = new int[] { 5, 7, 8, 4 }; Assert.AreEqual(result.GetOneDimensionalArray(), expected); }
public void Test_GetArraysDifference_() { var arrayOne = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); arrayOne.SetOneDimensionalArray(new [] { 1, 2, 3, 4 }); var arrayTwo = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); arrayTwo.SetOneDimensionalArray(new [] { -1, -2, -3, -4 }); var result = _oneDimensionalArraysWorkflow.GetArraysDifference(arrayOne, arrayTwo); var expected = new int[] { 2, 4, 6, 8 }; Assert.AreEqual(result.GetOneDimensionalArray(), expected); }
public IAbstractOneDimensionalArrayObject GetArraysDivision(IAbstractOneDimensionalArrayObject arrayOne, IAbstractOneDimensionalArrayObject arrayTwo) { var result = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); result.SetOneDimensionalArray(arrayOne.GetOneDimensionalArray()); for (var it = 0; it < arrayOne.GetLengthOfOneDimensionalArray(); it++) { result.GetOneDimensionalArray()[it] = arrayOne.GetOneDimensionalArray()[it] / arrayTwo.GetOneDimensionalArray()[it]; } return(result); }
public void Setup() { _oneDimensionalArray = OneDimensionalArrayFactoryObject.GetOneDimensionalArrayObject(); _matrix = MatrixFactoryObject.GetMatrixObject(); }