public RegisterTrigger( ITelegramBotClient botClient, ICommandMatcher commandMatcher, ILogger logger) : base(botClient, commandMatcher, logger) { }
public CommandParser(ICommandMatcher aCommandMatcher, Func <Size, ILandingSurfaceSizeCommand> aLandingSurfaceSizeCommandFactory, Func <Position, CardinalDirection, IRoverDeployCommand> aRoverDeployCommandFactory, Func <IList <Movement>, IRoverMoveCommand> aRoverMoveCommandFactory) { commandMatcher = aCommandMatcher; landingSurfaceSizeCommandFactory = aLandingSurfaceSizeCommandFactory; roverDeployCommandFactory = aRoverDeployCommandFactory; roverMoveCommandFactory = aRoverMoveCommandFactory; commandParserDictionary = new Dictionary <CommandType, Func <string, ICommand> > { { CommandType.LandingSurfaceSizeCommand, ParseLandingSurfaceSizeCommand }, { CommandType.RoverDeployCommand, ParseRoverDeployCommand }, { CommandType.RoverMoveCommand, ParseRoverMoveCommand } }; cardinalDirectionDictionary = new Dictionary <char, CardinalDirection> { { 'N', CardinalDirection.North }, { 'S', CardinalDirection.South }, { 'E', CardinalDirection.East }, { 'W', CardinalDirection.West } }; movementDictionary = new Dictionary <char, Movement> { { 'L', Movement.SpinLeft }, { 'R', Movement.SpinRight }, { 'M', Movement.StepForward } }; }
public CommandParser(ICommandMatcher aCommandMatcher, Func<Size, ILandingSurfaceSizeCommand> aLandingSurfaceSizeCommandFactory, Func<Point, CardinalDirection, IRoverDeployCommand> aRoverDeployCommandFactory, Func<IList<Movement>, IRoverExploreCommand> aRoverExploreCommandFactory) { commandMatcher = aCommandMatcher; landingSurfaceSizeCommandFactory = aLandingSurfaceSizeCommandFactory; roverDeployCommandFactory = aRoverDeployCommandFactory; roverExploreCommandFactory = aRoverExploreCommandFactory; commandParserDictionary = new Dictionary<CommandType, Func<string, ICommand>> { {CommandType.LandingSurfaceSizeCommand, ParseLandingSurfaceSizeCommand}, {CommandType.RoverDeployCommand, ParseRoverDeployCommand}, {CommandType.RoverExploreCommand, ParseRoverExploreCommand} }; cardinalDirectionDictionary = new Dictionary<char, CardinalDirection> { {'N', CardinalDirection.North}, {'S', CardinalDirection.South}, {'E', CardinalDirection.East}, {'W', CardinalDirection.West} }; movementDictionary = new Dictionary<char, Movement> { {'L', Movement.Left}, {'R', Movement.Right}, {'M', Movement.Forward} }; }
public CommandParser(ICommandMatcher aCommandMatcher, Func <Dimension, ISurfaceSizeCommand> aLandingSurfaceSizeCommandFactory, Func <Coordinate, CardinalDirection, IRoverDeployCommand> aRoverDeployCommandFactory, Func <IList <Direction>, IRoverExploreCommand> aRoverExploreCommandFactory) { commandMatcher = aCommandMatcher; landingSurfaceSizeCommandFactory = aLandingSurfaceSizeCommandFactory; roverDeployCommandFactory = aRoverDeployCommandFactory; roverExploreCommandFactory = aRoverExploreCommandFactory; commandParserDictionary = new Dictionary <CommandType, Func <string, ICommand> > { { CommandType.LandingSurfaceSizeCommand, ParseLandingSurfaceSizeCommand }, { CommandType.RoverDeployCommand, ParseRoverDeployCommand }, { CommandType.RoverExploreCommand, ParseRoverExploreCommand } }; cardinalDirectionDictionary = new Dictionary <char, CardinalDirection> { { 'N', CardinalDirection.North }, { 'S', CardinalDirection.South }, { 'E', CardinalDirection.East }, { 'W', CardinalDirection.West } }; DirectionDictionary = new Dictionary <char, Direction> { { 'L', Direction.Left }, { 'R', Direction.Right }, { 'M', Direction.Forward } }; }
public CommandParser(ICommandMatcher commandMatcher, Func <Size, ISurfaceSizeCommand> surfaceSizeCommandFactory, Func <Point, Coordinate, IPirateDeployCommand> pirateDeployCommandFactory, Func <IList <Direction>, IPirateExploreCommand> pirateExploreCommandFactory) { _commandMatcher = commandMatcher; _surfaceSizeCommandFactory = surfaceSizeCommandFactory; _pirateDeployCommandFactory = pirateDeployCommandFactory; _pirateExploreCommandFactory = pirateExploreCommandFactory; commandParserDictionary = new Dictionary <CommandType, Func <string, ICommand> > { { CommandType.SurfaceSizeCommand, ParseSurfaceSizeCommand }, { CommandType.PirateDeployCommand, ParsePirateDeployCommand }, { CommandType.PirateExploreCommand, ParseRoverExploreCommand } }; coordinate = new Dictionary <char, Coordinate> { { 'N', Coordinate.North }, { 'S', Coordinate.South }, { 'E', Coordinate.East }, { 'W', Coordinate.West } }; direction = new Dictionary <char, Direction> { { 'L', Direction.Left }, { 'R', Direction.Right }, { 'M', Direction.Forward } }; }
public MoveInvoker(ICommandMatcher commandMatcher , IArea area) { _commandMatcher = commandMatcher; _area = area; _positions = new List<Position>(); _commandParser = new Dictionary<CommandType, Func<string, ICommand>> { {CommandType.AreaCommand, ParseAreaCommand}, {CommandType.SetPositionCommand, ParseSetPositionCommand}, {CommandType.MoveCommand, ParseMoveCommand} }; }
public Command GetCommand(string arguments) { if (!string.IsNullOrEmpty(arguments)) { string newName = arguments.Split(' ').First(); string newArgs = arguments.Substring(newName.Length).Trim(); ICommandMatcher match = GarminCommands.Find(m => m.IsMatch(newName)); if (match != null) { return(match.GetCommand(newArgs)); } return(Commands.Concatenate( Commands.Unknown, GarminCommands.Find(m => m.IsMatch("help")).GetCommand(string.Empty) )); } return(Commands.Empty); }
Command Read() { string commandLine = Input.ReadLine().Trim(); if (!string.IsNullOrEmpty(commandLine)) { string commandName = commandLine.Split(' ').First(); string arguments = commandLine.Substring(commandName.Length).Trim(); ICommandMatcher match = CommandList.Find(m => m.IsMatch(commandName)); if (match != null) { return(match.GetCommand(arguments)); } return(Commands.Unknown); } return(Commands.Empty); }
public CommandParser(ICommandMatcher commandMatcher, Func <PlateauArea, ISetPlateauAreaSizeCommand> plateauSizeCommandFactory, Func <Point, Direction, IRoverCreateCommand> roverCreateCommandFactory, Func <IList <Movement>, IRoverDriveCommand> roverDriveCommandFactory) { _commandMatcher = commandMatcher; _plateauSizeCommandFactory = plateauSizeCommandFactory; _roverCreateCommandFactory = roverCreateCommandFactory; _roverDriveCommandFactory = roverDriveCommandFactory; _commandParserDictionary = new Dictionary <CommandType, Func <string, ICommand> > { { CommandType.SetPlateauAreaSizeCommand, ParsePlateauSizeCommand }, { CommandType.RoverCreateCommand, ParseRoverCreateCommand }, { CommandType.RoverDriveCommand, ParseRoverDriveCommand } }; _directionDictionary = ConstantValues.GetDirectoryDictionary(); _movementDictionary = ConstantValues.GetMovementDictionary(); }
public CommandExecutor(ICommandMatcher commandMatcher) { _commandMatcher = commandMatcher; }
protected BaseTrigger( ITelegramBotClient botClient, ICommandMatcher commandMatcher, ILogger logger) => (BotClient, CommandMatcher, Logger) = (botClient, commandMatcher, logger);
public UpdateTrigger( ICommandMatcher commandMatcher, ILogger logger, ITelegramBotClient botClient, IMediator mediator) : base(botClient, commandMatcher, logger) =>
public void Match(ICommandMatcher commandMatcher) { commandMatcher.Match("create").Match("release").Capture(x => MilestoneUrl = x); }