| | | 1 | | using System.Collections.Generic; |
| | | 2 | | |
| | | 3 | | namespace DirectSight.Parser.Analysis; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Coverage information of a source file. |
| | | 7 | | /// </summary> |
| | | 8 | | public class FileAnalysis |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// The coverage information of the lines in the source file. |
| | | 12 | | /// </summary> |
| | 65 | 13 | | private readonly List<LineAnalysis> lineAnalysis = []; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Initializes a new instance of the <see cref="FileAnalysis"/> class. |
| | | 17 | | /// </summary> |
| | | 18 | | /// <param name="path">The path of the source file.</param> |
| | 65 | 19 | | internal FileAnalysis(string path) |
| | 65 | 20 | | { |
| | 65 | 21 | | this.Path = path; |
| | 65 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Initializes a new instance of the <see cref="FileAnalysis"/> class. |
| | | 26 | | /// </summary> |
| | | 27 | | /// <param name="path">The path of the source file.</param> |
| | | 28 | | /// <param name="error">The error.</param> |
| | | 29 | | internal FileAnalysis(string path, string error) |
| | 65 | 30 | | : this(path) |
| | 65 | 31 | | { |
| | 65 | 32 | | this.Error = error; |
| | 65 | 33 | | } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Gets the path. |
| | | 37 | | /// </summary> |
| | | 38 | | /// <value>The path.</value> |
| | 42 | 39 | | public string Path { get; } |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// Gets the error. |
| | | 43 | | /// </summary> |
| | | 44 | | /// <value>The error.</value> |
| | 40 | 45 | | public string Error { get; } |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// Gets the coverage information of the lines in the file. |
| | | 49 | | /// </summary> |
| | | 50 | | /// <value>The lines.</value> |
| | 283 | 51 | | public IEnumerable<LineAnalysis> Lines => this.lineAnalysis; |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// Returns a <see cref="string" /> that represents this instance. |
| | | 55 | | /// </summary> |
| | | 56 | | /// <returns> |
| | | 57 | | /// A <see cref="string" /> that represents this instance. |
| | | 58 | | /// </returns> |
| | | 59 | | public override string ToString() |
| | 0 | 60 | | { |
| | 0 | 61 | | return this.Path; |
| | 0 | 62 | | } |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Adds the given line analysis to the file analysis. |
| | | 66 | | /// </summary> |
| | | 67 | | /// <param name="lineAnalysis">The line analysis.</param> |
| | | 68 | | internal void AddLineAnalysis(LineAnalysis lineAnalysis) |
| | 2542 | 69 | | { |
| | 2542 | 70 | | this.lineAnalysis.Add(lineAnalysis); |
| | 2542 | 71 | | } |
| | | 72 | | } |