This getter needs also to be public and be called through iterator.
authorRoland Haeder <roland@mxchange.org>
Sat, 31 May 2014 11:58:57 +0000 (13:58 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 31 May 2014 11:58:57 +0000 (13:58 +0200)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/classes/interfaces/block/class_Block.php
inc/classes/interfaces/iterator/class_SeekableWritableFileIterator.php
inc/classes/main/file_directories/class_BaseFile.php
inc/classes/main/index/class_BaseIndex.php
inc/classes/main/iterator/file/class_FileIterator.php
inc/classes/main/stacker/file/class_BaseFileStack.php

index 056785a..f00e973 100644 (file)
@@ -106,6 +106,13 @@ interface Block extends FrameworkInterface {
         * @return      void
         */
        function updateSeekPosition ();
+
+       /**
+        * Getter for total entries
+        *
+        * @return      $totalEntries   Total entries in this file
+        */
+       function getCounter ();
 }
 
 // [EOF]
index 7a642c7..674fc62 100644 (file)
@@ -132,6 +132,13 @@ interface SeekableWritableFileIterator extends SeekableIterator {
         * @return      void
         */
        function updateSeekPosition ();
+
+       /**
+        * Getter for total entries
+        *
+        * @return      $totalEntries   Total entries in this file
+        */
+       function getCounter ();
 }
 
 // [EOF]
index 72e9dba..cfefe49 100644 (file)
@@ -174,7 +174,7 @@ y    * @return      void
         *
         * @return      $totalEntries   Total entries in this file
         */
-       protected final function getCounter () {
+       public final function getCounter () {
                // Get it
                return $this->totalEntries;
        }
index 016aa3f..adbb716 100644 (file)
@@ -115,7 +115,7 @@ class BaseIndex extends BaseFrameworkSystem {
                        chr(BaseFile::SEPARATOR_HEADER_DATA),
 
                        // Total entries
-                       str_pad($this->dec2hex($this->getCounter()), BaseFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
+                       str_pad($this->dec2hex($this->getIteratorInstance()->getCounter()), BaseFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
 
                        // Separator header<->entries
                        chr(BaseFile::SEPARATOR_HEADER_ENTRIES)
@@ -285,6 +285,17 @@ class BaseIndex extends BaseFrameworkSystem {
        public function updateSeekPosition () {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
+
+       /**
+        * Getter for total entries
+        *
+        * @return      $totalEntries   Total entries in this file
+        * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
+        */
+       public final function getCounter () {
+               throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
+
 }
 
 // [EOF]
index 35ceedd..b40ef6b 100644 (file)
@@ -258,6 +258,16 @@ class FileIterator extends BaseIterator implements SeekableWritableFileIterator
                // Call block instance
                $this->getBlockInstance()->updateSeekPosition();
        }
+
+       /**
+        * Getter for total entries
+        *
+        * @return      $totalEntries   Total entries in this file
+        */
+       public final function getCounter () {
+               // Call block instance
+               return $this->getBlockInstance()->getCounter();
+       }
 }
 
 // [EOF]
index 6379821..6b50a6e 100644 (file)
@@ -120,7 +120,7 @@ class BaseFileStack extends BaseStacker {
                        chr(BaseFile::SEPARATOR_HEADER_DATA),
 
                        // Total entries (will be zero) and pad it to 20 chars
-                       str_pad($this->dec2hex($this->getCounter()), BaseFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
+                       str_pad($this->dec2hex($this->getIteratorInstance()->getCounter()), BaseFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
 
                        // Separator count<->seek position
                        chr(BaseFile::SEPARATOR_HEADER_DATA),
@@ -400,7 +400,7 @@ class BaseFileStack extends BaseStacker {
         */
        public function getStackCount ($stackerName) {
                // Now, simply return the found count value, this must be up-to-date then!
-               return $this->getCounter();
+               return $this->getIteratorInstance()->getCounter();
        }
 
        /**
@@ -480,6 +480,17 @@ class BaseFileStack extends BaseStacker {
        public function updateSeekPosition () {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
+
+       /**
+        * Getter for total entries
+        *
+        * @return      $totalEntries   Total entries in this file
+        * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
+        */
+       public final function getCounter () {
+               throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
+
 }
 
 // [EOF]