Ejemplo n.º 1
0
 public EvaluationResult(DateTime creationTime, bool successfulCalculation, IReadOnlyList <IQuantityEvaluationResult> quantityEvaluationResults, ToolNames toolName, string name)
     : base(creationTime, successfulCalculation)
 {
     QuantityEvaluationResults = quantityEvaluationResults;
     ToolName = toolName;
     Name     = name;
 }
Ejemplo n.º 2
0
 public IEnumerable <IToolSpecification> GetSpecificationsByToolName(ToolNames toolName)
 {
     try
     {
         IEnumerable <object>             specificationObjects = _parameters.SpecificationRepository.GetAllElements();
         IEnumerable <IToolSpecification> specifications       = specificationObjects.Cast <IToolSpecification>();
         return(specifications.Where(p => p.ToolName == toolName).ToList());
     }
     catch (Exception ex)
     {
         _parameters.Logger.Error($"Exception occured: {ex}");
         return(null);
     }
 }
Ejemplo n.º 3
0
 public object ReadFromFile(string fileNameAndPath, Type type, ToolNames toolName = null)
 {
     lock (_lockObject)
     {
         try
         {
             List <string> headers = ReadTabularHeaders(fileNameAndPath);
             return(ReadTabularDataFile(fileNameAndPath, toolName, headers));
         }
         catch (Exception ex)
         {
             _parameters.Logger.LogMethodError($"Exception occured: {ex}");
             return(null);
         }
     }
 }
Ejemplo n.º 4
0
        private IToolMeasurementData ReadTabularDataFile(string fileNameAndPath, ToolNames toolName, List <string> header)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            List <IMeasurementSerie> results = new List <IMeasurementSerie>();
            List <List <INumericMeasurementPoint> > uniqueResult = new List <List <INumericMeasurementPoint> >();

            for (int i = 0; i < header.Count; i++)
            {
                uniqueResult.Add(new List <INumericMeasurementPoint>());
            }

            using (StreamReader reader = new StreamReader(File.OpenRead(fileNameAndPath)))
            {
                string line = reader.ReadLine(); //skip the first (header) line

                while (!reader.EndOfStream && sw.ElapsedMilliseconds < _parameters.FileReadTimeout)
                {
                    line = reader.ReadLine();
                    string[] elements = line.Split(_parameters.Separator);

                    if (elements.Length != header.Count)
                    {
                        throw new FileLoadException("File contains more or less data rows than the first line (header)");
                    }

                    for (int i = 0; i < elements.Length; i++)
                    {
                        bool valid = double.TryParse(elements[i], out double szam);
                        uniqueResult[i].Add(new NumericMeasurementPoint(szam, valid));
                    }
                }

                for (int i = 0; i < header.Count; i++)
                {
                    results.Add(new MeasurementSerie(header[i], uniqueResult[i]));
                }
            }

            return(new ToolMeasurementData {
                ToolName = toolName, Results = results, Name = fileNameAndPath
            });
        }
Ejemplo n.º 5
0
 public ToolInfo(ToolNames toolEnum)
 {
     toolNameEnum = toolEnum;
 }