< Summary

Information
Class: Trailblazer.Pathing.AStarSurveyResult
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/AStar/AStarSurveyResult.cs
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 67
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 Crap Score Cyclomatic complexity Line coverage
get_HasPath()100%44100%
.cctor()100%11100%
.ctor()100%11100%
Create(...)100%22100%
Reset()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/AStar/AStarSurveyResult.cs

#LineLine coverage
 1using System;
 2
 3namespace Trailblazer.Pathing;
 4
 5/// <summary>
 6/// Represents the result of an A* pathfinding survey, including the computed waypoints and related metadata.
 7/// </summary>
 8/// <remarks>
 9/// Use this class to access the waypoints generated by an A* pathfinding operation, along with
 10/// information about the charts utilized and the validity of the result.
 11/// The static Empty instance represents a result with no waypoints.
 12/// </remarks>
 13public class AStarSurveyResult : SurveyResult
 14{
 15    /// <summary>
 16    /// Gets the sequence of waypoints that define the calculated path.
 17    /// </summary>
 18    /// <remarks>
 19    /// The array is empty if no path has been found or calculated.
 20    /// The waypoints are ordered from the start to the end of the path.
 21    /// </remarks>
 22    public AStarWaypoint[] Waypoints { get; private set; } = Array.Empty<AStarWaypoint>();
 23
 24    /// <inheritdoc/>
 225925    public override bool HasPath => IsValid && Waypoints != null && Waypoints.Length > 0;
 26
 27    /// <summary>
 28    /// Represents an empty result for an A* survey operation.
 29    /// </summary>
 130    public static readonly AStarSurveyResult Empty = new();
 31
 35832    private AStarSurveyResult() { }
 33
 34    /// <summary>
 35    /// Creates a new instance of the AStarSurveyResult class with the specified waypoints, charts utilized, and key.
 36    /// </summary>
 37    /// <param name="context">The world context that owns the survey result.</param>
 38    /// <param name="waypoints">An array of AStarWaypoint objects representing the waypoints to include in the survey re
 39    /// <param name="chartsUtilized">An array of chart names that were utilized in the survey. If null, an empty array i
 40    /// <param name="key">The unique key associated with the survey request.</param>
 41    /// <returns>A new AStarSurveyResult instance initialized with the provided waypoints, charts utilized, and key.</re
 42    public static AStarSurveyResult Create(
 43        TrailblazerWorldContext context,
 44        AStarWaypoint[] waypoints,
 45        string[] chartsUtilized,
 46        int key)
 47    {
 17848        PathRequestContextResolver.ThrowIfUnusable(context);
 17849        return new AStarSurveyResult()
 17850        {
 17851            IsValid = true,
 17852            IsInUse = false,
 17853            Context = context,
 17854            ChartsUtilized = chartsUtilized ?? Array.Empty<string>(),
 17855            Waypoints = waypoints,
 17856            LastUsedFrame = -1,
 17857            RequestHashKey = key
 17858        };
 59    }
 60
 61    /// <inheritdoc/>
 62    public override void Reset()
 63    {
 7164        base.Reset();
 7165        Waypoints = Array.Empty<AStarWaypoint>();
 7166    }
 67}