private void calculatePoints() { Computator cmp = new Computator(); for (int n = 0; n < _mathList.getOperands().Count; n++) { double x, y; string funcName = ((Variable)_mathList.getOperands()[n]).getValue(); double start = ((Number)_interval.getOperands()[0]).getValue(); for (int j = 0; j < stepCount; j++) { List <IExpressionType> lst = new List <IExpressionType>(); lst.Add(new Number(start)); Function tm = new Function(Types.FuncExpression, lst, funcName); x = start; y = ((Number)tm.doOperation(cmp)).getValue(); start += step; _pointsArrays[n].Add(new DataPoint(x, y)); } } }
public void ComputateResultSecondStarShouldReturnGenericListWithResult() { //given string[] inputData = new[] { "DDLUURRR", "UURDD" }; List <char> suposedResult = new List <char>() { '8', 'C' }; DataReader reader = new DataReader(); Computator computator = new Computator(); CompareLogic comparer = new CompareLogic(); //when List <char> result = computator.ComputateResultSecondStar(inputData); //then Assert.IsTrue(comparer.Compare(suposedResult, result).AreEqual, "something went wrong"); }
public void ComputateResultShouldReturnGenericListWithResult() { //given string[] inputData = new[] { "UUDDD", "DDUUU" }; List <int> suposedResult = new List <int>() { 8, 2 }; DataReader reader = new DataReader(); Computator computator = new Computator(); CompareLogic comparer = new CompareLogic(); //when List <int> result = computator.ComputateResult(inputData); //then Assert.IsTrue(comparer.Compare(suposedResult, result).AreEqual, "something went wrong"); }
static void Main(string[] args) { UI ui = UI.getInstance(); List <string> str = ui.getUserInput(); // Parsing STRING -> FORMAT -> MODEL ParseProcessor parseProcessor = ParseProcessor.getInstance(); IExpressionType mathmodel = parseProcessor.parseFromInputToMathModel(str); // CALCULATIONS Context ct = Context.getInstance(); Computator computator = new Computator(); IExpressionType computed = mathmodel.doOperation(computator); // PARSING MODEL -> FORMAT -> STRING /*XmlDocument res = parseProcessor.parseToInputFromMathModel(computed); * Console.WriteLine(res.InnerXml);*/ }
public static void Main(string[] args) { //Computator computator = new Computator(); //DataReader reader = new DataReader(); //List<int> resultList = computator.ComputateResult(reader.ReadDataFromFile()); //foreach (var number in resultList) //{ // Console.Write(number); //} //Console.Read(); Computator computator = new Computator(); DataReader reader = new DataReader(); List <char> resultList = computator.ComputateResultSecondStar(reader.ReadDataFromFile()); foreach (var number in resultList) { Console.Write(number); } Console.Read(); }