@@ 76-453 (lines=378) @@ | ||
73 | * |
|
74 | * @package Ds |
|
75 | */ |
|
76 | final class Deque implements IteratorAggregate, ArrayAccess, Sequence |
|
77 | { |
|
78 | const MIN_CAPACITY = 8; |
|
79 | ||
80 | // BEGIN GenericCollection Trait |
|
81 | /** |
|
82 | * Returns whether the collection is empty. |
|
83 | * |
|
84 | * This should be equivalent to a count of zero, but is not required. |
|
85 | * Implementations should define what empty means in their own context. |
|
86 | * |
|
87 | * @return bool whether the collection is empty. |
|
88 | */ |
|
89 | public function isEmpty(): bool |
|
90 | { |
|
91 | } |
|
92 | ||
93 | /** |
|
94 | * Returns a representation that can be natively converted to JSON, which is |
|
95 | * called when invoking json_encode. |
|
96 | * |
|
97 | * @return mixed the data to be JSON encoded. |
|
98 | * |
|
99 | * @see JsonSerializable |
|
100 | */ |
|
101 | public function jsonSerialize() |
|
102 | { |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * Creates a shallow copy of the collection. |
|
107 | * |
|
108 | * @return Collection a shallow copy of the collection. |
|
109 | */ |
|
110 | public function copy(): Collection |
|
111 | { |
|
112 | } |
|
113 | ||
114 | /** |
|
115 | * Invoked when calling var_dump. |
|
116 | * |
|
117 | * @return array |
|
118 | */ |
|
119 | public function __debugInfo(): array |
|
120 | { |
|
121 | } |
|
122 | ||
123 | /** |
|
124 | * Returns a string representation of the collection, which is invoked when |
|
125 | * the collection is converted to a string. |
|
126 | * |
|
127 | * @return string |
|
128 | */ |
|
129 | public function __toString(): string |
|
130 | { |
|
131 | } |
|
132 | // END GenericCollection Trait |
|
133 | ||
134 | // BEGIN GenericSequence Trait |
|
135 | /** |
|
136 | * @inheritDoc |
|
137 | */ |
|
138 | public function __construct($values = null) |
|
139 | { |
|
140 | } |
|
141 | ||
142 | /** |
|
143 | * Returns an array representation of the collection. |
|
144 | * |
|
145 | * The format of the returned array is implementation-dependent. Some |
|
146 | * implementations may throw an exception if an array representation |
|
147 | * could not be created (for example when object are used as keys). |
|
148 | * |
|
149 | * @return array |
|
150 | */ |
|
151 | public function toArray(): array |
|
152 | { |
|
153 | } |
|
154 | ||
155 | /** |
|
156 | * @inheritdoc |
|
157 | */ |
|
158 | public function apply(callable $callback) |
|
159 | { |
|
160 | } |
|
161 | ||
162 | /** |
|
163 | * @inheritdoc |
|
164 | */ |
|
165 | public function merge($values): Sequence |
|
166 | { |
|
167 | } |
|
168 | ||
169 | /** |
|
170 | * @inheritdoc |
|
171 | */ |
|
172 | public function count(): int |
|
173 | { |
|
174 | } |
|
175 | ||
176 | /** |
|
177 | * @inheritDoc |
|
178 | */ |
|
179 | public function contains(...$values): bool |
|
180 | { |
|
181 | } |
|
182 | ||
183 | /** |
|
184 | * @inheritDoc |
|
185 | */ |
|
186 | public function filter(callable $callback = null): Sequence |
|
187 | { |
|
188 | } |
|
189 | ||
190 | /** |
|
191 | * @inheritDoc |
|
192 | */ |
|
193 | public function find($value) |
|
194 | { |
|
195 | } |
|
196 | ||
197 | /** |
|
198 | * @inheritDoc |
|
199 | */ |
|
200 | public function first() |
|
201 | { |
|
202 | } |
|
203 | ||
204 | /** |
|
205 | * @inheritDoc |
|
206 | */ |
|
207 | public function get(int $index) |
|
208 | { |
|
209 | } |
|
210 | ||
211 | /** |
|
212 | * @inheritDoc |
|
213 | */ |
|
214 | public function insert(int $index, ...$values) |
|
215 | { |
|
216 | } |
|
217 | ||
218 | /** |
|
219 | * @inheritDoc |
|
220 | */ |
|
221 | public function join(string $glue = null): string |
|
222 | { |
|
223 | } |
|
224 | ||
225 | /** |
|
226 | * @inheritDoc |
|
227 | */ |
|
228 | public function last() |
|
229 | { |
|
230 | } |
|
231 | ||
232 | /** |
|
233 | * @inheritDoc |
|
234 | */ |
|
235 | public function map(callable $callback): Sequence |
|
236 | { |
|
237 | } |
|
238 | ||
239 | /** |
|
240 | * @inheritDoc |
|
241 | */ |
|
242 | public function pop() |
|
243 | { |
|
244 | } |
|
245 | ||
246 | /** |
|
247 | * @inheritDoc |
|
248 | */ |
|
249 | public function push(...$values) |
|
250 | { |
|
251 | } |
|
252 | ||
253 | /** |
|
254 | * @inheritDoc |
|
255 | */ |
|
256 | public function reduce(callable $callback, $initial = null) |
|
257 | { |
|
258 | } |
|
259 | ||
260 | /** |
|
261 | * @inheritDoc |
|
262 | */ |
|
263 | public function remove(int $index) |
|
264 | { |
|
265 | } |
|
266 | ||
267 | /** |
|
268 | * @inheritDoc |
|
269 | */ |
|
270 | public function reverse() |
|
271 | { |
|
272 | } |
|
273 | ||
274 | /** |
|
275 | * @inheritDoc |
|
276 | */ |
|
277 | public function reversed(): Sequence |
|
278 | { |
|
279 | } |
|
280 | ||
281 | /** |
|
282 | * @inheritDoc |
|
283 | */ |
|
284 | public function rotate(int $rotations) |
|
285 | { |
|
286 | } |
|
287 | ||
288 | /** |
|
289 | * @inheritDoc |
|
290 | */ |
|
291 | public function set(int $index, $value) |
|
292 | { |
|
293 | } |
|
294 | ||
295 | /** |
|
296 | * @inheritDoc |
|
297 | */ |
|
298 | public function shift() |
|
299 | { |
|
300 | } |
|
301 | ||
302 | /** |
|
303 | * @inheritDoc |
|
304 | */ |
|
305 | public function slice(int $offset, int $length = null): Sequence |
|
306 | { |
|
307 | } |
|
308 | ||
309 | /** |
|
310 | * @inheritDoc |
|
311 | */ |
|
312 | public function sort(callable $comparator = null) |
|
313 | { |
|
314 | } |
|
315 | ||
316 | /** |
|
317 | * @inheritDoc |
|
318 | */ |
|
319 | public function sorted(callable $comparator = null): Sequence |
|
320 | { |
|
321 | } |
|
322 | ||
323 | /** |
|
324 | * @inheritDoc |
|
325 | */ |
|
326 | public function sum() |
|
327 | { |
|
328 | } |
|
329 | ||
330 | /** |
|
331 | * @inheritDoc |
|
332 | */ |
|
333 | public function unshift(...$values) |
|
334 | { |
|
335 | } |
|
336 | ||
337 | /** |
|
338 | * |
|
339 | */ |
|
340 | public function getIterator() |
|
341 | { |
|
342 | } |
|
343 | ||
344 | /** |
|
345 | * @inheritdoc |
|
346 | */ |
|
347 | public function clear() |
|
348 | { |
|
349 | } |
|
350 | ||
351 | /** |
|
352 | * @inheritdoc |
|
353 | */ |
|
354 | public function offsetSet($offset, $value) |
|
355 | { |
|
356 | } |
|
357 | ||
358 | /** |
|
359 | * @inheritdoc |
|
360 | */ |
|
361 | public function &offsetGet($offset) |
|
362 | { |
|
363 | } |
|
364 | ||
365 | /** |
|
366 | * @inheritdoc |
|
367 | */ |
|
368 | public function offsetUnset($offset) |
|
369 | { |
|
370 | } |
|
371 | ||
372 | /** |
|
373 | * @inheritdoc |
|
374 | */ |
|
375 | public function offsetExists($offset) |
|
376 | { |
|
377 | } |
|
378 | // END GenericSequence Trait |
|
379 | ||
380 | // BEGIN SquaredCapacityTrait |
|
381 | // BEGIN Capacity Trait |
|
382 | /** |
|
383 | * Returns the current capacity. |
|
384 | * |
|
385 | * @return int |
|
386 | */ |
|
387 | public function capacity(): int |
|
388 | { |
|
389 | } |
|
390 | ||
391 | /** |
|
392 | * Ensures that enough memory is allocated for a specified capacity. This |
|
393 | * potentially reduces the number of reallocations as the size increases. |
|
394 | * |
|
395 | * @param int $capacity The number of values for which capacity should be |
|
396 | * allocated. Capacity will stay the same if this value |
|
397 | * is less than or equal to the current capacity. |
|
398 | */ |
|
399 | public function allocate(int $capacity) |
|
400 | { |
|
401 | } |
|
402 | ||
403 | /** |
|
404 | * @return float the structures growth factor. |
|
405 | */ |
|
406 | protected function getGrowthFactor(): float |
|
407 | { |
|
408 | } |
|
409 | ||
410 | /** |
|
411 | * @return float to multiply by when decreasing capacity. |
|
412 | */ |
|
413 | protected function getDecayFactor(): float |
|
414 | { |
|
415 | } |
|
416 | ||
417 | /** |
|
418 | * Checks and adjusts capacity if required. |
|
419 | */ |
|
420 | protected function checkCapacity() |
|
421 | { |
|
422 | } |
|
423 | ||
424 | /** |
|
425 | * Called when capacity should be decrease if it drops below a threshold. |
|
426 | */ |
|
427 | protected function decreaseCapacity() |
|
428 | { |
|
429 | } |
|
430 | ||
431 | /** |
|
432 | * @return bool whether capacity should be increased. |
|
433 | */ |
|
434 | protected function shouldDecreaseCapacity(): bool |
|
435 | { |
|
436 | } |
|
437 | ||
438 | /** |
|
439 | * @return bool whether capacity should be increased. |
|
440 | */ |
|
441 | protected function shouldIncreaseCapacity(): bool |
|
442 | { |
|
443 | } |
|
444 | // END Capacity Trait |
|
445 | ||
446 | /** |
|
447 | * Called when capacity should be increased to accommodate new values. |
|
448 | */ |
|
449 | protected function increaseCapacity() |
|
450 | { |
|
451 | } |
|
452 | // END SquaredCapacityTrait |
|
453 | } |
|
454 | ||
455 | /** |
|
456 | * Hashable is an interface which allows objects to be used as keys. |
|
@@ 2534-2917 (lines=384) @@ | ||
2531 | * |
|
2532 | * @package Ds |
|
2533 | */ |
|
2534 | final class Vector implements IteratorAggregate, ArrayAccess, Sequence |
|
2535 | { |
|
2536 | const MIN_CAPACITY = 8; |
|
2537 | ||
2538 | // BEGIN GenericCollection Trait |
|
2539 | /** |
|
2540 | * Returns whether the collection is empty. |
|
2541 | * |
|
2542 | * This should be equivalent to a count of zero, but is not required. |
|
2543 | * Implementations should define what empty means in their own context. |
|
2544 | * |
|
2545 | * @return bool whether the collection is empty. |
|
2546 | */ |
|
2547 | public function isEmpty(): bool |
|
2548 | { |
|
2549 | } |
|
2550 | ||
2551 | /** |
|
2552 | * Returns a representation that can be natively converted to JSON, which is |
|
2553 | * called when invoking json_encode. |
|
2554 | * |
|
2555 | * @return mixed the data to be JSON encoded. |
|
2556 | * |
|
2557 | * @see JsonSerializable |
|
2558 | */ |
|
2559 | public function jsonSerialize() |
|
2560 | { |
|
2561 | } |
|
2562 | ||
2563 | /** |
|
2564 | * Creates a shallow copy of the collection. |
|
2565 | * |
|
2566 | * @return Collection a shallow copy of the collection. |
|
2567 | */ |
|
2568 | public function copy(): Collection |
|
2569 | { |
|
2570 | } |
|
2571 | ||
2572 | /** |
|
2573 | * Invoked when calling var_dump. |
|
2574 | * |
|
2575 | * @return array |
|
2576 | */ |
|
2577 | public function __debugInfo(): array |
|
2578 | { |
|
2579 | } |
|
2580 | ||
2581 | /** |
|
2582 | * Returns a string representation of the collection, which is invoked when |
|
2583 | * the collection is converted to a string. |
|
2584 | * |
|
2585 | * @return string |
|
2586 | */ |
|
2587 | public function __toString(): string |
|
2588 | { |
|
2589 | } |
|
2590 | // END GenericCollection Trait |
|
2591 | ||
2592 | // BEGIN GenericSequence Trait |
|
2593 | /** |
|
2594 | * @inheritDoc |
|
2595 | */ |
|
2596 | public function __construct($values = null) |
|
2597 | { |
|
2598 | } |
|
2599 | ||
2600 | /** |
|
2601 | * Returns an array representation of the collection. |
|
2602 | * |
|
2603 | * The format of the returned array is implementation-dependent. Some |
|
2604 | * implementations may throw an exception if an array representation |
|
2605 | * could not be created (for example when object are used as keys). |
|
2606 | * |
|
2607 | * @return array |
|
2608 | */ |
|
2609 | public function toArray(): array |
|
2610 | { |
|
2611 | } |
|
2612 | ||
2613 | /** |
|
2614 | * @inheritdoc |
|
2615 | */ |
|
2616 | public function apply(callable $callback) |
|
2617 | { |
|
2618 | } |
|
2619 | ||
2620 | /** |
|
2621 | * @inheritdoc |
|
2622 | */ |
|
2623 | public function merge($values): Sequence |
|
2624 | { |
|
2625 | } |
|
2626 | ||
2627 | /** |
|
2628 | * @inheritdoc |
|
2629 | */ |
|
2630 | public function count(): int |
|
2631 | { |
|
2632 | } |
|
2633 | ||
2634 | /** |
|
2635 | * @inheritDoc |
|
2636 | */ |
|
2637 | public function contains(...$values): bool |
|
2638 | { |
|
2639 | } |
|
2640 | ||
2641 | /** |
|
2642 | * @inheritDoc |
|
2643 | */ |
|
2644 | public function filter(callable $callback = null): Sequence |
|
2645 | { |
|
2646 | } |
|
2647 | ||
2648 | /** |
|
2649 | * @inheritDoc |
|
2650 | */ |
|
2651 | public function find($value) |
|
2652 | { |
|
2653 | } |
|
2654 | ||
2655 | /** |
|
2656 | * @inheritDoc |
|
2657 | */ |
|
2658 | public function first() |
|
2659 | { |
|
2660 | } |
|
2661 | ||
2662 | /** |
|
2663 | * @inheritDoc |
|
2664 | */ |
|
2665 | public function get(int $index) |
|
2666 | { |
|
2667 | } |
|
2668 | ||
2669 | /** |
|
2670 | * @inheritDoc |
|
2671 | */ |
|
2672 | public function insert(int $index, ...$values) |
|
2673 | { |
|
2674 | } |
|
2675 | ||
2676 | /** |
|
2677 | * @inheritDoc |
|
2678 | */ |
|
2679 | public function join(string $glue = null): string |
|
2680 | { |
|
2681 | } |
|
2682 | ||
2683 | /** |
|
2684 | * @inheritDoc |
|
2685 | */ |
|
2686 | public function last() |
|
2687 | { |
|
2688 | } |
|
2689 | ||
2690 | /** |
|
2691 | * @inheritDoc |
|
2692 | */ |
|
2693 | public function map(callable $callback): Sequence |
|
2694 | { |
|
2695 | } |
|
2696 | ||
2697 | /** |
|
2698 | * @inheritDoc |
|
2699 | */ |
|
2700 | public function pop() |
|
2701 | { |
|
2702 | } |
|
2703 | ||
2704 | /** |
|
2705 | * @inheritDoc |
|
2706 | */ |
|
2707 | public function push(...$values) |
|
2708 | { |
|
2709 | } |
|
2710 | ||
2711 | /** |
|
2712 | * @inheritDoc |
|
2713 | */ |
|
2714 | public function reduce(callable $callback, $initial = null) |
|
2715 | { |
|
2716 | } |
|
2717 | ||
2718 | /** |
|
2719 | * @inheritDoc |
|
2720 | */ |
|
2721 | public function remove(int $index) |
|
2722 | { |
|
2723 | } |
|
2724 | ||
2725 | /** |
|
2726 | * @inheritDoc |
|
2727 | */ |
|
2728 | public function reverse() |
|
2729 | { |
|
2730 | } |
|
2731 | ||
2732 | /** |
|
2733 | * @inheritDoc |
|
2734 | */ |
|
2735 | public function reversed(): Sequence |
|
2736 | { |
|
2737 | } |
|
2738 | ||
2739 | /** |
|
2740 | * @inheritDoc |
|
2741 | */ |
|
2742 | public function rotate(int $rotations) |
|
2743 | { |
|
2744 | } |
|
2745 | ||
2746 | /** |
|
2747 | * @inheritDoc |
|
2748 | */ |
|
2749 | public function set(int $index, $value) |
|
2750 | { |
|
2751 | } |
|
2752 | ||
2753 | /** |
|
2754 | * @inheritDoc |
|
2755 | */ |
|
2756 | public function shift() |
|
2757 | { |
|
2758 | } |
|
2759 | ||
2760 | /** |
|
2761 | * @inheritDoc |
|
2762 | */ |
|
2763 | public function slice(int $offset, int $length = null): Sequence |
|
2764 | { |
|
2765 | } |
|
2766 | ||
2767 | /** |
|
2768 | * @inheritDoc |
|
2769 | */ |
|
2770 | public function sort(callable $comparator = null) |
|
2771 | { |
|
2772 | } |
|
2773 | ||
2774 | /** |
|
2775 | * @inheritDoc |
|
2776 | */ |
|
2777 | public function sorted(callable $comparator = null): Sequence |
|
2778 | { |
|
2779 | } |
|
2780 | ||
2781 | /** |
|
2782 | * @inheritDoc |
|
2783 | */ |
|
2784 | public function sum() |
|
2785 | { |
|
2786 | } |
|
2787 | ||
2788 | /** |
|
2789 | * @inheritDoc |
|
2790 | */ |
|
2791 | public function unshift(...$values) |
|
2792 | { |
|
2793 | } |
|
2794 | ||
2795 | /** |
|
2796 | * |
|
2797 | */ |
|
2798 | public function getIterator() |
|
2799 | { |
|
2800 | } |
|
2801 | ||
2802 | /** |
|
2803 | * @inheritdoc |
|
2804 | */ |
|
2805 | public function clear() |
|
2806 | { |
|
2807 | } |
|
2808 | ||
2809 | /** |
|
2810 | * @inheritdoc |
|
2811 | */ |
|
2812 | public function offsetSet($offset, $value) |
|
2813 | { |
|
2814 | } |
|
2815 | ||
2816 | /** |
|
2817 | * @inheritdoc |
|
2818 | */ |
|
2819 | public function &offsetGet($offset) |
|
2820 | { |
|
2821 | } |
|
2822 | ||
2823 | /** |
|
2824 | * @inheritdoc |
|
2825 | */ |
|
2826 | public function offsetUnset($offset) |
|
2827 | { |
|
2828 | } |
|
2829 | ||
2830 | /** |
|
2831 | * @inheritdoc |
|
2832 | */ |
|
2833 | public function offsetExists($offset) |
|
2834 | { |
|
2835 | } |
|
2836 | // END GenericSequence Trait |
|
2837 | ||
2838 | // BEGIN Capacity Trait |
|
2839 | /** |
|
2840 | * Returns the current capacity. |
|
2841 | * |
|
2842 | * @return int |
|
2843 | */ |
|
2844 | public function capacity(): int |
|
2845 | { |
|
2846 | } |
|
2847 | ||
2848 | /** |
|
2849 | * Ensures that enough memory is allocated for a specified capacity. This |
|
2850 | * potentially reduces the number of reallocations as the size increases. |
|
2851 | * |
|
2852 | * @param int $capacity The number of values for which capacity should be |
|
2853 | * allocated. Capacity will stay the same if this value |
|
2854 | * is less than or equal to the current capacity. |
|
2855 | */ |
|
2856 | public function allocate(int $capacity) |
|
2857 | { |
|
2858 | } |
|
2859 | ||
2860 | /** |
|
2861 | * @return float the structures growth factor. |
|
2862 | */ |
|
2863 | protected function getGrowthFactor(): float |
|
2864 | { |
|
2865 | } |
|
2866 | ||
2867 | /** |
|
2868 | * @return float to multiply by when decreasing capacity. |
|
2869 | */ |
|
2870 | protected function getDecayFactor(): float |
|
2871 | { |
|
2872 | } |
|
2873 | ||
2874 | /** |
|
2875 | * @return float the ratio between size and capacity when capacity should be |
|
2876 | * decreased. |
|
2877 | */ |
|
2878 | protected function getTruncateThreshold(): float |
|
2879 | { |
|
2880 | } |
|
2881 | ||
2882 | /** |
|
2883 | * Checks and adjusts capacity if required. |
|
2884 | */ |
|
2885 | protected function checkCapacity() |
|
2886 | { |
|
2887 | } |
|
2888 | ||
2889 | /** |
|
2890 | * Called when capacity should be increased to accommodate new values. |
|
2891 | */ |
|
2892 | protected function increaseCapacity() |
|
2893 | { |
|
2894 | } |
|
2895 | ||
2896 | /** |
|
2897 | * Called when capacity should be decrease if it drops below a threshold. |
|
2898 | */ |
|
2899 | protected function decreaseCapacity() |
|
2900 | { |
|
2901 | } |
|
2902 | ||
2903 | /** |
|
2904 | * @return bool whether capacity should be increased. |
|
2905 | */ |
|
2906 | protected function shouldDecreaseCapacity(): bool |
|
2907 | { |
|
2908 | } |
|
2909 | ||
2910 | /** |
|
2911 | * @return bool whether capacity should be increased. |
|
2912 | */ |
|
2913 | protected function shouldIncreaseCapacity(): bool |
|
2914 | { |
|
2915 | } |
|
2916 | // END Capacity Trait |
|
2917 | } |
|
2918 |