コード例 #1
0
 public void ProcessTriangleProblem()
 {
     using (var readerdata = new StreamReader(this.inputFilename))
     {
         List <RowData>      rows                = ParseRawDataInToRows(readerdata);
         List <string>       distinctProducts    = FindingDistinctProducts(rows);
         MinMax              minmax              = CalculateMinMaxDurationandProductCount(rows, distinctProducts);
         AccumulatedProducts accumulatedProducts = AlgorithmCompressingList(minmax, rows, distinctProducts);
         Output(accumulatedProducts, this.outputFilename);
     }
 }
コード例 #2
0
 private void Output(AccumulatedProducts accumulatedProducts, string fileName)
 {
     using (StreamWriter writer = new StreamWriter(fileName))
     {
         IMinMax range = accumulatedProducts.Range;
         writer.WriteLine(range.Start + ", " + range.Duration);
         foreach (var product in accumulatedProducts.Products)
         {
             string toOutput    = string.Join(", ", product.Values);
             string finalOutput = product.Name + ", " + toOutput;
             writer.WriteLine(finalOutput);
         }
     }
 }