< Summary

Information
Class: Trailblazer.Pathing.TraversalLegendEntry
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Authoring/TraversalLegendEntry.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 73
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_HasTransitionMedia()100%11100%
.ctor(...)100%22100%
SkipCell()100%11100%
Solid(...)100%11100%
Gas()100%11100%
Liquid()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Authoring/TraversalLegendEntry.cs

#LineLine coverage
 1using System;
 2
 3namespace Trailblazer.Pathing;
 4
 5/// <summary>
 6/// Describes how a single authoring token maps into chart and transition data.
 7/// </summary>
 8[Serializable]
 9public readonly struct TraversalLegendEntry
 10{
 11    /// <summary>
 12    /// The chart cell emitted for this token.
 13    /// </summary>
 14    public NavigationChartCell ChartCell { get; }
 15
 16    /// <summary>
 17    /// Indicates which transition media this token may contribute when explicitly marked.
 18    /// </summary>
 19    public TraversalMedia TransitionMedia { get; }
 20
 21    /// <summary>
 22    /// Returns true when this token may participate in generated transition anchors.
 23    /// </summary>
 4724    public bool HasTransitionMedia => TransitionMedia != TraversalMedia.None;
 25
 26    /// <summary>
 27    /// Creates a new legend entry with the specified chart output and optional transition-anchor output.
 28    /// </summary>
 29    /// <param name="chartCell">The chart cell emitted for this token.</param>
 30    /// <param name="transitionMedia">
 31    /// The transition media emitted when this token is marked.
 32    /// These media must be a subset of the authored media declared by <paramref name="chartCell"/>.
 33    /// </param>
 34    public TraversalLegendEntry(
 35        NavigationChartCell chartCell,
 36        TraversalMedia transitionMedia = TraversalMedia.None)
 37    {
 45638        TraversalMedia authoredMedia = chartCell.TraversalKinds;
 45639        if ((transitionMedia & ~authoredMedia) != 0)
 40        {
 141            throw new ArgumentException(
 142                "Transition media must be a subset of the authored chart cell traversal media.",
 143                nameof(transitionMedia));
 44        }
 45
 45546        ChartCell = chartCell;
 45547        TransitionMedia = transitionMedia;
 45548    }
 49
 50    /// <summary>
 51    /// Creates an entry that contributes no chart traversal and no transition anchor.
 52    /// </summary>
 53    public static TraversalLegendEntry SkipCell() =>
 13654        new(NavigationChartCell.Empty);
 55
 56    /// <summary>
 57    /// Creates an entry that emits an authored solid cell and may participate in generated solid anchors.
 58    /// </summary>
 59    public static TraversalLegendEntry Solid(NavigationChartCell chartCell) =>
 4560        new(chartCell, TraversalMedia.Solid);
 61
 62    /// <summary>
 63    /// Creates an entry that emits authored gas traversal data and an anchor when explicitly marked.
 64    /// </summary>
 65    public static TraversalLegendEntry Gas() =>
 4666        new(NavigationChartCell.Gas, TraversalMedia.Gas);
 67
 68    /// <summary>
 69    /// Creates an entry that emits authored liquid traversal data and an anchor when explicitly marked.
 70    /// </summary>
 71    public static TraversalLegendEntry Liquid() =>
 4772        new(NavigationChartCell.Liquid, TraversalMedia.Liquid);
 73}