namespace CutList.Core.Nesting { /// /// Represents the result of a bin packing operation. /// Contains the packed bins and any items that could not be placed. /// public class PackResult { private readonly List _itemsNotUsed; private readonly List _bins; public PackResult() { _itemsNotUsed = new List(); _bins = new List(); } public PackResult(IEnumerable bins, IEnumerable itemsNotUsed) { _bins = bins?.ToList() ?? new List(); _itemsNotUsed = itemsNotUsed?.ToList() ?? new List(); } /// /// Items that could not be placed in any bin (e.g., too large for stock). /// public IReadOnlyList ItemsNotUsed => _itemsNotUsed; /// /// The bins containing packed items. /// public IReadOnlyList Bins => _bins; public void AddItemNotUsed(BinItem item) { _itemsNotUsed.Add(item); } public void AddItemsNotUsed(IEnumerable items) { _itemsNotUsed.AddRange(items); } public void AddBin(Bin bin) { _bins.Add(bin); } public void AddBins(IEnumerable bins) { _bins.AddRange(bins); } } }