< Summary

Information
Class: MoreStructures.SuffixTrees.Builders.Ukkonen.MutableEdge
Assembly: MoreStructures
File(s): /home/runner/work/MoreStructures/MoreStructures/MoreStructures/SuffixTrees/Builders/Ukkonen/MutableEdge.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 70
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Start()100%1100%
get_End()100%1100%
.ctor(...)100%1100%
get_Length()100%1100%
Equals(...)100%4100%
GetHashCode()100%1100%
ToString(...)100%2100%

File(s)

/home/runner/work/MoreStructures/MoreStructures/MoreStructures/SuffixTrees/Builders/Ukkonen/MutableEdge.cs

#LineLine coverage
 1namespace MoreStructures.SuffixTrees.Builders.Ukkonen;
 2
 3/// <summary>
 4/// An edge of the tree structure built by <see cref="UkkonenSuffixTreeBuilder"/>, expressed with label compression.
 5/// </summary>
 6/// <remarks>
 7/// Mutable and using a <see cref="MovingEnd"/> to have leaves updated by Rule 1 Extension in constant time.
 8/// </remarks>
 9internal class MutableEdge
 10{
 11    /// <summary>
 12    /// The index (in the text) of the first char of the label associated with this edge.
 13    /// </summary>
 1230814    public int Start { get; }
 15
 16    /// <summary>
 17    /// The index (in the text) of the last char of the label associated with this edge.
 18    /// </summary>
 1223919    public MovingEnd End { get; set; }
 20
 21    /// <summary>
 22    /// <inheritdoc cref="MutableEdge"/>
 23    /// </summary>
 24    /// <param name="start"><inheritdoc cref="Start" path="/summary"/></param>
 25    /// <param name="end"><inheritdoc cref="End" path="/summary"/></param>
 60726    public MutableEdge(int start, MovingEnd end)
 60727    {
 60728        Start = start;
 60729        End = end;
 60730    }
 31
 32    /// <summary>
 33    /// The length of this edge.
 34    /// </summary>
 35    /// <value>
 36    /// A positive value (at least 1).
 37    /// </value>
 1438    public int Length => End.Value - Start + 1;
 39
 40    /// <inheritdoc path="//*[not(self::summary)]"/>
 41    /// <summary>
 42    ///     <inheritdoc/>.
 43    ///     <br/>
 44    ///     To assess equality, <see cref="Start"/> and <see cref="MovingEnd.Value"/> of <see cref="End"/> are
 45    ///     compared.
 46    /// </summary>
 47    public override bool Equals(object? obj) =>
 55448        obj is MutableEdge edge && Equals(Start, edge.Start) && Equals(End.Value, edge.End.Value);
 49
 50    /// <inheritdoc path="//*[not(self::summary)]"/>
 51    /// <summary>
 52    ///     <inheritdoc/>.
 53    ///     <br/>
 54    ///     Calculated based on <see cref="Start"/> only, since <see cref="End"/> is subject to mutation.
 55    /// </summary>
 56    public override int GetHashCode() =>
 91057        Start;
 58
 59    /// <inheritdoc path="//*[not(self::summary)]"/>
 60    /// <summary>
 61    /// In the form [<see cref="Start"/>, <see cref="End"/>] or [<see cref="Start"/>, <see cref="End"/>*], if the
 62    /// <see cref="End"/> of this <see cref="MutableEdge"/> is the provided <paramref name="globalEnd"/>.
 63    /// </summary>
 64    /// <param name="globalEnd">The <see cref="MovingEnd"/> to stringify.</param>
 65    /// <returns>
 66    /// A stringified version of this edge, showing presence or absence of <paramref name="globalEnd"/>.
 67    /// </returns>
 68    public string ToString(MovingEnd globalEnd) =>
 320769        $"[{Start},{End}{(ReferenceEquals(End, globalEnd) ? "*" : string.Empty)}]";
 70}