DataStructures/Lists/Queue.php 1 location
|
@@ 31-39 (lines=9) @@
|
28 |
|
private $size; |
29 |
|
private $maxSize; |
30 |
|
|
31 |
|
public function __construct($maxSize = 0) { |
32 |
|
if($maxSize < 0) { |
33 |
|
throw new InvalidArgumentException(); |
34 |
|
} |
35 |
|
$this->maxSize = $maxSize; |
36 |
|
$this->head = null; |
37 |
|
$this->tail = &$this->head; |
38 |
|
$this->size = 0; |
39 |
|
} |
40 |
|
|
41 |
|
/** |
42 |
|
* Returns the queue size. |
DataStructures/Lists/Stack.php 1 location
|
@@ 46-53 (lines=8) @@
|
43 |
|
* @param int $maxSize 0 by default. If greater than 0 is limited. |
44 |
|
* @throws \InvalidArgumentException if size is lower than 0. |
45 |
|
*/ |
46 |
|
public function __construct($maxSize = 0) { |
47 |
|
if($maxSize < 0) { |
48 |
|
throw new InvalidArgumentException(); |
49 |
|
} |
50 |
|
$this->head = null; |
51 |
|
$this->maxSize = $maxSize; |
52 |
|
$this->size = 0; |
53 |
|
} |
54 |
|
|
55 |
|
/** |
56 |
|
* Returns the stack size. |