Changeset 13574 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem/CuboidPackingItem.cs
- Timestamp:
- 01/28/16 18:32:54 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem/CuboidPackingItem.cs
r13497 r13574 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 using HeuristicLab.Common; 28 using HeuristicLab.Data; 29 using HeuristicLab.Parameters; 28 30 using HeuristicLab.Problems.BinPacking.PackingBin; 29 31 … … 32 34 [StorableClass] 33 35 public class CuboidPackingItem : CuboidPackingShape, IPackingItem { 34 [Storable] 35 public CuboidPackingBin TargetBin { get; set; } 36 public CuboidPackingBin TargetBin { 37 get { return ((IValueParameter<CuboidPackingBin>)Parameters["TargetBin"]).Value; } 38 set { ((IValueParameter<CuboidPackingBin>)Parameters["TargetBin"]).Value = value; } 39 } 36 40 37 [Storable] 38 public double Weight { get; set; } 41 public double Weight { 42 get { return ((IFixedValueParameter<DoubleValue>)Parameters["Weight"]).Value.Value; } 43 set { ((IFixedValueParameter<DoubleValue>)Parameters["Weight"]).Value.Value = value; } 44 } 39 45 40 [Storable] 41 public int Material { get; set; } 46 public int Material { 47 get { return ((IFixedValueParameter<IntValue>)Parameters["Material"]).Value.Value; } 48 set { ((IFixedValueParameter<IntValue>)Parameters["Material"]).Value.Value = value; } 49 } 42 50 43 51 public bool SupportsStacking(IPackingItem other) { … … 49 57 protected CuboidPackingItem(CuboidPackingItem original, Cloner cloner) 50 58 : base(original, cloner) { 51 this.Weight = original.Weight;52 this.Material = original.Material;53 this.TargetBin = cloner.Clone(TargetBin);54 }55 public override IDeepCloneable Clone(Cloner cloner) {56 return new CuboidPackingItem(this, cloner);57 59 } 58 60 public CuboidPackingItem() 59 61 : base() { 62 Parameters.Add(new ValueParameter<CuboidPackingBin>("TargetBin")); 63 Parameters.Add(new FixedValueParameter<DoubleValue>("Weight")); 64 Parameters.Add(new FixedValueParameter<IntValue>("Material")); 60 65 } 61 66 62 67 public CuboidPackingItem(int width, int height, int depth, CuboidPackingBin targetBin, double weight, int material) 63 : this(width, height, depth, targetBin) { 68 : this() { 69 this.Width = width; 70 this.Height = height; 71 this.Depth = depth; 64 72 this.Weight = weight; 65 73 this.Material = material; 74 this.TargetBin = (CuboidPackingBin)targetBin.Clone(); 66 75 } 67 76 68 77 public CuboidPackingItem(int width, int height, int depth, CuboidPackingBin targetBin) 69 : base(width, height, depth) { 78 : this() { 79 this.Width = width; 80 this.Height = height; 81 this.Depth = depth; 70 82 this.TargetBin = (CuboidPackingBin)targetBin.Clone(); 83 } 84 85 public override IDeepCloneable Clone(Cloner cloner) { 86 return new CuboidPackingItem(this, cloner); 71 87 } 72 88
Note: See TracChangeset
for help on using the changeset viewer.