< Summary

Information
Class: Trailblazer.Pathing.RegisteredTraversalTransition
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Transition/Registry/RegisteredTraversalTransition.cs
Line coverage
100%
Covered lines: 30
Uncovered lines: 0
Coverable lines: 30
Total lines: 77
Line coverage: 100%
Branch coverage
100%
Covered branches: 18
Total branches: 18
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Equals(...)100%1616100%
Equals(...)100%22100%
GetHashCode()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Transition/Registry/RegisteredTraversalTransition.cs

#LineLine coverage
 1using FixedMathSharp;
 2using GridForge.Spatial;
 3using System;
 4
 5namespace Trailblazer.Pathing;
 6
 7/// <summary>
 8/// A registered transition together with the voxel endpoints it resolved to.
 9/// </summary>
 10internal readonly struct RegisteredTraversalTransition : IEquatable<RegisteredTraversalTransition>
 11{
 12    public RegisteredTraversalTransition(
 13        TraversalTransition transition,
 14        TraversalTransitionOwnershipKind ownershipKind,
 15        int priority,
 16        int registrationOrder)
 17    {
 21018        Transition = transition;
 21019        SourceVoxelIndex = transition.Source.VoxelIndex;
 21020        SourcePosition = transition.Source.Position;
 21021        DestinationVoxelIndex = transition.Destination.VoxelIndex;
 21022        DestinationPosition = transition.Destination.Position;
 21023        OwnershipKind = ownershipKind;
 21024        Priority = priority;
 21025        RegistrationOrder = registrationOrder;
 21026    }
 27
 28    public TraversalTransition Transition { get; }
 29
 30    public WorldVoxelIndex SourceVoxelIndex { get; }
 31
 32    public Vector3d SourcePosition { get; }
 33
 34    public WorldVoxelIndex DestinationVoxelIndex { get; }
 35
 36    public Vector3d DestinationPosition { get; }
 37
 38    public TraversalTransitionOwnershipKind OwnershipKind { get; }
 39
 40    public int Priority { get; }
 41
 42    public int RegistrationOrder { get; }
 43
 44    public bool Equals(RegisteredTraversalTransition other)
 45    {
 5946        return Transition.Type == other.Transition.Type
 5947            && Transition.PathCostModifier == other.Transition.PathCostModifier
 5948            && Transition.IsBidirectional == other.Transition.IsBidirectional
 5949            && Transition.Source.Medium == other.Transition.Source.Medium
 5950            && SourceVoxelIndex.Equals(other.SourceVoxelIndex)
 5951            && SourcePosition.Equals(other.SourcePosition)
 5952            && Transition.Destination.Medium == other.Transition.Destination.Medium
 5953            && DestinationVoxelIndex.Equals(other.DestinationVoxelIndex)
 5954            && DestinationPosition.Equals(other.DestinationPosition);
 55    }
 56
 57    public override bool Equals(object? obj) =>
 258        obj is RegisteredTraversalTransition other && Equals(other);
 59
 60    public override int GetHashCode()
 61    {
 62        unchecked
 63        {
 56564            int hash = 17;
 56565            hash = hash * 31 + Transition.Type.GetHashCode();
 56566            hash = hash * 31 + Transition.PathCostModifier;
 56567            hash = hash * 31 + Transition.IsBidirectional.GetHashCode();
 56568            hash = hash * 31 + Transition.Source.Medium.GetHashCode();
 56569            hash = hash * 31 + SourceVoxelIndex.GetHashCode();
 56570            hash = hash * 31 + SourcePosition.GetHashCode();
 56571            hash = hash * 31 + Transition.Destination.Medium.GetHashCode();
 56572            hash = hash * 31 + DestinationVoxelIndex.GetHashCode();
 56573            hash = hash * 31 + DestinationPosition.GetHashCode();
 56574            return hash;
 75        }
 76    }
 77}