Added basic classes (and unimplemented) for file-based indexes.
[core.git] / inc / classes / main / stacker / file / class_BaseFileStack.php
1 <?php
2 /**
3  * A general file-based stack class
4  *
5  * @author              Roland Haeder <webmaster@ship-simu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2013 Core Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.ship-simu.org
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23  */
24 class BaseFileStack extends BaseStacker {
25         /**
26          * Magic for this stack
27          */
28         const STACK_MAGIC = 'STACKv0.1';
29
30         /**
31          * Separator for header data
32          */
33         const SEPARATOR_HEADER_DATA = 0x01;
34
35         /**
36          * Separator header->entries
37          */
38         const SEPARATOR_HEADER_ENTRIES = 0x02;
39
40         /**
41          * Separator hash->name
42          */
43         const SEPARATOR_HASH_NAME = 0x03;
44
45         /**
46          * Length of name
47          */
48         const LENGTH_NAME = 10;
49
50         /**
51          * Length of count
52          */
53         const LENGTH_COUNT = 20;
54
55         /**
56          * Length of position
57          */
58         const LENGTH_POSITION = 20;
59
60         /**
61          * Counter for total entries
62          */
63         private $totalEntries = 0;
64
65         /**
66          * Current seek position
67          */
68         private $seekPosition = 0;
69
70         /**
71          * Size of header
72          */
73         private $headerSize = 0;
74
75         /**
76          * File header
77          */
78         private $header = array();
79
80         /**
81          * Seek positions for gaps ("fragmentation")
82          */
83         private $gaps = array();
84
85         /**
86          * Seek positions for damaged entries (e.g. mismatching hash sum, ...)
87          */
88         private $damagedEntries = array();
89
90         /**
91          * Protected constructor
92          *
93          * @param       $className      Name of the class
94          * @return      void
95          */
96         protected function __construct ($className) {
97                 // Call parent constructor
98                 parent::__construct($className);
99
100                 // Calculate header size
101                 $this->headerSize = (
102                         strlen(self::STACK_MAGIC) +
103                         strlen(self::SEPARATOR_HEADER_DATA) +
104                         self::LENGTH_COUNT +
105                         strlen(self::SEPARATOR_HEADER_DATA) +
106                         self::LENGTH_POSITION +
107                         strlen(self::SEPARATOR_HEADER_ENTRIES)
108                 );
109
110                 // Init counters and gaps array
111                 $this->initCountersGapsArray();
112         }
113
114         /**
115          * Initializes counter for valid entries, arrays for damaged entries and
116          * an array for gap seek positions. If you call this method on your own,
117          * please re-analyze the file structure. So you are better to call
118          * analyzeStackFile() instead of this method.
119          *
120          * @return      void
121          */
122         private function initCountersGapsArray () {
123                 // Init counter and seek position
124                 $this->setCounter(0);
125                 $this->setSeekPosition(0);
126
127                 // Init arrays
128                 $this->gaps = array();
129                 $this->damagedEntries = array();
130         }
131
132         /**
133          * Getter for total entries
134          *
135          * @return      $totalEntries   Total entries in this stack
136          */
137         private final function getCounter () {
138                 // Get it
139                 return $this->totalEntries;
140         }
141
142         /**
143          * Increment counter
144          *
145          * @return      void
146          */
147         private final function incrementCounter () {
148                 // Get it
149                 $this->totalEntries++;
150         }
151
152         /**
153          * Getter for seek position
154          *
155          * @return      $seekPosition   Current seek position (stored here in object)
156          */
157         private final function getSeekPosition () {
158                 // Get it
159                 return $this->seekPosition;
160         }
161
162         /**
163          * Setter for seek position
164          *
165          * @param       $seekPosition   Current seek position (stored here in object)
166          * @return      void
167          */
168         private final function setSeekPosition ($seekPosition) {
169                 // And set it
170                 $this->seekPosition = $seekPosition;
171         }
172
173         /**
174          * Updates seekPosition attribute from file to avoid to much access on file.
175          *
176          * @return      void
177          */
178         private function updateSeekPosition () {
179                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
180
181                 // Get key (= seek position)
182                 $seekPosition = $this->getIteratorInstance()->key();
183                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Setting seekPosition=%s', __METHOD__, __LINE__, $seekPosition));
184
185                 // And set it here
186                 $this->setSeekPosition($seekPosition);
187
188                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
189         }
190
191         /**
192          * Reads the file header
193          *
194          * @return      void
195          */
196         private function readFileHeader () {
197                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
198
199                 // First rewind to beginning as the header sits at the beginning ...
200                 $this->getIteratorInstance()->rewind();
201
202                 // Then read it (see constructor for calculation)
203                 $data = $this->getIteratorInstance()->read($this->headerSize);
204                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Read %d bytes (%d wanted).', __METHOD__, __LINE__, strlen($data), $this->headerSize));
205
206                 // Have all requested bytes been read?
207                 assert(strlen($data) == $this->headerSize);
208                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
209
210                 // Last character must be the separator
211                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] data(-1)=%s', __METHOD__, __LINE__, dechex(ord(substr($data, -1, 1)))));
212                 assert(substr($data, -1, 1) == chr(self::SEPARATOR_HEADER_ENTRIES));
213                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
214
215                 // Okay, then remove it
216                 $data = substr($data, 0, -1);
217
218                 // And update seek position
219                 $this->updateSeekPosition();
220
221                 /*
222                  * Now split it:
223                  *
224                  * 0 => Magic
225                  * 1 => Total entries
226                  * 2 => Current seek position
227                  */
228                 $this->header = explode(chr(self::SEPARATOR_HEADER_DATA), $data);
229
230                 // Check if the array has only 3 elements
231                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($this->header), print_r($this->header, TRUE)));
232                 assert(count($this->header) == 3);
233                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
234
235                 // Check magic
236                 assert($this->header[0] == self::STACK_MAGIC);
237                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
238
239                 // Check length of count and seek position
240                 assert(strlen($this->header[1]) == self::LENGTH_COUNT);
241                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
242                 assert(strlen($this->header[2]) == self::LENGTH_POSITION);
243                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
244
245                 // Decode count and seek position
246                 $this->header[1] = hex2bin($this->header[1]);
247                 $this->header[2] = hex2bin($this->header[2]);
248
249                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
250         }
251
252         /**
253          * Checks whether the file header is initialized
254          *
255          * @return      $isInitialized  Whether the file header is initialized
256          */
257         private function isFileHeaderInitialized () {
258                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
259                 // Default is not initialized
260                 $isInitialized = FALSE;
261
262                 // Is the file initialized?
263                 if ($this->isFileInitialized()) {
264                         // Some bytes has been written, so rewind to start of it.
265                         $rewindStatus = $this->getIteratorInstance()->rewind();
266                         //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] rewindStatus=%s', __METHOD__, __LINE__, $rewindStatus));
267
268                         // Is the rewind() call successfull?
269                         if ($rewindStatus != 1) {
270                                 // Something bad happened
271                                 self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Could not rewind().', __METHOD__, __LINE__));
272                         } // END - if
273
274                         // Read file header
275                         $this->readFileHeader();
276
277                         // The above method does already check the header
278                         $isInitialized = TRUE;
279                 } // END - if
280
281                 // Return result
282                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] isInitialized=%d - EXIT!', __METHOD__, __LINE__, intval($isInitialized)));
283                 return $isInitialized;
284         }
285
286         /**
287          * Checks whether the file-based stack has been initialized
288          *
289          * @return      $isInitialized          Whether the file's size is zero
290          */
291         private function isFileInitialized () {
292                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
293
294                 // Get it from iterator which holds the pointer instance. If FALSE is returned
295                 $fileSize = $this->getIteratorInstance()->size();
296                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] fileSize=%s', __METHOD__, __LINE__, $fileSize));
297
298                 /*
299                  * The returned file size should not be FALSE or NULL as this means
300                  * that the pointer class does not work correctly.
301                  */
302                 assert(is_int($fileSize));
303
304                 // Is more than 0 returned?
305                 $isInitialized = ($fileSize > 0);
306
307                 // Return result
308                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] isInitialized=%d - EXIT!', __METHOD__, __LINE__, intval($isInitialized)));
309                 return $isInitialized;
310         }
311
312         /**
313          * Creates the file-stack's header
314          *
315          * @return      void
316          */
317         private function createFileHeader () {
318                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
319                 // The file's header should not be initialized here
320                 assert(!$this->isFileHeaderInitialized());
321
322                 // Simple flush file header which will create it.
323                 $this->flushFileHeader();
324
325                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!!', __METHOD__, __LINE__));
326         }
327
328         /**
329          * Flushes the file header
330          *
331          * @return      void
332          */
333         private function flushFileHeader () {
334                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
335
336                 // Put all informations together
337                 $header = sprintf('%s%s%s%s%s%s',
338                         // Magic
339                         self::STACK_MAGIC,
340
341                         // Separator magic<->count
342                         chr(self::SEPARATOR_HEADER_DATA),
343
344                         // Total entries (will be zero) and pad it to 20 chars
345                         str_pad($this->dec2hex($this->getCounter()), self::LENGTH_COUNT, '0', STR_PAD_LEFT),
346
347                         // Separator count<->seek position
348                         chr(self::SEPARATOR_HEADER_DATA),
349
350                         // Position (will be zero)
351                         str_pad($this->dec2hex($this->getSeekPosition(), 2), self::LENGTH_POSITION, '0', STR_PAD_LEFT),
352
353                         // Separator position<->entries
354                         chr(self::SEPARATOR_HEADER_ENTRIES)
355                 );
356
357                 // Write it to disk (header is always at seek position 0)
358                 $this->writeData(0, $header);
359
360                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
361         }
362
363         /**
364          * Writes data at given position
365          *
366          * @param       $seekPosition   Seek position
367          * @param       $data                   Data to be written
368          * @return      void
369          */
370         private function writeData ($seekPosition, $data) {
371                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s,data()=%s - CALLED!', __METHOD__, __LINE__, $seekPosition, strlen($data)));
372
373                 // Write data at given position
374                 $this->getIteratorInstance()->writeAtPosition($seekPosition, $data);
375
376                 // Update seek position
377                 $this->updateSeekPosition();
378
379                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
380         }
381
382         /**
383          * Pre-allocates file (if enabled) with some space for later faster write access.
384          *
385          * @return      void
386          */
387         private function preAllocateFile () {
388                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
389
390                 // Is it enabled?
391                 if ($this->getConfigInstance()->getConfigEntry('file_stack_pre_allocate_enabled') != 'Y') {
392                         // Not enabled
393                         self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Not pre-allocating stack file.', __METHOD__, __LINE__));
394
395                         // Don't continue here.
396                         return;
397                 } // END - if
398
399                 // Message to user
400                 self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Pre-allocating stack file ...', __METHOD__, __LINE__));
401
402                 /*
403                  * Calculate minimum length for one entry:
404                  * minimum length = hash length + separator + name + minimum entry size = ?? + 1 + 10 + 1 = ??
405                  */
406                 $minLengthEntry = self::getHashLength() + strlen(self::SEPARATOR_HASH_NAME) + self::LENGTH_NAME + 1;
407                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] minLengthEntry=%s', __METHOD__, __LINE__, $minLengthEntry));
408
409                 // Calulcate seek position
410                 $seekPosition = $minLengthEntry * $this->getConfigInstance()->getConfigEntry('file_stack_pre_allocate_count');
411                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s', __METHOD__, __LINE__, $seekPosition));
412
413                 // Now simply write a NUL there. This will pre-allocate the file.
414                 $this->writeData($seekPosition, chr(0));
415
416                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
417         }
418
419         /**
420          * Analyzes entries in stack file. This will count all found (and valid)
421          * entries, mark invalid as damaged and count gaps ("fragmentation"). If
422          * only gaps are found, the file is considered as "virgin" (no entries).
423          *
424          * @return      void
425          */
426         private function analyzeStackFile () {
427                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__));
428
429                 // Make sure the file is initialized
430                 assert($this->isFileInitialized());
431
432                 // Init counters and gaps array
433                 $this->initCountersGapsArray();
434
435                 // Output message (as this may take some time)
436                 self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Analyzing file structure ... (this may take some time)', __METHOD__, __LINE__));
437
438                 //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
439         }
440
441         /**
442          * Initializes this file-based stack.
443          *
444          * @param       $fileName       File name of this stack
445          * @return      void
446          */
447         protected function initFileStack ($fileName) {
448                 // Get a file i/o pointer instance for stack file
449                 $pointerInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_output_class', array($fileName));
450
451                 // Get iterator instance
452                 $iteratorInstance = ObjectFactory::createObjectByConfiguredName('file_io_iterator_class', array($pointerInstance));
453
454                 // Is the instance implementing the right interface?
455                 assert($iteratorInstance instanceof SeekableWritableFileIterator);
456
457                 // Set iterator here
458                 $this->setIteratorInstance($iteratorInstance);
459
460                 // Is the file's header initialized?
461                 if (!$this->isFileHeaderInitialized()) {
462                         // No, then create it (which may pre-allocate the stack)
463                         $this->createFileHeader();
464
465                         // And pre-allocate a bit
466                         $this->preAllocateFile();
467                 } // END - if
468
469                 // Load the file header
470                 $this->readFileHeader();
471
472                 // Count all entries in file
473                 $this->analyzeStackFile();
474
475                 /*
476                  * Get stack index instance. This can be used for faster
477                  * "defragmentation" and startup.
478                  */
479                 $indexInstance = FileStackIndexFactory::createFileStackIndex($fileName);
480
481                 // And set it here
482                 $this->setIndexInstance($indexInstance);
483         }
484
485         /**
486          * Adds a value to given stack
487          *
488          * @param       $stackerName    Name of the stack
489          * @param       $value                  Value to add to this stacker
490          * @return      void
491          * @throws      FullStackerException    If the stack is full
492          */
493         protected function addValue ($stackerName, $value) {
494                 // Do some tests
495                 if ($this->isStackFull($stackerName)) {
496                         // Stacker is full
497                         throw new FullStackerException(array($this, $stackerName, $value), self::EXCEPTION_STACKER_IS_FULL);
498                 } // END - if
499
500                 // Now add the value to the stack
501                 $this->partialStub('stackerName=' . $stackerName . ',value[]=' . gettype($value));
502         }
503
504         /**
505          * Get last value from named stacker
506          *
507          * @param       $stackerName    Name of the stack
508          * @return      $value                  Value of last added value
509          * @throws      EmptyStackerException   If the stack is empty
510          */
511         protected function getLastValue ($stackerName) {
512                 // Is the stack not yet initialized or full?
513                 if ($this->isStackEmpty($stackerName)) {
514                         // Throw an exception
515                         throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
516                 } // END - if
517
518                 // Now get the last value
519                 $this->partialStub('stackerName=' . $stackerName);
520                 $value = NULL;
521
522                 // Return it
523                 return $value;
524         }
525
526         /**
527          * Get first value from named stacker
528          *
529          * @param       $stackerName    Name of the stack
530          * @return      $value                  Value of last added value
531          * @throws      EmptyStackerException   If the stack is empty
532          */
533         protected function getFirstValue ($stackerName) {
534                 // Is the stack not yet initialized or full?
535                 if ($this->isStackEmpty($stackerName)) {
536                         // Throw an exception
537                         throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
538                 } // END - if
539
540                 // Now get the first value
541                 $this->partialStub('stackerName=' . $stackerName);
542                 $value = NULL;
543
544                 // Return it
545                 return $value;
546         }
547
548         /**
549          * "Pops" last entry from stack
550          *
551          * @param       $stackerName    Name of the stack
552          * @return      $value                  Value "poped" from array
553          * @throws      EmptyStackerException   If the stack is empty
554          */
555         protected function popLast ($stackerName) {
556                 // Is the stack not yet initialized or full?
557                 if ($this->isStackEmpty($stackerName)) {
558                         // Throw an exception
559                         throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
560                 } // END - if
561
562                 // Now, remove the last entry, we don't care about the return value here, see elseif() block above
563                 $this->partialStub('stackerName=' . $stackerName);
564                 return NULL;
565         }
566
567         /**
568          * "Pops" first entry from stack
569          *
570          * @param       $stackerName    Name of the stack
571          * @return      $value                  Value "shifted" from array
572          * @throws      EmptyStackerException   If the named stacker is empty
573          */
574         protected function popFirst ($stackerName) {
575                 // Is the stack not yet initialized or full?
576                 if ($this->isStackEmpty($stackerName)) {
577                         // Throw an exception
578                         throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY);
579                 } // END - if
580
581                 // Now, remove the last entry, we don't care about the return value here, see elseif() block above
582                 $this->partialStub('stackerName=' . $stackerName);
583                 return NULL;
584         }
585
586         /**
587          * Checks whether the given stack is full
588          *
589          * @param       $stackerName    Name of the stack
590          * @return      $isFull                 Whether the stack is full
591          */
592         protected function isStackFull ($stackerName) {
593                 // File-based stacks will only run full if the disk space is low.
594                 // @TODO Please implement this, returning FALSE
595                 $isFull = FALSE;
596
597                 // Return result
598                 return $isFull;
599         }
600
601         /**
602          * Checks whether the given stack is empty
603          *
604          * @param       $stackerName            Name of the stack
605          * @return      $isEmpty                        Whether the stack is empty
606          * @throws      NoStackerException      If given stack is missing
607          */
608         public function isStackEmpty ($stackerName) {
609                 // So, is the stack empty?
610                 $isEmpty = (($this->getStackCount($stackerName)) == 0);
611
612                 // Return result
613                 return $isEmpty;
614         }
615
616         /**
617          * Initializes given stacker
618          *
619          * @param       $stackerName    Name of the stack
620          * @param       $forceReInit    Force re-initialization
621          * @return      void
622          * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
623          */
624         public function initStack ($stackerName, $forceReInit = FALSE) {
625                 throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
626         }
627
628         /**
629          * Initializes all stacks
630          *
631          * @return      void
632          * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
633          */
634         public function initStacks (array $stacks, $forceReInit = FALSE) {
635                 throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
636         }
637
638         /**
639          * Checks whether the given stack is initialized (set in array $stackers)
640          *
641          * @param       $stackerName    Name of the stack
642          * @return      $isInitialized  Whether the stack is initialized
643          * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
644          */
645         public function isStackInitialized ($stackerName) {
646                 throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
647         }
648
649         /**
650          * Getter for size of given stack (array count)
651          *
652          * @param       $stackerName    Name of the stack
653          * @return      $count                  Size of stack (array count)
654          */
655         public function getStackCount ($stackerName) {
656                 // Now, simply return the found count value, this must be up-to-date then!
657                 return $this->getCounter();
658         }
659 }
660
661 // [EOF]
662 ?>