refactor: simplify NestProgress with computed properties and ProgressReport struct
Replace stored property setters (BestPartCount, BestDensity, NestedWidth, NestedLength, NestedArea) with computed properties that derive values from BestParts, with a lazy cache invalidated on setter. Add internal ProgressReport struct to replace the 7-parameter ReportProgress signature. Update all 13 callsites and AccumulatingProgress. Delete FormatPhaseName in favor of NestPhase.ShortName() extension. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ public class AccumulatingProgressTests
|
||||
var accumulating = new AccumulatingProgress(inner, previous);
|
||||
|
||||
var newParts = new List<Part> { TestHelpers.MakePartAt(20, 0, 10) };
|
||||
accumulating.Report(new NestProgress { BestParts = newParts, BestPartCount = 1 });
|
||||
accumulating.Report(new NestProgress { BestParts = newParts });
|
||||
|
||||
Assert.NotNull(inner.Last);
|
||||
Assert.Equal(2, inner.Last.BestParts.Count);
|
||||
@@ -32,7 +32,7 @@ public class AccumulatingProgressTests
|
||||
var accumulating = new AccumulatingProgress(inner, new List<Part>());
|
||||
|
||||
var newParts = new List<Part> { TestHelpers.MakePartAt(0, 0, 10) };
|
||||
accumulating.Report(new NestProgress { BestParts = newParts, BestPartCount = 1 });
|
||||
accumulating.Report(new NestProgress { BestParts = newParts });
|
||||
|
||||
Assert.NotNull(inner.Last);
|
||||
Assert.Single(inner.Last.BestParts);
|
||||
|
||||
Reference in New Issue
Block a user