private async Task <DeviceCommand> CallLuisAsync(string input) { var parsedMessage = await luisClient.parseInput(input); CommandBase command; switch (parsedMessage.topScoringIntent.intent) { case "Count": command = new CountCommand(parsedMessage.entities); break; case "Location": command = new LocationCommand(parsedMessage.entities); break; case "Calculation": command = new CalculationCommand(parsedMessage.entities); break; case "Timer": command = new TimerCommand(parsedMessage.entities); break; default: command = new NoneCommand(); break; } return(await command.Run()); }
/// <inheritdoc /> public double Solve(CalculationCommand command) { IBinaryCalculation calculator = _strategies .FirstOrDefault(x => x.Operation == command.Operation); if (calculator == null) { throw new ArgumentException($"No strategy found for operator {command.Operation}"); } return(calculator.Apply(command.LeftOperand, command.RightOperand)); }
public IntersectionPart GetIntersectionWith(IFeature other) { return(CalculationCommand.Execute(other)); }
public double Solve([FromUri] CalculationCommand command) => _calculator.Solve(command);