} // 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();
*/
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();
* @return void
*/
public function readFileHeader () {
+ // Make sure the block instance is set
+ assert($this->getBlockInstance() instanceof Block);
+
// Call block instance
$this->getBlockInstance()->readFileHeader();
}
* @return void
*/
public function flushFileHeader () {
+ // Make sure the block instance is set
+ assert($this->getBlockInstance() instanceof Block);
+
// Call block instance
$this->getBlockInstance()->flushFileHeader();
}
* 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();
* 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();
$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
$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