public EvaluationResult(DateTime creationTime, bool successfulCalculation, IReadOnlyList <IQuantityEvaluationResult> quantityEvaluationResults, ToolNames toolName, string name) : base(creationTime, successfulCalculation) { QuantityEvaluationResults = quantityEvaluationResults; ToolName = toolName; Name = name; }
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); } }
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); } } }
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 }); }
public ToolInfo(ToolNames toolEnum) { toolNameEnum = toolEnum; }