| | 1 | | using MoreStructures.SuffixStructures; |
| | 2 | | using MoreStructures.SuffixTrees; |
| | 3 | |
|
| | 4 | | namespace MoreStructures.SuffixTries; |
| | 5 | |
|
| | 6 | | /// <summary> |
| | 7 | | /// The index key of the collection of children of a <see cref="SuffixTrieNode"/>, which identifies a single char in |
| | 8 | | /// text, used as a selector to navigate the <see cref="SuffixTrieNode"/> in text pattern matching. |
| | 9 | | /// </summary> |
| | 10 | | /// <param name="Index">The index of the character in the text.</param> |
| | 11 | | /// <remarks> |
| | 12 | | /// Supports <see cref="IComparable{T}"/>, by <see cref="Index"/>. |
| | 13 | | /// </remarks> |
| 24054 | 14 | | public record SuffixTrieEdge(int Index) |
| 21756 | 15 | | : SuffixTreeEdge(Index, 1), ISuffixStructureEdge<SuffixTrieEdge, SuffixTrieNode>, IComparable<SuffixTrieEdge> |
| | 16 | | { |
| | 17 | | /// <inheritdoc path="//*[not(self::summary)]"/> |
| | 18 | | /// <summary> |
| | 19 | | /// <inheritdoc/> |
| | 20 | | /// <br/> |
| | 21 | | /// Comparison is done by <see cref="Index"/>: lower is smaller, higher is bigger. |
| | 22 | | /// </summary> |
| | 23 | | /// <exception cref="ArgumentException"> |
| | 24 | | /// Thrown when <paramref name="other"/> is not a <see cref="SuffixTrieEdge"/>. |
| | 25 | | /// </exception> |
| | 26 | | public int CompareTo(SuffixTrieEdge? other) => |
| 10 | 27 | | other != null |
| 10 | 28 | | ? Index - other.Index |
| 10 | 29 | | : throw new ArgumentException($"Invalid comparison: cannot compare to null."); |
| | 30 | |
|
| | 31 | | /// <inheritdoc path="//*[not(self::summary)]"/> |
| | 32 | | /// <summary> |
| | 33 | | /// <inheritdoc/> |
| | 34 | | /// <br/> |
| | 35 | | /// Generates a string in the form "(<see cref="SuffixTreeEdge.Start"/>)". <see cref="SuffixTreeEdge.Length"/> |
| | 36 | | /// is not included as in this context it is always 1. |
| | 37 | | /// </summary> |
| 54 | 38 | | public override string ToString() => $"({Start})"; |
| | 39 | | } |