Example #1
0
        public static HandlerContainer CreateHandlerContainer(HandlerContainerType inHandlerType, AlgorithmEssentials inAlgorithmEssentials)
        {
            HandlerContainer handlerManager;

            switch (inHandlerType)
            {
            case HandlerContainerType.CircularCleaningAlgorithm:
            {
                ForwardMovementHandler initialHandler = new ForwardMovementHandler(inAlgorithmEssentials);

                ObstacleHandler firstObstacleHandler  = new ObstacleHandler(inAlgorithmEssentials);
                ObstacleHandler secondObstacleHandler = new ObstacleHandler(inAlgorithmEssentials);
                ObstacleHandler thirdObstacleHandler  = new ObstacleHandler(inAlgorithmEssentials);

                initialHandler.SetNextMovementHandler(firstObstacleHandler);
                firstObstacleHandler.SetNextMovementHandler(secondObstacleHandler);
                secondObstacleHandler.SetNextMovementHandler(thirdObstacleHandler);
                thirdObstacleHandler.SetNextMovementHandler(null);
                handlerManager = new HandlerContainer(initialHandler);
                break;
            }

            case HandlerContainerType.SimpleReturnAlgorithm:
            {
                ForwardMovementHandler returnInitialHandler       = new ForwardMovementHandler(inAlgorithmEssentials, true);
                ObstacleHandler        returnFirstObstacleHandler = new ObstacleHandler(inAlgorithmEssentials, true);
                returnInitialHandler.SetNextMovementHandler(returnFirstObstacleHandler);

                handlerManager = new HandlerContainer(returnInitialHandler);
                break;
            }

            default:
                handlerManager = null;
                break;
            }

            return(handlerManager);
        }
Example #2
0
 public SimpleReturnAlgorithm(AlgorithmEssentials inAlgorithmEssentials, HandlerContainer inHandlerManager)
 {
     _algorithmEssentials = inAlgorithmEssentials;
     _handlerManager      = inHandlerManager;
 }
        public CircularCleaningAlgorithm(AlgorithmEssentials inAlgorithmEssentials, HandlerContainer inHandlerManager)
        {
            _algorithmEssentials = inAlgorithmEssentials;

            _handlerManager = inHandlerManager;
        }