public RecyclingStationController(GarbageFactory garbageFactory, IStrategyHolder strategyHolder, IRecyclingStation recyclingStation)
 {
     this.garbageFactory   = garbageFactory;
     this.RecylingStation  = recyclingStation;
     this.strategyHolder   = strategyHolder;
     this.garbageProcessor = new GarbageProcessor(strategyHolder);
 }
        public override string Execute(IResourcesController resController, string[] commandParams)
        {
            var name           = commandParams[0];
            var weight         = double.Parse(commandParams[1]);
            var volumePerKg    = double.Parse(commandParams[2]);
            var garbageType    = commandParams[3];
            var waste          = GarbageFactory.CreateWaste(new object[] { name, weight, volumePerKg }, garbageType);
            var processingData = resController.ProcessWaste(waste);

            resController.AddProccessingData(processingData);

            return($"{weight:f2} kg of {name} successfully processed!");
        }
        private static void Main(string[] args)
        {
            var garbageFactory             = new GarbageFactory();
            var strategyHolder             = new StrategyHolder();
            var recyclingStation           = new RecyclingStation();
            var recyclingStationController = new RecyclingStationController(garbageFactory, strategyHolder, recyclingStation);
            var commandInterpreter         = new CommandInterpreter(recyclingStationController);
            var writer = new ConsoleWriter();
            var reader = new ConsoleReader();
            var engine = new Engine(writer, reader, commandInterpreter);

            engine.Run();
        }
示例#4
0
        public static void Main()
        {
            IGarbageFactory   garbageFactory   = new GarbageFactory();
            IGarbageProcessor garbageProcessor = new GarbageProcessor();
            IProcessingData   processingData   = new ProcessingData();

            ICommandInterpreter commandInterpreter =
                new CommandInterpreter(garbageFactory, garbageProcessor, processingData);

            IRunnable engine = new Engine(commandInterpreter);

            engine.Run();
        }
        public static void Main()
        {
            IReader             consoleReader      = new ConsoleReader();
            IWriter             consoleWriter      = new ConsoleWriter();
            IInputOutputManager inputOutputManager = new InputOutputManager(consoleReader, consoleWriter);

            IStrategyHolder   strategyHolder   = new StrategyHolder(new Dictionary <Type, IGarbageDisposalStrategy>());
            IGarbageProcessor garbageProcessor = new GarbageProcessor(strategyHolder);
            IGarbageFactory   garbageFactory   = new GarbageFactory();
            IRecyclingManager recyclingManager = new RecyclingManager(garbageProcessor, garbageFactory);

            IRunnable engine = new Engine(inputOutputManager, recyclingManager);

            engine.Run();
        }
        private static RecyclingManager CreateRecyclingManager()
        {
            var garbageFactory = new GarbageFactory();

            var strategyHolder   = new StrategyHolder(new Dictionary <Type, IGarbageDisposalStrategy>());
            var garbageProcessor = new GarbageProcessor(strategyHolder);

            var requirementData = new StoredData(0, 0);
            var recyclingManagementRequirement = new RecyclingManagementRequirement(requirementData, null);

            var storedData = new StoredData(0, 0);

            var recyclingManager = new RecyclingManager(garbageFactory, garbageProcessor, recyclingManagementRequirement, storedData);

            return(recyclingManager);
        }