Changeset 14048 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingPosition.cs
- Timestamp:
- 07/12/16 19:54:35 (8 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingPosition.cs
r14047 r14048 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Problems.BinPacking;27 26 28 27 namespace HeuristicLab.Problems.BinPacking3D { 29 [Item(" Three Dimensional Packing", "Represents a packing-position associated with a three dimensional packing-problem.")]28 [Item("Packing Position (3d)", "Represents a packing-position associated with a three dimensional packing-problem.")] 30 29 [StorableClass] 31 // ThreeDimensionalPackingis immutable (and handled as value type concerning Equals and GetHashCode)32 public class ThreeDimensionalPacking : PackingDimensions{30 // PackingPosition is immutable (and handled as value type concerning Equals and GetHashCode) 31 public class PackingPosition : BinPacking.PackingPosition { 33 32 [Storable] 34 33 private readonly int x; … … 43 42 44 43 [StorableConstructor] 45 protected ThreeDimensionalPacking(bool deserializing) : base(deserializing) { }46 protected ThreeDimensionalPacking(ThreeDimensionalPackingoriginal, Cloner cloner)44 protected PackingPosition(bool deserializing) : base(deserializing) { } 45 protected PackingPosition(PackingPosition original, Cloner cloner) 47 46 : base(original, cloner) { 48 47 x = original.X; … … 51 50 } 52 51 public override IDeepCloneable Clone(Cloner cloner) { 53 return new ThreeDimensionalPacking(this, cloner);52 return new PackingPosition(this, cloner); 54 53 } 55 54 56 public ThreeDimensionalPacking(int assignedBin, int x, int y, int z, bool rotated = false)55 public PackingPosition(int assignedBin, int x, int y, int z, bool rotated = false) 57 56 : base(assignedBin, rotated) { 58 57 this.x = x; … … 67 66 68 67 public override bool Equals(object obj) { 69 var tdp = obj as ThreeDimensionalPacking;68 var tdp = obj as PackingPosition; 70 69 if (tdp != null) 71 70 return (tdp.X == this.X && tdp.Y == this.Y && tdp.Z == this.Z); … … 77 76 } 78 77 79 public static ThreeDimensionalPacking MoveLeft(ThreeDimensionalPackingoriginal) {80 return new ThreeDimensionalPacking(original.AssignedBin, original.X - 1, original.Y, original.Z, original.Rotated);78 public static PackingPosition MoveLeft(PackingPosition original) { 79 return new PackingPosition(original.AssignedBin, original.X - 1, original.Y, original.Z, original.Rotated); 81 80 } 82 public static ThreeDimensionalPacking MoveDown(ThreeDimensionalPackingoriginal) {83 return new ThreeDimensionalPacking(original.AssignedBin, original.X, original.Y - 1, original.Z, original.Rotated);81 public static PackingPosition MoveDown(PackingPosition original) { 82 return new PackingPosition(original.AssignedBin, original.X, original.Y - 1, original.Z, original.Rotated); 84 83 } 85 public static ThreeDimensionalPacking MoveBack(ThreeDimensionalPackingoriginal) {86 return new ThreeDimensionalPacking(original.AssignedBin, original.X, original.Y, original.Z - 1, original.Rotated);84 public static PackingPosition MoveBack(PackingPosition original) { 85 return new PackingPosition(original.AssignedBin, original.X, original.Y, original.Z - 1, original.Rotated); 87 86 } 88 87 89 public static ThreeDimensionalPacking MoveRight(ThreeDimensionalPackingoriginal) {90 return new ThreeDimensionalPacking(original.AssignedBin, original.X + 1, original.Y, original.Z, original.Rotated);88 public static PackingPosition MoveRight(PackingPosition original) { 89 return new PackingPosition(original.AssignedBin, original.X + 1, original.Y, original.Z, original.Rotated); 91 90 } 92 public static ThreeDimensionalPacking MoveUp(ThreeDimensionalPackingoriginal) {93 return new ThreeDimensionalPacking(original.AssignedBin, original.X, original.Y + 1, original.Z, original.Rotated);91 public static PackingPosition MoveUp(PackingPosition original) { 92 return new PackingPosition(original.AssignedBin, original.X, original.Y + 1, original.Z, original.Rotated); 94 93 } 95 public static ThreeDimensionalPacking MoveFront(ThreeDimensionalPackingoriginal) {96 return new ThreeDimensionalPacking(original.AssignedBin, original.X, original.Y, original.Z + 1, original.Rotated);94 public static PackingPosition MoveFront(PackingPosition original) { 95 return new PackingPosition(original.AssignedBin, original.X, original.Y, original.Z + 1, original.Rotated); 97 96 } 98 97 }
Note: See TracChangeset
for help on using the changeset viewer.