source: branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFactory.cs @ 15471

Last change on this file since 15471 was 15471, checked in by rhanghof, 22 months ago

#2817

  • Added some unit tests
  • Enhanced the documentation
File size: 1.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6
7namespace HeuristicLab.Problems.BinPacking3D.Packer {
8
9  /// <summary>
10  /// This class can be used for creating bin packer insances
11  /// </summary>
12  public static class BinPackerFactory {
13
14    /// <summary>
15    /// Returns the bin packer depending on the given fitting method
16    /// </summary>
17    /// <param name="fittingMethod"></param>
18    /// <returns>Returns a new BinPacker depending on the given fitting method</returns>
19    public static BinPacker CreateBinPacker(FittingMethod fittingMethod) {
20      BinPacker binPacker = null;
21      switch (fittingMethod) {
22        case FittingMethod.FirstFit:
23          binPacker = new BinPackerFirstFit();
24          break;
25        case FittingMethod.FreeVolumeBestFit:
26          binPacker = new BinPackerFreeVolumeBestFit();
27          break;
28        case FittingMethod.ResidualSpaceBestFit:
29          binPacker = new BinPackerResidualSpaceBestFit();
30          break;
31        default:
32          throw new ArgumentException("Unknown fitting method: " + fittingMethod);
33      }
34      return binPacker;
35    }
36  }
37}
Note: See TracBrowser for help on using the repository browser.