| | | 1 | | namespace DirectSight.Parser.Analysis; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents a branch. |
| | | 5 | | /// </summary> |
| | | 6 | | public class Branch |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// The unique identifier of the branch. |
| | | 10 | | /// </summary> |
| | | 11 | | private readonly string identifier; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Initializes a new instance of the <see cref="Branch" /> class. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <param name="branchVisits">The number of branch visits.</param> |
| | | 17 | | /// <param name="identifier">The identifier.</param> |
| | 772 | 18 | | internal Branch(int branchVisits, string identifier) |
| | 772 | 19 | | { |
| | 772 | 20 | | this.BranchVisits = branchVisits; |
| | 772 | 21 | | this.identifier = identifier; |
| | 772 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets the number of branch visits. |
| | | 26 | | /// </summary> |
| | 3197 | 27 | | public int BranchVisits { get; internal set; } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Returns a <see cref="string" /> that represents this instance. |
| | | 31 | | /// </summary> |
| | | 32 | | /// <returns> |
| | | 33 | | /// A <see cref="string" /> that represents this instance. |
| | | 34 | | /// </returns> |
| | | 35 | | public override string ToString() |
| | 0 | 36 | | { |
| | 0 | 37 | | return this.identifier; |
| | 0 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Determines whether the specified <see cref="object"/> is equal to this instance. |
| | | 42 | | /// </summary> |
| | | 43 | | /// <param name="obj">The <see cref="object"/> to compare with this instance.</param> |
| | | 44 | | /// <returns> |
| | | 45 | | /// <c>true</c> if the specified <see cref="object"/> is equal to this instance; otherwise, <c>false</c>. |
| | | 46 | | /// </returns> |
| | | 47 | | public override bool Equals(object obj) |
| | 328 | 48 | | { |
| | 328 | 49 | | if (obj == null || !obj.GetType().Equals(typeof(Branch))) |
| | 2 | 50 | | { |
| | 2 | 51 | | return false; |
| | | 52 | | } |
| | | 53 | | else |
| | 326 | 54 | | { |
| | 326 | 55 | | var branch = (Branch)obj; |
| | 326 | 56 | | return branch.identifier.Equals(this.identifier); |
| | | 57 | | } |
| | 328 | 58 | | } |
| | | 59 | | |
| | | 60 | | /// <summary> |
| | | 61 | | /// Returns a hash code for this instance. |
| | | 62 | | /// </summary> |
| | | 63 | | /// <returns> |
| | | 64 | | /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
| | | 65 | | /// </returns> |
| | 0 | 66 | | public override int GetHashCode() => this.identifier.GetHashCode(); |
| | | 67 | | } |