|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Box packing (3D bin packing, knapsack problem) |
|
4
|
|
|
* @package BoxPacker |
|
5
|
|
|
* @author Doug Wright |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace DVDoug\BoxPacker; |
|
9
|
|
|
|
|
10
|
|
|
class TestBox implements Box { |
|
11
|
|
|
|
|
12
|
|
|
public function __construct($aReference, $aOuterWidth,$aOuterLength,$aOuterDepth,$aEmptyWeight,$aInnerWidth,$aInnerLength,$aInnerDepth,$aMaxWeight) { |
|
13
|
|
|
$this->reference = $aReference; |
|
14
|
|
|
$this->outerWidth = $aOuterWidth; |
|
15
|
|
|
$this->outerLength = $aOuterLength; |
|
16
|
|
|
$this->outerDepth = $aOuterDepth; |
|
17
|
|
|
$this->emptyWeight = $aEmptyWeight; |
|
18
|
|
|
$this->innerWidth = $aInnerWidth; |
|
19
|
|
|
$this->innerLength = $aInnerLength; |
|
20
|
|
|
$this->innerDepth = $aInnerDepth; |
|
21
|
|
|
$this->maxWeight = $aMaxWeight; |
|
22
|
|
|
$this->innerVolume = $this->innerWidth * $this->innerLength * $this->innerDepth; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
public function getReference() { |
|
26
|
|
|
return $this->reference; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function getOuterWidth() { |
|
30
|
|
|
return $this->outerWidth; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function getOuterLength() { |
|
34
|
|
|
return $this->outerLength; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function getOuterDepth() { |
|
38
|
|
|
return $this->outerDepth; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function getEmptyWeight() { |
|
42
|
|
|
return $this->emptyWeight; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function getInnerWidth() { |
|
46
|
|
|
return $this->innerWidth; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getInnerLength() { |
|
50
|
|
|
return $this->innerLength; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function getInnerDepth() { |
|
54
|
|
|
return $this->innerDepth; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getInnerVolume() { |
|
58
|
|
|
return $this->innerVolume; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getMaxWeight() { |
|
62
|
|
|
return $this->maxWeight; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
class TestItem implements Item { |
|
67
|
|
|
|
|
68
|
|
|
public function __construct($aDescription,$aWidth,$aLength,$aDepth,$aWeight) { |
|
69
|
|
|
$this->description = $aDescription; |
|
70
|
|
|
$this->width = $aWidth; |
|
71
|
|
|
$this->length = $aLength; |
|
72
|
|
|
$this->depth = $aDepth; |
|
73
|
|
|
$this->weight = $aWeight; |
|
74
|
|
|
$this->volume = $this->width * $this->length * $this->depth; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function getDescription() { |
|
78
|
|
|
return $this->description; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function getWidth() { |
|
82
|
|
|
return $this->width; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function getLength() { |
|
86
|
|
|
return $this->length; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function getDepth() { |
|
90
|
|
|
return $this->depth; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function getWeight() { |
|
94
|
|
|
return $this->weight; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function getVolume() { |
|
98
|
|
|
return $this->volume; |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
|