XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
namespace XFEEDToolBox.Core.Galaxy;

/// <summary>Coverage evidence from one bounded Stellar Forge query, separate from its returned rows.</summary>
public sealed record GalaxyRegionResult(IReadOnlyList<GalacticSystem> Systems, int MinimumMassCode = -1,
    int ProcessedCells = -1, int TotalCells = -1, bool Truncated = false, bool Complete = false, int FailedCells = 0)
{
    public string Error { get; init; }="";
    public string Scope { get; init; }="";
    public int RequestedCells { get; init; }=-1;
    public XFEEDToolBox.Core.Models.Coordinates? Origin { get; init; }
    public const int NativeRowLimit = 24000;
    public const int NativeSingleCellRowLimit = 131072;
    public int RowLimit {get;init;}=NativeRowLimit;
    public bool WithinReturnedRowBudget=>RowLimit==NativeRowLimit?Systems.Count<NativeRowLimit:
        RowLimit==NativeSingleCellRowLimit&&Scope=="requested-cells"&&RequestedCells==1&&Systems.Count<=NativeSingleCellRowLimit;
    public bool HasCoverageEvidence => MinimumMassCode >= 0 && ProcessedCells >= 0 && TotalCells >= 0;
    public bool IsFullyCovered => Scope!="requested-cells" && Complete && Error.Length==0 && !Truncated && Systems.Count < NativeRowLimit && MinimumMassCode == 0
        && FailedCells == 0 && ProcessedCells == TotalCells && TotalCells > 0;
    public bool AreRequestedCellsCovered=>Scope=="requested-cells"&&RequestedCells>0&&RequestedCells==TotalCells&&
        Complete&&Error.Length==0&&!Truncated&&WithinReturnedRowBudget&&FailedCells==0&&ProcessedCells==TotalCells;
    public bool NeedsSubdivision => Truncated || !WithinReturnedRowBudget || Scope!="requested-cells"&&MinimumMassCode > 0 || FailedCells > 0 || Error.Length > 0
        || ProcessedCells >= 0 && TotalCells >= 0 && ProcessedCells < TotalCells;
    public static GalaxyRegionResult Covered(IReadOnlyList<GalacticSystem> systems) => new(systems, 0, 1, 1, false, true);
}

/// <summary>Actual append-only native rows received before the bounded region job has finished.</summary>
public sealed record GalaxyNativeRegionProgress(long Generation, XFEEDToolBox.Core.Models.Coordinates Centre,
    double Radius, IReadOnlyList<GalacticSystem> Systems, GalaxyRegionResult Coverage, bool Done,
    int TotalAvailable, int DownloadedCount);