public void ReadCSVFile(IOrder order, IStockList stockItems)
        {
            Assembly assembly     = Assembly.GetExecutingAssembly();
            string   resourceName = FileNames.PROBLEM1;

            try
            {
                using Stream stream       = assembly.GetManifestResourceStream(resourceName);
                using StreamReader reader = new StreamReader(stream);
                while (!reader.EndOfStream)
                {
                    string[] currentLine = reader.ReadLine().Split(",");

                    if (IsStockLengths(currentLine))
                    {
                        string[] currentLinePlusOne = reader.ReadLine().Split(",");
                        stockItems.StockItemList = ConstructStockItems(currentLine, currentLinePlusOne);
                    }

                    if (IsPieceLengths(currentLine))
                    {
                        string[] currentLinePlusOne = reader.ReadLine().Split(",");
                        ConstructOrder(currentLine, currentLinePlusOne, order);
                    }
                }
            }
            catch (IOException e)
            {
                Console.WriteLine("The file could not be read");
                Console.WriteLine(e.Message);
            }
        }
示例#2
0
        public MainMenu(IOrder pieceLengthToQuantityLookup, IStockList stockLengthToCostLookup, ISolutionStrategyFactory solutionStrategyFactory)
        {
            this.pieceLengthToQuantityLookup = pieceLengthToQuantityLookup;
            this.stockLengthToCostLookup     = stockLengthToCostLookup;
            this.solutionStrategyFactory     = solutionStrategyFactory;

            solutions = new Dictionary <int, Solution>();
        }
示例#3
0
 public RandomSolutionGenerator(
     IOrder order,
     IStockList stockList,
     ISolutionEvaluator solutionEvaluator,
     ISolutionValidation solutionValidation,
     IMaterialCutter materialCutter
     )
 {
     this.order              = order;
     this.stockList          = stockList;
     this.solutionEvaluator  = solutionEvaluator;
     this.solutionValidation = solutionValidation;
     this.materialCutter     = materialCutter;
 }
 public SolutionValidation(IOrder order, IStockList stockList)
 {
     this.order     = order;
     this.stockList = stockList;
 }