<?php
// Own namespace
-namespace CoreFramework\Action\!!!;
+namespace Org\Mxchange\CoreFramework\Action\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Action\BaseAction;
<?php
// Own namespace
-namespace CoreFramework\Container\;
+namespace Org\Mxchange\CoreFramework\Container\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Container\BaseContainer;
<?php
// Own namespace
-namespace CoreFramework\Controller\!!!;
+namespace Org\Mxchange\CoreFramework\Controller\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Controller\BaseController;
<?php
// Own namespace
-namespace CoreFramework\Disovery\;
+namespace Org\Mxchange\CoreFramework\Disovery\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
/**
* Returns a singleton (registry-based) StackableFile instance
*
- * @param $infoInstance An instance of a SplFileInfo class
+ * @param $fileInfoInstance An instance of a SplFileInfo class
* @return $indexInstance An instance of a IndexableStack class
* @throws InvalidArgumentException If a parameter is invalid
*/
- public static final function createFileStackIndexInstance (SplFileInfo $infoInstance, string $type) {
+ public static final function createFileStackIndexInstance (SplFileInfo $fileInfoInstance, string $type) {
// If there is no handler?
if (empty($type)) {
// Throw IAE
$indexInstance = GenericRegistry::getRegistry()->getInstance($type . '_index');
} else {
// Get the handler instance
- $indexInstance = ObjectFactory::createObjectByConfiguredName($type . '_file_stack_index_class', array($infoInstance));
+ $indexInstance = ObjectFactory::createObjectByConfiguredName($type . '_file_stack_index_class', [$fileInfoInstance]);
// Add it to the registry
GenericRegistry::getRegistry()->addInstance($type . '_index', $indexInstance);
<?php
// Own namespace
-namespace CoreFramework\Feature\!!!;
+namespace Org\Mxchange\CoreFramework\Feature\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Feature\BaseFeature;
use Org\Mxchange\CoreFramework\Filesystem\Block;
use Org\Mxchange\CoreFramework\Filesystem\Block\CalculatableBlock;
use Org\Mxchange\CoreFramework\Filesystem\File\BaseAbstractFile;
+use Org\Mxchange\CoreFramework\Stack\File\StackableFile;
+use Org\Mxchange\CoreFramework\Index\Stack\IndexableStack;
+use Org\Mxchange\CoreFramework\Traits\Index\Stack\IndexableStackTrait;
+use Org\Mxchange\CoreFramework\Traits\Stack\StackableTrait;
// Import SPL stuff
use \BadMethodCallException;
use \InvalidArgumentException;
+use \LogicException;
use \SplFileInfo;
use \UnexpectedValueException;
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-abstract class BaseBinaryFile extends BaseAbstractFile {
+abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
+ // Load traits
+ use StackableTrait;
+ use IndexableStackTrait;
+
/**
* Separator for header data
*/
*/
private $currentBlock = '';
- /**
- * An instance of a Block class
- */
- private $blockInstance = NULL;
-
/**
* Protected constructor
*
$this->initCountersGapsArray();
}
- /**
- * Setter for Block instance
- *
- * @param $blockInstance An instance of an Block class
- * @return void
- */
- protected final function setBlockInstance (Block $blockInstance) {
- $this->blockInstance = $blockInstance;
- }
-
- /**
- * Getter for Block instance
- *
- * @return $blockInstance An instance of an Block class
- */
- public final function getBlockInstance () {
- return $this->blockInstance;
- }
-
/**
* Setter for backBuffer field
*
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-BINARY-FILE: Pre-allocating file ...');
// Calculate minimum length for one entry and get file size
- $minimumBlockLength = $this->getBlockInstance()->calculateMinimumBlockLength();
+ $minimumBlockLength = $this->getIndexableStackInstance()->calculateMinimumBlockLength();
$fileSize = $this->getFileSize();
// Calulcate seek position
// First calculate minimum block length
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: this->seekPosition=%d', $this->determineSeekPosition()));
- $length = $this->getBlockInstance()->calculateMinimumBlockLength();
+ $length = $this->getIndexableStackInstance()->calculateMinimumBlockLength();
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: length=%d', $length));
// Read possibly back-buffered bytes from previous call of next().
public function isValid () {
// First calculate minimum block length
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-BINARY-FILE: CALLED!');
- $length = $this->getBlockInstance()->calculateMinimumBlockLength();
+ $length = $this->getIndexableStackInstance()->calculateMinimumBlockLength();
// Short be more than zero!
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-BINARY-FILE: length=%d', $length));
* Reads the file header
*
* @return void
+ * @throws LogicException If both instances are not set
*/
public function readFileHeader () {
- // Call block instance
+ // Is index set or stack?
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-BINARY-FILE: CALLED!');
- $this->getBlockInstance()->readFileHeader();
+ if ($this->getIndexableStackInstance() instanceof IndexableStack) {
+ // Call index instance
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-BINARY-FILE: Calling this->indexableStackInstance->readFileHeader() ...');
+ $this->getIndexableStackInstance()->readFileHeader();
+ } elseif ($this->getStackInstance() instanceof StackableFile) {
+ // Call stacke instance
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-BINARY-FILE: Calling this->stackInstance->readFileHeader() ...');
+ $this->getStackInstance()->readFileHeader();
+ } else {
+ // Bad logic?
+ throw new LogicException('Wether indexableStackInstance nor stackableFileInstance are set');
+ }
// Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-BINARY-FILE: EXIT!');
public function flushFileHeader () {
// Call block instance
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-BINARY-FILE: CALLED!');
- $this->getBlockInstance()->flushFileHeader();
+ $this->getIndexableStackInstance()->flushFileHeader();
// Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-BINARY-FILE: EXIT!');
namespace Org\Mxchange\CoreFramework\Filesystem\Index;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Filesystem\Block;
use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile;
+use Org\Mxchange\CoreFramework\Filesystem\Index\IndexableFile;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
+use Org\Mxchange\CoreFramework\Index\Stack\IndexableStack;
// Import SPL stuff
use \SplFileInfo;
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class IndexFile extends BaseBinaryFile implements Block {
+class IndexFile extends BaseBinaryFile implements IndexableFile {
/**
* Protected constructor
*
* Creates an instance of this File class and prepares it for usage
*
* @param $fileInfoInstance An instance of a SplFileInfo class
- * @param $blockInstance An instance of a Block class
- * @return $fileInstance An instance of this File class
+ * @param $indexInstance An instance of a IndexableStack class
+ * @return $indexFileInstance An instance of an IndexableFile class
*/
- public final static function createIndexFile (SplFileInfo $fileInfoInstance, Block $blockInstance) {
+ public final static function createIndexFile (SplFileInfo $fileInfoInstance, IndexableStack $indexInstance) {
// Get a new instance
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('INDEX-FILE: fileInfoInstance[%s]=%s,blockInstance=%s - CALLED!', get_class($fileInfoInstance), $fileInfoInstance, $blockInstance->__toString()));
- $fileInstance = new IndexFile();
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('INDEX-FILE: fileInfoInstance[%s]=%s,indexInstance=%s - CALLED!', get_class($fileInfoInstance), $fileInfoInstance, $indexInstance->__toString()));
+ $indexFileInstance = new IndexFile();
- // Set block instance here for callbacks
- $fileInstance->setBlockInstance($blockInstance);
+ // Set file instance here for callbacks
+ $indexFileInstance->setIndexableStackInstance($indexInstance);
// Expand file name with .idx
$indexInfoInstance = new SplFileInfo(sprintf('%s.idx', $fileInfoInstance->__toString()));
// Init this abstract file
- $fileInstance->initFile($indexInfoInstance);
+ $indexFileInstance->initFile($indexInfoInstance);
// Return the prepared instance
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('INDEX-FILE: fileInstance=%s - EXIT!', $fileInstance->__toString()));
- return $fileInstance;
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('INDEX-FILE: indexFileInstance=%s - EXIT!', $indexFileInstance->__toString()));
+ return $indexFileInstance;
}
/**
namespace Org\Mxchange\CoreFramework\Stack\File;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Filesystem\Block;
+use Org\Mxchange\CoreFramework\Filesystem\Stack\FileStacker;
use Org\Mxchange\CoreFramework\Filesystem\File\BaseBinaryFile;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
+use Org\Mxchange\CoreFramework\Stack\File\StackableFile;
use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
// Import SPL stuff
+use \InvalidArgumentException;
use \SplFileInfo;
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class StackFile extends BaseBinaryFile implements Block {
+class StackFile extends BaseBinaryFile implements FileStacker {
/**
* Protected constructor
*
* Creates an instance of this File class and prepares it for usage
*
* @param $infoInstance An instance of a SplFileInfo class
- * @param $blockInstance An instance of a Block class
+ * @param $stackInstance An instance of a StackableFile class
* @return $fileInstance An instance of this File class
*/
- public final static function createStackFile (SplFileInfo $infoInstance, Block $blockInstance) {
+ public final static function createStackFile (SplFileInfo $infoInstance, StackableFile $stackInstance) {
// Get a new instance
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STACK-FILE: infoInstance[%s]=%s,stackInstance=%s - CALLED!', get_class($infoInstance), $infoInstance, $stackInstance->__toString()));
$fileInstance = new StackFile();
- // Set block instance here for callbacks
- $fileInstance->setBlockInstance($blockInstance);
+ // Set stack instance here for callbacks
+ $fileInstance->setStackInstance($stackInstance);
// Init this abstract file
$fileInstance->initFile($infoInstance);
// Return the prepared instance
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STACK-FILE: fileInstance=%s - EXIT!', $fileInstance->__toString()));
return $fileInstance;
}
* @param $groupId Group identifier
* @param $value Value to be added to the stack
* @return $data Hash and gap position
+ * @throws InvalidArgumentException If a parameter is not valid
*/
- public function writeValueToFile ($groupId, $value) {
- // Make sure no objects/resources are added as the serialization may fail
- assert(!is_object($value));
- assert(!is_resource($value));
+ public function writeValueToFile (string $groupId, $value) {
+ // Validate parameter
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STACK-FILE: groupId=%s,value[]=%s - CALLED!', $groupId, gettype($value)));
+ if (empty($groupId)) {
+ // Throw IAE
+ throw new InvalidArgumentException('Parameter "groupId" is empty');
+ } elseif (is_object($value) || is_resource($value)) {
+ // Not wanted here
+ throw new InvalidArgumentException(sprintf('value[]=%s is not stackable in files', gettype($value)));
+ }
// Encode/convert the value into a "binary format"
$encoded = StringUtils::encodeData($value);
$hash = self::hash($encoded);
// Then write it to the next free gap
- $data = $this->getBlockInstance()->writeDataToFreeGap($groupId, $hash, $encoded);
+ $data = $this->getStackInstance()->writeDataToFreeGap($groupId, $hash, $encoded);
// Return info
return $data;
<?php
// Own namespace
-namespace Org\Mxchange\CoreFramework\FileSystem;
+namespace Org\Mxchange\CoreFramework\Filesystem;
// Import framework stuff
use Org\Mxchange\CoreFramework\Filesystem\CloseableFile;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\FileSystem\BaseFileIo;
+use Org\Mxchange\CoreFramework\Filesystem\BaseFileIo;
use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
-use Org\Mxchange\CoreFramework\FileSystem\FileReadProtectedException;
+use Org\Mxchange\CoreFramework\Filesystem\FileReadProtectedException;
use Org\Mxchange\CoreFramework\Filesystem\Pointer\InputPointer;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\FileSystem\BaseFileIo;
+use Org\Mxchange\CoreFramework\Filesystem\BaseFileIo;
use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
-use Org\Mxchange\CoreFramework\FileSystem\FileReadProtectedException;
+use Org\Mxchange\CoreFramework\Filesystem\FileReadProtectedException;
use Org\Mxchange\CoreFramework\Filesystem\Pointer\InputPointer;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\FileSystem\BaseFileIo;
-use Org\Mxchange\CoreFramework\FileSystem\FileReadProtectedException;
-use Org\Mxchange\CoreFramework\FileSystem\FileWriteProtectedException;
+use Org\Mxchange\CoreFramework\Filesystem\BaseFileIo;
+use Org\Mxchange\CoreFramework\Filesystem\FileReadProtectedException;
+use Org\Mxchange\CoreFramework\Filesystem\FileWriteProtectedException;
use Org\Mxchange\CoreFramework\Filesystem\PathWriteProtectedException;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
namespace Org\Mxchange\CoreFramework\Filesystem\Pointer\Output;
// Import framework stuff
-use Org\Mxchange\CoreFramework\FileSystem\BaseFileIo;
+use Org\Mxchange\CoreFramework\Filesystem\BaseFileIo;
use Org\Mxchange\CoreFramework\Filesystem\Pointer\OutputPointer;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
namespace Org\Mxchange\CoreFramework\Filesystem\Pointer\Text;
// Import framework stuff
-use Org\Mxchange\CoreFramework\FileSystem\BaseFileIo;
+use Org\Mxchange\CoreFramework\Filesystem\BaseFileIo;
use Org\Mxchange\CoreFramework\Filesystem\Pointer\OutputPointer;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
<?php
// Own namespace
-namespace CoreFramework\Handler\;
+namespace Org\Mxchange\CoreFramework\Handler\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Handler\BaseHandler;
<?php
// Own namespace
-namespace CoreFramework\Captcha\;
+namespace Org\Mxchange\CoreFramework\Captcha\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
<?php
// Own namespace
-namespace CoreFramework\Helper\;
+namespace Org\Mxchange\CoreFramework\Helper\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
<?php
// Own namespace
-namespace CoreFramework\Index\!!!;
+namespace Org\Mxchange\CoreFramework\Index\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Index\BaseIndex;
use Org\Mxchange\CoreFramework\Index\Indexable;
+// Import SPL stuff
+use \SplFileInfo;
+
/**
* A ??? index class
*
* @param $fileName Name of the file stack to create an index file for
* @return $indexInstance An instance of this Index class
*/
- public final static function create???Index ($fileName) {
+ public final static function create???Index (SplFileInfo $fileInfoInstance) {
// Get a new instance
$indexInstance = new ???Index();
// Initialize index
- $indexInstance->initIndex($fileName);
+ $indexInstance->initIndex($fileInfoInstance);
// Return the prepared instance
return $indexInstance;
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-abstract class BaseIndex extends BaseFrameworkSystem {
+abstract class BaseIndex extends BaseFrameworkSystem implements Indexable {
// Load traits
use IteratorTrait;
$fileInstance = ObjectFactory::createObjectByConfiguredName('index_file_class', array($fileInfoInstance, $this));
// Get iterator instance
- $iteratorInstance = ObjectFactory::createObjectByConfiguredName('file_iterator_class', array($fileInstance));
+ $iteratorInstance = ObjectFactory::createObjectByConfiguredName('file_iterator_class', [$fileInstance]);
// Set iterator here
$this->setIteratorInstance($iteratorInstance);
// Freshly created?
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-INDEX: created=%d', intval($created)));
if (!$created) {
- // Count all entries in file
+ // Analyze file structure
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-INDEX: Calling this->iteratorInstance->analyzeFileStructure() ...');
$this->getIteratorInstance()->analyzeFileStructure();
}
use Org\Mxchange\CoreFramework\Index\Indexable;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Stack\File\StackableFile;
-use Org\Mxchange\CoreFramework\Stack\Index\IndexableStack;
+use Org\Mxchange\CoreFramework\Index\Stack\IndexableStack;
// Import SPL stuff
use \InvalidArgumentException;
}
/**
- * Adds given hash to an index file
+ * Adds given data's hash to an index file
*
* @param $groupId Name of stack to add hash for
* @param $data Hash and gap position to be added to the index
* @return void
+ * @throws InvalidArgumentException If a parameter is not valid
* @throws UnexpectedValueException If an invalid gap position is being returned
*/
- public function addHashToIndex (string $groupId, array $data) {
+ public function addHashedDataToIndex (string $groupId, array $data) {
+ // Validate parameter
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: groupId=%s,data()=%d - CALLED!', $groupId, count($data)));
+ if (empty($groupId)) {
+ // Throw IAE
+ throw new InvalidArgumentException('Parameter "groupId" is empty');
+ } elseif (count($data) == 0) {
+ // Throw it again
+ throw new InvalidArgumentException('Parameter "data" is an empty array');
+ } elseif (!isset($data[StackableFile::ARRAY_NAME_HASH])) {
+ // Important array element missing
+ throw new InvalidArgumentException(sprintf('data[%s] not found', $data[StackableFile::ARRAY_NAME_HASH]));
+ } elseif (!isset($data[StackableFile::ARRAY_NAME_GAP_POSITION])) {
+ // Important array element missing
+ throw new InvalidArgumentException(sprintf('data[%s] not found', $data[StackableFile::ARRAY_NAME_GAP_POSITION]));
+ } elseif (!isset($data[StackableFile::ARRAY_NAME_DATA_LENGTH])) {
+ // Important array element missing
+ throw new InvalidArgumentException(sprintf('data[%s] not found', $data[StackableFile::ARRAY_NAME_DATA_LENGTH]));
+ }
+
// Raw data been written to the file
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: groupId=%s,hash=%s,gap=%d,length=%d - CALLED!', $groupId, $data[StackableFile::ARRAY_NAME_HASH], $data[StackableFile::ARRAY_NAME_GAP_POSITION], $data[StackableFile::ARRAY_NAME_DATA_LENGTH]));
$rawData = sprintf('%s%s%s%s%s%s%s',
$groupId,
Indexable::SEPARATOR_GROUP_HASH,
// Throw IAE
throw new InvalidArgumentException(sprintf('length=%d is not valid', $length));
}
+
+ // Partial stub!
+ $this->partialStub('length=' . $length);
}
/**
return $status;
}
+ /**
+ * Checks if this index file has been fully and properly loaded.
+ *
+ * @return $isLoaded Whether this index file has been loaded
+ */
+ public function isIndexFileLoaded () {
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-STACK-INDEX: CALLED!');
+ /* DEBUG-DIE: */ die(sprintf('[%s:%d]: this=%s', __METHOD__, __LINE__, print_r($this, true)));
+ }
+
}
<?php
// Own namespace
-namespace CoreFramework\Iterator\!!!;
+namespace Org\Mxchange\CoreFramework\Iterator\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Iterator\BaseIterator;
namespace Org\Mxchange\CoreFramework\Iterator\File;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Filesystem\Block;
+use Org\Mxchange\CoreFramework\Filesystem\File\BinaryFile;
use Org\Mxchange\CoreFramework\Iterator\BaseIterator;
use Org\Mxchange\CoreFramework\Iterator\Filesystem\SeekableWritableFileIterator;
+use Org\Mxchange\CoreFramework\Traits\File\BinaryFileTrait;
// Import SPL stuff
use \BadMethodCallException;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class FileIterator extends BaseIterator implements SeekableWritableFileIterator {
- /**
- * An instance of a Block class
- */
- private $blockInstance = NULL;
+ // Load traits
+ use BinaryFileTrait;
/**
* Protected constructor
/**
* Creates an instance of this class
*
- * @param $blockInstance An instance of a Block class
+ * @param $binaryFileInstance An instance of a BinaryFile class
* @return $iteratorInstance An instance of a Iterator class
*/
- public final static function createFileIterator (Block $blockInstance) {
+ public final static function createFileIterator (BinaryFile $binaryFileInstance) {
// Get new instance
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: blockInstance=%s - CALLED!', $blockInstance->__toString()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: binaryFileInstance=%s - CALLED!', $binaryFileInstance->__toString()));
$iteratorInstance = new FileIterator();
// Set the instance here
- $iteratorInstance->setBlockInstance($blockInstance);
+ $iteratorInstance->setBinaryFileInstance($binaryFileInstance);
// Return the prepared instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: iteratorInstance=%s - EXIT!', $iteratorInstance->__toString()));
return $iteratorInstance;
}
- /**
- * Setter for Block instance
- *
- * @param $blockInstance An instance of an Block class
- * @return void
- */
- protected final function setBlockInstance (Block $blockInstance) {
- $this->blockInstance = $blockInstance;
- }
-
- /**
- * Getter for Block instance
- *
- * @return $blockInstance An instance of an Block class
- */
- public final function getBlockInstance () {
- return $this->blockInstance;
- }
-
/**
* Gets currently read data
*
throw new BadMethodCallException('Current key cannot be valid, forgot to invoke valid()?');
}
- // Call block instance
- $current = $this->getBlockInstance()->current();
+ // Call file instance
+ $current = $this->getBinaryFileInstance()->current();
// Return it
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: current[]=%s - EXIT!', gettype($current)));
throw new BadMethodCallException('Current key cannot be valid, forgot to invoke valid()?');
}
- // Get key from block instance
- $key = $this->getBlockInstance()->determineSeekPosition();
+ // Get key from file instance
+ $key = $this->getBinaryFileInstance()->determineSeekPosition();
// Return key
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: key[%s]=%s - EXIT!', gettype($key), $key));
}
/**
- * Advances to next "block" of bytes
+ * Advances to next "file" of bytes
*
* @return void
*/
public function next () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $this->getBlockInstance()->next();
+ $this->getBinaryFileInstance()->next();
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
* @return $status Status of this operation
*/
public function rewind () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $this->getBlockInstance()->rewind();
+ $this->getBinaryFileInstance()->rewind();
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
* @return $isValid Whether the next entry is valid
*/
public function valid () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $isValid = $this->getBlockInstance()->valid();
+ $isValid = $this->getBinaryFileInstance()->valid();
// Return flag
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: isValid=%d - EXIT!', intval($isValid)));
throw new InvalidArgumentException(sprintf('seekPosition=%d is not valid', $seekPosition));
}
- // Call block instance
- $status = $this->getBlockInstance()->seek($seekPosition, $whence);
+ // Call file instance
+ $status = $this->getBinaryFileInstance()->seek($seekPosition, $whence);
// Return status
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: status=%d - EXIT!', intval($status)));
* @return $size Size (in bytes) of file
*/
public function size () {
- // Call the block object
+ // Call the file object
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $size = $this->getBlockInstance()->size();
+ $size = $this->getBinaryFileInstance()->size();
// Return size
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: size=%d - EXIT!', $size));
throw new InvalidArgumentException(sprintf('bytes=%d is not valid', $bytes));
}
- // Call block instance
- $data = $this->getBlockInstance()->read($bytes);
+ // Call file instance
+ $data = $this->getBinaryFileInstance()->read($bytes);
// Return data
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: data[]=%s - EXIT!', gettype($data)));
* @return void
*/
public function analyzeFileStructure () {
- // Just call the block instance
+ // Just call the file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $this->getBlockInstance()->analyzeFileStructure();
+ $this->getBinaryFileInstance()->analyzeFileStructure();
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
* @return $isInitialized Whether the file header is initialized
*/
public function isFileHeaderInitialized () {
- // Just call the block instance
+ // Just call the file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $isInitialized = $this->getBlockInstance()->isFileHeaderInitialized();
+ $isInitialized = $this->getBinaryFileInstance()->isFileHeaderInitialized();
// Return flag
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: isInitialized=%d - EXIT!', intval($isInitialized)));
* @return void
*/
public function createFileHeader () {
- // Just call the block instance
+ // Just call the file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $this->getBlockInstance()->createFileHeader();
+ $this->getBinaryFileInstance()->createFileHeader();
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
throw new InvalidArgumentException('Parameter "type" is empty');
}
- // Just call the block instance
- $this->getBlockInstance()->preAllocateFile($type);
+ // Just call the file instance
+ $this->getBinaryFileInstance()->preAllocateFile($type);
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
* @return void
*/
public function initCountersGapsArray () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $this->getBlockInstance()->initCountersGapsArray();
+ $this->getBinaryFileInstance()->initCountersGapsArray();
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
* @return $totalEntries Size of file header
*/
public final function getHeaderSize () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $size = $this->getBlockInstance()->getHeaderSize();
+ $size = $this->getBinaryFileInstance()->getHeaderSize();
// Return size
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: size=%d - EXIT!', $size));
* @return void
*/
public final function setHeaderSize (int $headerSize) {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: headerSize=%d - CALLED!', $headerSize));
- $this->getBlockInstance()->setHeaderSize($headerSize);
+ $this->getBinaryFileInstance()->setHeaderSize($headerSize);
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
* @return $header Header array
*/
public final function getHeader () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $header = $this->getBlockInstance()->getHeader();
+ $header = $this->getBinaryFileInstance()->getHeader();
// Return it
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: header()=%d - EXIT!', count($header)));
* @return void
*/
public final function setHeader (array $header) {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: header()=%d - CALLED!', count($header)));
- $this->getBlockInstance()->setHeader($header);
+ $this->getBinaryFileInstance()->setHeader($header);
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
* @return void
*/
public function updateSeekPosition () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $this->getBlockInstance()->updateSeekPosition();
+ $this->getBinaryFileInstance()->updateSeekPosition();
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
* @return $totalEntries Total entries in this file
*/
public final function getCounter () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $counter = $this->getBlockInstance()->getCounter();
+ $counter = $this->getBinaryFileInstance()->getCounter();
// Return counter
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: counter=%d - EXIT!', $counter));
* @return $fileSize Size of currently loaded file
*/
public function getFileSize () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $size = $this->getBlockInstance()->getFileSize();
+ $size = $this->getBinaryFileInstance()->getFileSize();
// Return size
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: size=%d - EXIT!', $size));
throw new InvalidArgumentException('Parameter "data" is empty');
}
- // Call block instance
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: Calling this->blockInstance->writeData(%d,data()=%d,%d) ...', $seekPosition, strlen($data), intval($flushHeader)));
- $this->getBlockInstance()->writeData($seekPosition, $data, $flushHeader);
+ // Call file instance
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: Calling this->binaryFileInstance->writeData(%d,data()=%d,%d) ...', $seekPosition, strlen($data), intval($flushHeader)));
+ $this->getBinaryFileInstance()->writeData($seekPosition, $data, $flushHeader);
// Trace message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
}
// Call iterated object's method
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: Calling this->blockInstance->writeAtPosition(%d, %s) ...', $seekPosition, $dataStream));
- $status = $this->getBlockInstance()->writeAtPosition($seekPosition, $dataStream);
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: Calling this->binaryFileInstance->writeAtPosition(%d, %s) ...', $seekPosition, $dataStream));
+ $status = $this->getBinaryFileInstance()->writeAtPosition($seekPosition, $dataStream);
// Return status
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: status[%s]=%d - EXIT!', gettype($status), $status));
* @return $seekPosition Current seek position (stored here in object)
*/
public function getSeekPosition () {
- // Call block instance
+ // Call file instance
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: CALLED!');
- $seekPosition = $this->getBlockInstance()->getSeekPosition();
+ $seekPosition = $this->getBinaryFileInstance()->getSeekPosition();
// Return position
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: seekPosition[%s]=%d - EXIT!', gettype($seekPosition), $seekPosition));
throw new InvalidArgumentException(sprintf('value[]=%s is not supported by file-based indexes', gettype($value)));
}
- // Call block instance
- $data = $this->getBlockInstance()->writeValueToFile($groupId, $value);
+ // Call file instance
+ $data = $this->getBinaryFileInstance()->writeValueToFile($groupId, $value);
// Return data
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: data[]=%s - EXIT!', gettype($data)));
*/
public function writeDataToFreeGap (string $groupId, string $hash, string $encoded) {
// Validate parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: groupId=%s,hash=%s,encoded()=%d - CALLED!', $groupId, $hash, strlen($encoded)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: groupId=%s,hash=%s,encoded(%d)=%s - CALLED!', $groupId, $hash, strlen($encoded), $encoded));
- // Call block instance
- $data = $this->getBlockInstance()->writeDataToFreeGap($groupId, $hash, $encoded);
+ // Call file instance
+ $data = $this->getBinaryFileInstance()->writeDataToFreeGap($groupId, $hash, $encoded);
// Return data
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: data[]=%s - EXIT!', gettype($data)));
throw new InvalidArgumentException(sprintf('length=%d is not valid', $length));
}
- // Call block instance
- $seekPosition = $this->getBlockInstance()->searchNextGap($length);
+ // Call file instance
+ $seekPosition = $this->getBinaryFileInstance()->searchNextGap($length);
// Return position
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-ITERATOR: seekPosition[%s]=%d - EXIT!', gettype($seekPosition), $seekPosition));
<?php
// Own namespace
-namespace CoreFramework\Mailer\!!!;
+namespace Org\Mxchange\CoreFramework\Mailer\!!!;
// Import framwork stuff
use Org\Mxchange\CoreFramework\Mailer\BaseMailer;
<?php
// Own namespace
-namespace CoreFramework\Output\;
+namespace Org\Mxchange\CoreFramework\Output\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
<?php
// Own namespace
-namespace CoreFramework\Registry\!!!;
+namespace Org\Mxchange\CoreFramework\Registry\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Registry\BaseRegistry;
<?php
// Own namespace
-namespace CoreFramework\Request;
+namespace Org\Mxchange\CoreFramework\Request;
/**
* A concrete request class
<?php
// Own namespace
-namespace CoreFramework\Stacker\!!!;
+namespace Org\Mxchange\CoreFramework\Stack\!!!;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Stacker\BaseStacker;
-use Org\Mxchange\CoreFramework\Stacker\Stackable;
+use Org\Mxchange\CoreFramework\Stack\BaseStacker;
+use Org\Mxchange\CoreFramework\Stack\Stackable;
/**
* A ??? Stacker class
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
use Org\Mxchange\CoreFramework\Iterator\Filesystem\SeekableWritableFileIterator;
use Org\Mxchange\CoreFramework\Stack\BaseStacker;
-use Org\Mxchange\CoreFramework\Stack\File\InvalidMagicException;
-use Org\Mxchange\CoreFramework\Stack\File\StackableFile;
use Org\Mxchange\CoreFramework\Traits\Index\IndexableTrait;
use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait;
use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-abstract class BaseFileStack extends BaseStacker implements StackableFile {
+abstract class BaseFileStack extends BaseStacker {
// Load traits
use IndexableTrait;
use IteratorTrait;
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->initCountersGapsArray() ...');
$this->getIteratorInstance()->initCountersGapsArray();
- // Default is not created/already exists
- $created = false;
-
// Is the file's header initialized?
if (!$this->getIteratorInstance()->isFileHeaderInitialized()) {
// First pre-allocate a bit
// Then create file header
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: this->iteratorInstance->createFileHeader() ...');
$this->getIteratorInstance()->createFileHeader();
-
- // Set flag
- $created = true;
}
// Load the file header
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->readFileHeader() ...');
$this->readFileHeader();
- // Not created/already exists?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: created=%d', intval($created)));
- if (!$created) {
- // Count all entries in file
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->analyzeFileStructure() ...');
- $this->getIteratorInstance()->analyzeFileStructure();
- }
-
/*
* Get stack index instance. This can be used for faster
* "defragmentation" and startup.
*/
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: fileInfoInstance[%s]=%s,type=%s', get_class($fileInfoInstance), $fileInfoInstance, $type));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Creating index instance for fileInfoInstance[%s]=%s,type=%s ...', get_class($fileInfoInstance), $fileInfoInstance, $type));
$indexInstance = FileStackIndexFactory::createFileStackIndexInstance($fileInfoInstance, $type);
// And set it here
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: indexInstance=%s', $indexInstance->__toString()));
$this->setIndexInstance($indexInstance);
+ // Is the index loaded correctly and the stack file is just created?
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->indexInstance->isIndexFileLoaded() ...');
+ if (!$this->getIndexInstance()->isIndexFileLoaded()) {
+ /*
+ * Something horrible has happened to the index as it should be
+ * loaded at this point. The stack's file structure then needs to
+ * be analyzed and the index rebuild.
+ */
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->analyzeFileStructure() ...');
+ $this->getIteratorInstance()->analyzeFileStructure();
+
+ // Rebuild index from file
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Calling this->iteratorInstance->rebuildIndexFromStack(%s) ...', $this->__toString()));
+ $this->getIndexInstance()->rebuildIndexFromStack($this);
+ }
+
// Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: EXIT!');
}
*/
protected function addValueToStack (string $stackerName, $value) {
// Validate parameter
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s,value[%s]=%s - CALLED!', $stackerName, gettype($value), print_r($value, true)));
+ /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s,value[]=%s - CALLED!', $stackerName, gettype($value)));
+ //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s,value[%s]=%s', $stackerName, gettype($value), print_r($value, true)));
if (empty($stackerName)) {
// No empty stack name
throw new InvalidArgumentException('Parameter "stackerName" is empty');
$data = $this->getIteratorInstance()->writeValueToFile($stackerName, $value);
// Add the hash and gap position to the index
- $this->getIndexInstance()->addHashToIndex($stackerName, $data);
+ //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: data=%s', print_r($data, true));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Calling this->indexInstance->addHashedDataToIndex(%s,data()=%d) ...', $stackerName, count($data)));
+ $this->getIndexInstance()->addHashedDataToIndex($stackerName, $data);
// Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: EXIT!');
return $isEmpty;
}
- /**
- * Initializes given stacker
- *
- * @param $stackerName Name of the stack
- * @param $forceReInit Force re-initialization
- * @return void
- * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
- */
- public function initStack (string $stackerName, bool $forceReInit = false) {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
- }
-
- /**
- * Initializes all stacks
- *
- * @return void
- * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
- */
- public function initStacks (array $stacks, bool $forceReInit = false) {
- throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION);
- }
-
/**
* Checks whether the given stack is initialized (set in array $stackers)
*
<?php
// Own namespace
-namespace CoreFramework\Stream\;
+namespace Org\Mxchange\CoreFramework\Stream\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
<?php
// Own namespace
-namespace CoreFramework\Stream\Input\;
+namespace Org\Mxchange\CoreFramework\Stream\Input\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
<?php
// Own namespace
-namespace CoreFramework\Stream\Output\;
+namespace Org\Mxchange\CoreFramework\Stream\Output\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
<?php
// Own namespace
-namespace CoreFramework\Task\___;
+namespace Org\Mxchange\CoreFramework\Task\___;
// Import framework stuff
use Org\Mxchange\CoreFramework\Task\BaseTask;
<?php
// Own namespace
-namespace CoreFramework\Template\Engine\;
+namespace Org\Mxchange\CoreFramework\Template\Engine\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
<?php
// Own namespace
-namespace CoreFramework\Visitor\;
+namespace Org\Mxchange\CoreFramework\Visitor\;
// Import framework stuff
use Org\Mxchange\CoreFramework\Visitor\BaseVisitor;
<?php
// Own namespace
-namespace Org\Mxchange\CoreFramework\FileSystem;
+namespace Org\Mxchange\CoreFramework\Filesystem;
// Import framework stuff
use Org\Mxchange\CoreFramework\Generic\FrameworkException;
<?php
// Own namespace
-namespace Org\Mxchange\CoreFramework\FileSystem;
+namespace Org\Mxchange\CoreFramework\Filesystem;
// Import framework stuff
use Org\Mxchange\CoreFramework\Generic\FrameworkException;
// Import framework stuff
use Org\Mxchange\CoreFramework\Generic\FrameworkException;
+use Org\Mxchange\CoreFramework\Stack\File\StackableFile;
/**
* Invalid/bad magic found
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface Block extends FrameworkInterface {
- /**
- * Reads the file header
- *
- * @return void
- */
- function readFileHeader ();
-
- /**
- * Flushes the file header
- *
- * @return void
- */
- function flushFileHeader ();
-
- /**
- * Determines whether the EOF has been reached
- *
- * @return $isEndOfFileReached Whether the EOF has been reached
- */
- function isEndOfFileReached ();
-
- /**
- * Initializes counter for valid entries, arrays for damaged entries and
- * an array for gap seek positions. If you call this method on your own,
- * please re-analyze the file structure. So you are better to call
- * analyzeFileStructure() instead of this method.
- *
- * @return void
- */
- function initCountersGapsArray ();
-
- /**
- * Getter for header size
- *
- * @return $totalEntries Size of file header
- */
- function getHeaderSize ();
-
- /**
- * Setter for header size
- *
- * @param $headerSize Size of file header
- * @return void
- */
- function setHeaderSize (int $headerSize);
-
- /**
- * Getter for header array
- *
- * @return $totalEntries Size of file header
- */
- function getHeader ();
-
- /**
- * Setter for header
- *
- * @param $header Array for a file header
- * @return void
- */
- function setHeader (array $header);
-
- /**
- * Updates seekPosition attribute from file to avoid to much access on file.
- *
- * @return void
- */
- function updateSeekPosition ();
-
- /**
- * Getter for total entries
- *
- * @return $totalEntries Total entries in this file
- */
- function getCounter ();
-
- /**
- * "Getter" for file size
- *
- * @return $fileSize Size of currently loaded file
- */
- function getFileSize ();
-
- /**
- * Writes given value to the file and returns a hash and gap position for it
- *
- * @param $groupId Group identifier
- * @param $value Value to be added to the stack
- * @return $data Hash and gap position
- */
- function writeValueToFile (string $groupId, string $rawData);
-
- /**
- * Writes given raw data to the file and returns a gap position and length
- *
- * @param $groupId Group identifier
- * @param $hash Hash from encoded value
- * @param $encoded Encoded value to be written to the file
- * @return $data Gap position and length of the raw data
- */
- function writeDataToFreeGap (string $groupId, string $hash, string $encoded);
-
- /**
- * Writes data at given position
- *
- * @param $seekPosition Seek position
- * @param $data Data to be written
- * @param $flushHeader Whether to flush the header (default: flush)
- * @return void
- */
- function writeData (int $seekPosition, string $data, bool $flushHeader = true);
-
- /**
- * Writes at given position by seeking to it.
- *
- * @param $seekPosition Seek position in file
- * @param $dataStream Data to be written
- * @return mixed Number of writes bytes or false on error
- * @throws InvalidArgumentException If a parameter is not valid
- */
- function writeAtPosition (int $seekPosition, string $dataStream);
-
- /**
- * Searches for next suitable gap the given length of data can fit in
- * including padding bytes.
- *
- * @param $length Length of raw data
- * @return $seekPosition Found next gap's seek position
- */
- function searchNextGap (int $length);
}
<?php
// Own namespace
-namespace CoreFramework\!!!;
+namespace Org\Mxchange\CoreFramework\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Filesystem\File;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Filesystem\Filesystem;
+
+/**
+ * A virtual file system interface
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface BinaryFile extends Filesystem {
+ /**
+ * Reads the file header
+ *
+ * @return void
+ */
+ function readFileHeader ();
+
+ /**
+ * Flushes the file header
+ *
+ * @return void
+ */
+ function flushFileHeader ();
+
+ /**
+ * Determines whether the EOF has been reached
+ *
+ * @return $isEndOfFileReached Whether the EOF has been reached
+ */
+ function isEndOfFileReached ();
+
+ /**
+ * Getter for header size
+ *
+ * @return $totalEntries Size of file header
+ */
+ function getHeaderSize ();
+
+ /**
+ * Setter for header size
+ *
+ * @param $headerSize Size of file header
+ * @return void
+ */
+ function setHeaderSize (int $headerSize);
+
+ /**
+ * Getter for header array
+ *
+ * @return $totalEntries Size of file header
+ */
+ function getHeader ();
+
+ /**
+ * Setter for header
+ *
+ * @param $header Array for a file header
+ * @return void
+ */
+ function setHeader (array $header);
+
+ /**
+ * Initializes counter for valid entries, arrays for damaged entries and
+ * an array for gap seek positions. If you call this method on your own,
+ * please re-analyze the file structure. So you are better to call
+ * analyzeFileStructure() instead of this method.
+ *
+ * @return void
+ */
+ function initCountersGapsArray ();
+
+ /**
+ * Updates seekPosition attribute from file to avoid to much access on file.
+ *
+ * @return void
+ */
+ function updateSeekPosition ();
+
+ /**
+ * Getter for total entries
+ *
+ * @return $totalEntries Total entries in this file
+ */
+ function getCounter ();
+
+ /**
+ * "Getter" for file size
+ *
+ * @return $fileSize Size of currently loaded file
+ */
+ function getFileSize ();
+
+ /**
+ * Searches for next suitable gap the given length of data can fit in
+ * including padding bytes.
+ *
+ * @param $length Length of raw data
+ * @return $seekPosition Found next gap's seek position
+ */
+ function searchNextGap (int $length);
+
+ /**
+ * Writes given value to the file and returns a hash and gap position for it
+ *
+ * @param $groupId Group identifier
+ * @param $value Value to be added to the stack
+ * @return $data Hash and gap position
+ */
+ function writeValueToFile (string $groupId, string $rawData);
+
+ /**
+ * Writes given raw data to the file and returns a gap position and length
+ *
+ * @param $groupId Group identifier
+ * @param $hash Hash from encoded value
+ * @param $encoded Encoded value to be written to the file
+ * @return $data Gap position and length of the raw data
+ */
+ function writeDataToFreeGap (string $groupId, string $hash, string $encoded);
+
+ /**
+ * Writes data at given position
+ *
+ * @param $seekPosition Seek position
+ * @param $data Data to be written
+ * @param $flushHeader Whether to flush the header (default: flush)
+ * @return void
+ */
+ function writeData (int $seekPosition, string $data, bool $flushHeader = true);
+
+ /**
+ * Writes at given position by seeking to it.
+ *
+ * @param $seekPosition Seek position in file
+ * @param $dataStream Data to be written
+ * @return mixed Number of writes bytes or false on error
+ * @throws InvalidArgumentException If a parameter is not valid
+ */
+ function writeAtPosition (int $seekPosition, string $dataStream);
+
+}
<?php
// Own namespace
-namespace Org\Mxchange\CoreFramework\FileSystem;
+namespace Org\Mxchange\CoreFramework\Filesystem;
// Import framework stuff
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Filesystem\Index;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Filesystem\File\BinaryFile;
+
+/**
+ * An interface for Indexable file classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface IndexableFile extends BinaryFile {
+
+}
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Filesystem\Stack;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Filesystem\File\BinaryFile;
+
+/**
+ * An interface for files of file-based stacks
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface FileStacker extends BinaryFile {
+
+}
<?php
// Own namespace
-namespace CoreFramework\Index\!!!;
+namespace Org\Mxchange\CoreFramework\Index\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Index\Indexable;
<?php
// Own namespace
-namespace Org\Mxchange\CoreFramework\Stack\Index;
+namespace Org\Mxchange\CoreFramework\Index\Stack;
// Import framework stuff
use Org\Mxchange\CoreFramework\Filesystem\Block\CalculatableBlock;
*/
interface IndexableStack extends Indexable, CalculatableBlock {
/**
- * Adds given hash to an index file
+ * Adds given data's hash to the index file
*
* @param $stackName Name of stack to add hash
* @param $data Hash and gap position to be added to the index
* @return void
+ * @throws InvalidArgumentException If a parameter is not valid
*/
- function addHashToIndex (string $stackName, array $data);
+ function addHashedDataToIndex (string $stackName, array $data);
+
+ /**
+ * Checks whether the index' file has been fully loaded (and parsed)
+ *
+ * @return $isLoaded Whether the index' file has been loaded
+ */
+ function isIndexFileLoaded ();
}
*/
function isStackEmpty (string $stackerName);
+ /**
+ * Initializes given stacker
+ *
+ * @param $stackerName Name of the stack
+ * @param $forceReInit Force re-initialization
+ * @return void
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function initStack (string $stackerName, bool $forceReInit = false);
+
+ /**
+ * Initializes all stacks
+ *
+ * @return void
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function initStacks (array $stacks, bool $forceReInit = false);
+
+ /**
+ * Getter for size of given stack (array count)
+ *
+ * @param $stackerName Name of the stack
+ * @return $count Size of stack (array count)
+ */
+ function getStackCount (string $stackerName);
+
}
*/
function size ();
+ /**
+ * Reads the file header
+ *
+ * @return void
+ * @todo To hard assertions here, better rewrite them to exceptions
+ * @throws UnexpectedValueException If header is not proper length
+ * @throws InvalidMagicException If a bad magic was found
+ */
+ function readFileHeader ();
+
+ /**
+ * Flushes the file header
+ *
+ * @return void
+ */
+ function flushFileHeader ();
+
+ /**
+ * Determines whether the EOF has been reached
+ *
+ * @return $isEndOfFileReached Whether the EOF has been reached
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function isEndOfFileReached ();
+
+ /**
+ * Calculates minimum length for one entry/block
+ *
+ * @return $length Minimum length for one entry/block
+ */
+ function calculateMinimumBlockLength ();
+
+ /**
+ * Initializes counter for valid entries, arrays for damaged entries and
+ * an array for gap seek positions. If you call this method on your own,
+ * please re-analyze the file structure. So you are better to call
+ * analyzeFileStructure() instead of this method.
+ *
+ * @return void
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function initCountersGapsArray ();
+
+ /**
+ * Getter for header size
+ *
+ * @return $totalEntries Size of file header
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function getHeaderSize ();
+
+ /**
+ * Setter for header size
+ *
+ * @param $headerSize Size of file header
+ * @return void
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function setHeaderSize (int $headerSize);
+
+ /**
+ * Getter for header array
+ *
+ * @return $totalEntries Size of file header
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function getHeader ();
+
+ /**
+ * Setter for header
+ *
+ * @param $header Array for a file header
+ * @return void
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function setHeader (array $header);
+
+ /**
+ * Updates seekPosition attribute from file to avoid to much access on file.
+ *
+ * @return void
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function updateSeekPosition ();
+
+ /**
+ * Getter for total entries
+ *
+ * @return $totalEntries Total entries in this file
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function getCounter ();
+
+ /**
+ * Writes data at given position
+ *
+ * @param $seekPosition Seek position
+ * @param $data Data to be written
+ * @param $flushHeader Whether to flush the header (default: flush)
+ * @return void
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function writeData (int $seekPosition, string $data, bool $flushHeader = true);
+
+ /**
+ * Writes at given position by seeking to it.
+ *
+ * @param $seekPosition Seek position in file
+ * @param $dataStream Data to be written
+ * @return mixed Number of writes bytes or false on error
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function writeAtPosition (int $seekPosition, string $dataStream);
+
+ /**
+ * Writes given value to the file and returns a hash and gap position for it
+ *
+ * @param $groupId Group identifier
+ * @param $value Value to be added to the stack
+ * @return $data Hash and gap position
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function writeValueToFile (string $groupId, $value);
+
+ /**
+ * Searches for next suitable gap the given length of data can fit in
+ * including padding bytes.
+ *
+ * @param $length Length of raw data
+ * @return $seekPosition Found next gap's seek position
+ * @throws UnsupportedOperationException This method is not (and maybe never will be) supported
+ */
+ function searchNextGap (int $length);
+
+ /**
+ * "Getter" for file size
+ *
+ * @return $fileSize Size of currently loaded file
+ */
+ function getFileSize ();
+
+ /**
+ * Writes given raw data to the file and returns a gap position and length
+ *
+ * @param $groupId Group identifier
+ * @param $hash Hash from encoded value
+ * @param $encoded Encoded value to be written to the file
+ * @return $data Gap position and length of the raw data
+ */
+ function writeDataToFreeGap (string $groupId, string $hash, string $encoded);
+
}
<?php
// Own namespace
-namespace CoreFramework\Tests\Filter\!!!;
+namespace Org\Mxchange\CoreFramework\Tests\Filter\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Filter\Filterable;
<?php
// Own namespace
-namespace CoreFramework\Tests\Filter\Configuration\!!!;
+namespace Org\Mxchange\CoreFramework\Tests\Filter\Configuration\!!!;
// Import framework stuff
use Org\Mxchange\CoreFramework\Filter\Filterable;
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\File;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Filesystem\File\BinaryFile;
+
+/**
+ * A trait for binary files
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait BinaryFileTrait {
+ /**
+ * An instance of an BinaryFile class
+ */
+ private $binaryFileInstance = NULL;
+
+ /**
+ * Setter for BinaryFile instance
+ *
+ * @param $binaryFileInstance An instance of an BinaryFile class
+ * @return void
+ */
+ protected final function setBinaryFileInstance (BinaryFile $binaryFileInstance) {
+ $this->binaryFileInstance = $binaryFileInstance;
+ }
+
+ /**
+ * Getter for BinaryFile instance
+ *
+ * @return $binaryFileInstance An instance of an BinaryFile class
+ */
+ public final function getBinaryFileInstance () {
+ return $this->binaryFileInstance;
+ }
+
+}
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Index\Stack;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Index\Stack\IndexableStack;
+
+/**
+ * A trait for indexable stacks
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait IndexableStackTrait {
+ /**
+ * An instance of an IndexableStack class
+ */
+ private $indexInstance = NULL;
+
+ /**
+ * Setter for IndexableStack instance
+ *
+ * @param $indexInstance An instance of an IndexableStack class
+ * @return void
+ */
+ protected final function setIndexableStackInstance (IndexableStack $indexInstance) {
+ $this->indexInstance = $indexInstance;
+ }
+
+ /**
+ * Getter for IndexableStack instance
+ *
+ * @return $indexInstance An instance of an IndexableStack class
+ */
+ public final function getIndexableStackInstance () {
+ return $this->indexInstance;
+ }
+
+}