refactor(jobs): single-source strategy resolution in adapter
LegacyPlateNesterAdapter.Create now delegates to PlateNesterFactory instead of carrying its own minimal Default-only switch, so built-in strategy resolution has one source of truth. Behavior unchanged: unknown keys still reject; all four built-ins now resolvable. 44 net8.0 tests pass in Debug and Release; 0 warnings.
This commit is contained in:
@@ -18,10 +18,10 @@ public sealed class LegacyPlateNesterAdapter : IPlateNester
|
|||||||
this.engineFactory = engineFactory;
|
this.engineFactory = engineFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Minimal built-in selection; never reads or changes NestEngineRegistry.</summary>
|
/// <summary>Convenience overload delegating to <see cref="PlateNesterFactory"/> so strategy
|
||||||
public static IPlateNester Create(string strategy) => strategy == "Default"
|
/// resolution has a single source of truth; rejects unknown keys. Never reads or changes the
|
||||||
? new LegacyPlateNesterAdapter(plate => new DefaultNestEngine(plate))
|
/// process-global NestEngineRegistry.</summary>
|
||||||
: throw new NotSupportedException($"Unknown placement strategy: {strategy}.");
|
public static IPlateNester Create(string strategy) => PlateNesterFactory.Create(strategy);
|
||||||
|
|
||||||
public PlateCandidate Place(PlatePlacementRequest request, IProgress<NestJobProgress> progress = null,
|
public PlateCandidate Place(PlatePlacementRequest request, IProgress<NestJobProgress> progress = null,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
|
|||||||
Reference in New Issue
Block a user