예제 #1
0
        private readonly Queue <ICleaningRobotCommand> _commandQueue = new Queue <ICleaningRobotCommand>(); // Command queue

        /// <summary>
        /// Constructor
        /// </summary>
        public CleaningRobotResumableStrategy(
            ICleaningRobotCommand turnLeftCommand,
            ICleaningRobotCommand turnRightCommand,
            ICleaningRobotCommand advanceCommand,
            ICleaningRobotCommand cleanCommand,
            ICleaningRobotStrategySerializer serializer
            )
        {
            _turnLeftCommand  = turnLeftCommand;
            _turnRightCommand = turnRightCommand;
            _advanceCommand   = advanceCommand;
            _cleanCommand     = cleanCommand;
            _serializer       = serializer;
        }
예제 #2
0
 public void Setup()
 {
     _mapSerializer      = new RoomMapJsonSerializer();
     _map                = new RoombaMap(_mapSerializer);
     _robotSerializer    = new CleaningRobotJsonSerializer();
     _robot              = new RoombaRobot(_map, _robotSerializer);
     _strategySerializer = new CleaningRobotStrategyJsonSerializer();
     _trCommand          = new CleaningRobotTurnRightCommand(_robot);
     _tlCommand          = new CleaningRobotTurnLeftCommand(_robot);
     _aCommand           = new CleaningRobotAdvanceCommand(_robot);
     _bCommand           = new CleaningRobotBackCommand(_robot);
     _cCommand           = new CleaningRobotCleanCommand(_robot);
     _givenStrategy      = new CleaningRobotResumableStrategy(_tlCommand, _trCommand, _aCommand, _cCommand, _strategySerializer);
     _backOffStrategy    = new CleaningRobotBackOffStrategy(_tlCommand, _trCommand, _aCommand, _bCommand, _cCommand);
     _robotController    = new RoombaRobotController(_map, _robot, _givenStrategy, _backOffStrategy);
 }