public void Execute(dynamic jObject, UserAlgorithmStore store) { var expressionCalculator = new UserExpressionCalculator(); SetUserAlgorithmModel model = jObject.ToObject <SetUserAlgorithmModel>(); var value = expressionCalculator.Calculate(model.Value, store); store.NumverVariables[model.Variable] = value; }
public void Execute(dynamic jObject, UserAlgorithmStore store) { var expressionCalculator = new UserExpressionCalculator(); AppendUserAlgorithmModel model = jObject.ToObject <AppendUserAlgorithmModel>(); var value = expressionCalculator.Calculate(model.Value, store); store.ListVariables[model.Variable].Add(value); }
public void Execute(dynamic jObject, UserAlgorithmStore store) { var expressionCalculator = new UserExpressionCalculator(); var numberFactorsExecutor = new NumberFactorsCalculator(); WhileUserAlgorithmModel model = jObject.ToObject <WhileUserAlgorithmModel>(); var firstPart = expressionCalculator.Calculate(model.FirstPart, store); var secondPart = expressionCalculator.Calculate(model.SecondPart, store); switch (model.Condition) { case Condition.More: if (firstPart > secondPart) { numberFactorsExecutor.ExecuteAlgorithm(model.Algorithm, new UserAlgorithmStrategyProvider(), store); Execute(jObject, store); } break; case Condition.Less: if (firstPart < secondPart) { numberFactorsExecutor.ExecuteAlgorithm(model.Algorithm, new UserAlgorithmStrategyProvider(), store); Execute(jObject, store); } break; case Condition.Equals: if (firstPart == secondPart) { numberFactorsExecutor.ExecuteAlgorithm(model.Algorithm, new UserAlgorithmStrategyProvider(), store); Execute(jObject, store); } break; case Condition.NotEquals: if (firstPart != secondPart) { numberFactorsExecutor.ExecuteAlgorithm(model.Algorithm, new UserAlgorithmStrategyProvider(), store); Execute(jObject, store); } break; } }