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