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 056785a931effae2cc61b681ed7696624559107e..f00e973cc00e688490a7deb657b9380634d38a56 100644 (file)
@@ -106,6 +106,13 @@ interface Block extends FrameworkInterface {
         * @return      void
         */
        function updateSeekPosition ();
         * @return      void
         */
        function updateSeekPosition ();
+
+       /**
+        * Getter for total entries
+        *
+        * @return      $totalEntries   Total entries in this file
+        */
+       function getCounter ();
 }
 
 // [EOF]
 }
 
 // [EOF]
index 7a642c7e786c1b172f1fdbe36fc75128b8a8b879..674fc6269d7d1c9f4319b7dd5de6bddb348b0d6d 100644 (file)
@@ -132,6 +132,13 @@ interface SeekableWritableFileIterator extends SeekableIterator {
         * @return      void
         */
        function updateSeekPosition ();
         * @return      void
         */
        function updateSeekPosition ();
+
+       /**
+        * Getter for total entries
+        *
+        * @return      $totalEntries   Total entries in this file
+        */
+       function getCounter ();
 }
 
 // [EOF]
 }
 
 // [EOF]
index 72e9dbac511399c5761be34de6af20640e6355d9..cfefe4988631cae4d828821c63ea42a6dd871cec 100644 (file)
@@ -174,7 +174,7 @@ y    * @return      void
         *
         * @return      $totalEntries   Total entries in this file
         */
         *
         * @return      $totalEntries   Total entries in this file
         */
-       protected final function getCounter () {
+       public final function getCounter () {
                // Get it
                return $this->totalEntries;
        }
                // Get it
                return $this->totalEntries;
        }
index 016aa3f5ec8680355b404d29920cefcfa2b61f3f..adbb71608c459bf3eac4f88657ae5b297a8d5083 100644 (file)
@@ -115,7 +115,7 @@ class BaseIndex extends BaseFrameworkSystem {
                        chr(BaseFile::SEPARATOR_HEADER_DATA),
 
                        // Total entries
                        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)
 
                        // 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);
        }
        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]
 }
 
 // [EOF]
index 35ceedd7b0e1505441977bdda03adfdecf90fe07..b40ef6b4d6a271f719f0c86d17f0b29736961d52 100644 (file)
@@ -258,6 +258,16 @@ class FileIterator extends BaseIterator implements SeekableWritableFileIterator
                // Call block instance
                $this->getBlockInstance()->updateSeekPosition();
        }
                // 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]
 }
 
 // [EOF]
index 6379821f7aed5da14cea8c8d95446437fda02c97..6b50a6e0d934b81b3c0d434972dcdfa5c00d3452 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
                        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),
 
                        // 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!
         */
        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);
        }
        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]
 }
 
 // [EOF]