]> git.mxchange.org Git - core.git/commitdiff
Call these methods from the iterator.
authorRoland Haeder <roland@mxchange.org>
Sat, 24 May 2014 13:49:09 +0000 (15:49 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 24 May 2014 13:49:09 +0000 (15:49 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/main/file_directories/class_BaseFile.php
inc/classes/main/file_directories/index/class_IndexFile.php
inc/classes/main/file_directories/stack/class_StackFile.php
inc/classes/main/iterator/file/class_FileIterator.php
inc/classes/main/stacker/file/class_BaseFileStack.php

index cf36937123ce3b360326337c24dbfa830ba3cd13..d65bbd31f389b7007f22a5c77cf97bc26b55cecf 100644 (file)
@@ -470,7 +470,7 @@ y    * @return      void
                } // END - if
 
                // Make sure the block instance is set
-               assert($this->getBlockInstance() instanceof CalculatableBlock);
+               assert($this->getBlockInstance() instanceof Block);
 
                // First calculate minimum block length
                $length = $this->getBlockInstance()->calculateMinimumBlockLength();
@@ -523,7 +523,7 @@ y    * @return      void
         */
        public function valid () {
                // Make sure the block instance is set
-               assert($this->getBlockInstance() instanceof CalculatableBlock);
+               assert($this->getBlockInstance() instanceof Block);
 
                // First calculate minimum block length
                $length = $this->getBlockInstance()->calculateMinimumBlockLength();
@@ -572,6 +572,9 @@ y    * @return      void
         * @return      void
         */
        public function readFileHeader () {
+               // Make sure the block instance is set
+               assert($this->getBlockInstance() instanceof Block);
+
                // Call block instance
                $this->getBlockInstance()->readFileHeader();
        }
@@ -582,6 +585,9 @@ y    * @return      void
         * @return      void
         */
        public function flushFileHeader () {
+               // Make sure the block instance is set
+               assert($this->getBlockInstance() instanceof Block);
+
                // Call block instance
                $this->getBlockInstance()->flushFileHeader();
        }
index 592c4fe10866809acdcfb0ceb364216f663396ec..c3190a1df38eb0e6c4e52b7171d5e8818fb69b0a 100644 (file)
@@ -36,10 +36,10 @@ class IndexFile extends BaseFile implements Block {
         * Creates an instance of this File class and prepares it for usage
         *
         * @param       $fileName               Name of the index file
-        * @param       $blockInstance  An instance of a CalculatableBlock class
+        * @param       $blockInstance  An instance of a Block class
         * @return      $fileInstance   An instance of this File class
         */
-       public final static function createIndexFile ($fileName, CalculatableBlock $blockInstance) {
+       public final static function createIndexFile ($fileName, Block $blockInstance) {
                // Get a new instance
                $fileInstance = new IndexFile();
 
index df0bec75334b56eaf0c93b4996dcf74ce8d7fcd3..863362c3e10f056d0dad4662a51a944ddda04432 100644 (file)
@@ -36,10 +36,10 @@ class StackFile extends BaseFile implements Block {
         * Creates an instance of this File class and prepares it for usage
         *
         * @param       $fileName               Name of the stack file
-        * @param       $blockInstance  An instance of a CalculatableBlock class
+        * @param       $blockInstance  An instance of a Block class
         * @return      $fileInstance   An instance of this File class
         */
-       public final static function createStackFile ($fileName, CalculatableBlock $blockInstance) {
+       public final static function createStackFile ($fileName, Block $blockInstance) {
                // Get a new instance
                $fileInstance = new StackFile();
 
index 8d8e77fcc2ff56c06226585b4d3e219fedef8bbb..712754a769054741e88627e9b98d4d7219786958 100644 (file)
@@ -43,6 +43,7 @@ class FileIterator extends BaseIterator implements SeekableWritableFileIterator
                $iteratorInstance = new FileIterator();
 
                // Set the instance here
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d] Setting blockInstance=%s ...', __METHOD__, __LINE__, $blockInstance->__toString()));
                $iteratorInstance->setBlockInstance($blockInstance);
 
                // Return the prepared instance
index 2b2f53be48af0bcc08a2b4f99c668b7c78b11257..5d055bb78f1a8ebec694d8d7b6a956d0cb064373 100644 (file)
@@ -173,12 +173,12 @@ class BaseFileStack extends BaseStacker {
                $this->setIteratorInstance($iteratorInstance);
 
                // Is the file's header initialized?
-               if (!$this->isFileHeaderInitialized()) {
+               if (!$this->getIteratorInstance()->isFileHeaderInitialized()) {
                        // No, then create it (which may pre-allocate the stack)
-                       $this->createFileHeader();
+                       $this->getIteratorInstance()->createFileHeader();
 
                        // And pre-allocate a bit
-                       $this->preAllocateFile('file_stack');
+                       $this->getIteratorInstance()->preAllocateFile('file_stack');
                } // END - if
 
                // Load the file header