using System; using System.Collections.Generic; using System.Collections.ObjectModel; namespace MultiWheelC.TrajectoryPlanning.EMPlanner; /// Immutable reconstructed lateral path, marked only after independent validation. public sealed class LateralPath { public LateralPath(IReadOnlyList points, bool independentlyValidated) { if (points == null) throw new ArgumentNullException(nameof(points)); var copy = new List(points.Count); for (int index = 0; index < points.Count; index++) { if (points[index] == null) throw new ArgumentException("Lateral path points cannot contain null values.", nameof(points)); copy.Add(points[index]); } Points = new ReadOnlyCollection(copy); IsIndependentlyValidated = independentlyValidated; } public IReadOnlyList Points { get; } public bool IsIndependentlyValidated { get; } }