39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using StellaOps.VersionComparison;
|
|
using System.Collections.Immutable;
|
|
|
|
namespace StellaOps.Concelier.Merge.Comparers;
|
|
|
|
|
|
/// <summary>
|
|
/// Result of a version comparison with explainability proof lines.
|
|
/// </summary>
|
|
/// <param name="Comparison">Negative if left < right, zero if equal, positive if left > right.</param>
|
|
/// <param name="ProofLines">Human-readable explanation of comparison steps.</param>
|
|
/// <param name="Comparator">The comparator type used.</param>
|
|
public sealed record VersionComparisonResult(
|
|
int Comparison,
|
|
ImmutableArray<string> ProofLines,
|
|
ComparatorType Comparator)
|
|
{
|
|
/// <summary>
|
|
/// True if the left version is less than the right version.
|
|
/// </summary>
|
|
public bool IsLessThan => Comparison < 0;
|
|
|
|
/// <summary>
|
|
/// True if the left version equals the right version.
|
|
/// </summary>
|
|
public bool IsEqual => Comparison == 0;
|
|
|
|
/// <summary>
|
|
/// True if the left version is greater than the right version.
|
|
/// </summary>
|
|
public bool IsGreaterThan => Comparison > 0;
|
|
|
|
/// <summary>
|
|
/// True if the left version is greater than or equal to the right version.
|
|
/// Useful for checking if installed >= fixed.
|
|
/// </summary>
|
|
public bool IsGreaterThanOrEqual => Comparison >= 0;
|
|
}
|