From: Roland Haeder Date: Sat, 24 May 2014 13:49:09 +0000 (+0200) Subject: Call these methods from the iterator. X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=303af8fa214f230e9cbf3458c916f42d334685df Call these methods from the iterator. Signed-off-by: Roland Häder --- diff --git a/inc/classes/main/file_directories/class_BaseFile.php b/inc/classes/main/file_directories/class_BaseFile.php index cf369371..d65bbd31 100644 --- a/inc/classes/main/file_directories/class_BaseFile.php +++ b/inc/classes/main/file_directories/class_BaseFile.php @@ -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(); } diff --git a/inc/classes/main/file_directories/index/class_IndexFile.php b/inc/classes/main/file_directories/index/class_IndexFile.php index 592c4fe1..c3190a1d 100644 --- a/inc/classes/main/file_directories/index/class_IndexFile.php +++ b/inc/classes/main/file_directories/index/class_IndexFile.php @@ -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(); diff --git a/inc/classes/main/file_directories/stack/class_StackFile.php b/inc/classes/main/file_directories/stack/class_StackFile.php index df0bec75..863362c3 100644 --- a/inc/classes/main/file_directories/stack/class_StackFile.php +++ b/inc/classes/main/file_directories/stack/class_StackFile.php @@ -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(); diff --git a/inc/classes/main/iterator/file/class_FileIterator.php b/inc/classes/main/iterator/file/class_FileIterator.php index 8d8e77fc..712754a7 100644 --- a/inc/classes/main/iterator/file/class_FileIterator.php +++ b/inc/classes/main/iterator/file/class_FileIterator.php @@ -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 diff --git a/inc/classes/main/stacker/file/class_BaseFileStack.php b/inc/classes/main/stacker/file/class_BaseFileStack.php index 2b2f53be..5d055bb7 100644 --- a/inc/classes/main/stacker/file/class_BaseFileStack.php +++ b/inc/classes/main/stacker/file/class_BaseFileStack.php @@ -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