1 | <?php namespace GenericCollections\Traits; |
||
16 | trait DequeCommonMethods |
||
17 | { |
||
18 | /** |
||
19 | * This function must return the container internal name, like 'deque', 'queue' or 'stack' |
||
20 | * @return string |
||
21 | */ |
||
22 | abstract protected function containerInternalName(); |
||
23 | |||
24 | /** |
||
25 | * @see \GenericCollections\Interfaces\BaseOptions::optionAllowNullMembers |
||
26 | * @return bool |
||
27 | */ |
||
28 | abstract public function optionAllowNullMembers(); |
||
29 | |||
30 | /** |
||
31 | * @see \GenericCollections\Interfaces\BaseOptions::optionUniqueValues |
||
32 | * @return bool |
||
33 | */ |
||
34 | abstract public function optionUniqueValues(); |
||
35 | |||
36 | /** |
||
37 | * @see \GenericCollections\Interfaces\BaseOptions::optionComparisonIsIdentical |
||
38 | * @return bool |
||
39 | */ |
||
40 | abstract public function optionComparisonIsIdentical(); |
||
41 | |||
42 | /** |
||
43 | * @see \GenericCollections\Interfaces\BaseCollectionInterface::checkElementType |
||
44 | * @param mixed $element |
||
45 | * @return bool |
||
46 | */ |
||
47 | abstract public function checkElementType($element); |
||
48 | |||
49 | /** |
||
50 | * @see \GenericCollections\Interfaces\BaseCollectionInterface::getElementType |
||
51 | * @return string |
||
52 | */ |
||
53 | abstract public function getElementType(); |
||
54 | |||
55 | /** |
||
56 | * @see \GenericCollections\Internal\StorageInterface::isEmpty |
||
57 | * @return bool |
||
58 | */ |
||
59 | abstract public function isEmpty(); |
||
60 | |||
61 | /** |
||
62 | * Throw an exception when add a non valid element |
||
63 | * |
||
64 | * @param $element |
||
65 | */ |
||
66 | 72 | private function checkElementAdd($element) |
|
90 | |||
91 | /** |
||
92 | * Throw an exception when add a non valid element |
||
93 | * |
||
94 | * @param $element |
||
95 | * @return bool |
||
96 | */ |
||
97 | 20 | private function checkElementOffer($element) |
|
106 | |||
107 | 12 | public function addFirst($element) |
|
112 | |||
113 | 52 | public function addLast($element) |
|
118 | |||
119 | 7 | public function offerFirst($element) |
|
127 | |||
128 | 13 | public function offerLast($element) |
|
136 | |||
137 | 8 | public function getFirst() |
|
144 | |||
145 | 2 | public function peekFirst() |
|
152 | |||
153 | 6 | public function removeFirst() |
|
160 | |||
161 | 4 | public function pollFirst() |
|
168 | |||
169 | 9 | public function contains($element) |
|
173 | |||
174 | 81 | protected function createStorageObject() |
|
181 | } |
||
182 |