From 9d660b840e51d029876127c405de2aae2757b4d3 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 19 May 2014 20:44:21 +0200 Subject: [PATCH] These methods may never be supported as initialization of file-based stacks does currently not work. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../main/stacker/file/class_BaseFileStack.php | 140 ++++++++---------- 1 file changed, 59 insertions(+), 81 deletions(-) diff --git a/inc/classes/main/stacker/file/class_BaseFileStack.php b/inc/classes/main/stacker/file/class_BaseFileStack.php index c768db3e..203655d9 100644 --- a/inc/classes/main/stacker/file/class_BaseFileStack.php +++ b/inc/classes/main/stacker/file/class_BaseFileStack.php @@ -415,64 +415,6 @@ class BaseFileStack extends BaseStacker { // Load the file header $this->readFileHeader(); - - // Try to read file stack to speed up its processing. - } - - /** - * Initializes given stacker - * - * @param $stackerName Name of the stack - * @param $forceReInit Force re-initialization - * @return void - * @throws AlreadyInitializedStackerException If the stack is already initialized - */ - public function initStack ($stackerName, $forceReInit = FALSE) { - // Is the stack already initialized? - if (($forceReInit === FALSE) && ($this->isStackInitialized($stackerName))) { - // Then throw the exception - throw new AlreadyInitializedStackerException(array($this, $stackerName, $forceReInit), self::EXCEPTION_STACKER_ALREADY_INITIALIZED); - } // END - if - - // Initialize the given stack - $this->partialStub('stackerName=' . $stackerName . ',forceReInit=' . intval($forceReInit)); - } - - /** - * Checks whether the given stack is initialized (set in array $stackers) - * - * @param $stackerName Name of the stack - * @return $isInitialized Whether the stack is initialized - */ - public function isStackInitialized ($stackerName) { - // Is is there? - $this->partialStub('stackerName=' . $stackerName); - $isInitialized = TRUE; - - // Return result - return $isInitialized; - } - - /** - * Getter for size of given stack (array count) - * - * @param $stackerName Name of the stack - * @return $count Size of stack (array count) - * @throws NoStackerException If given stack is missing - */ - public function getStackCount ($stackerName) { - // Is the stack not yet initialized? - if (!$this->isStackInitialized($stackerName)) { - // Throw an exception - throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); - } // END - if - - // Now, count the array of entries - $this->partialStub('stackerName=' . $stackerName); - $count = 0; - - // Return result - return $count; } /** @@ -481,13 +423,8 @@ class BaseFileStack extends BaseStacker { * @param $stackerName Name of the stack * @param $value Value to add to this stacker * @return void - * @throws FullStackerException Thrown if the stack is full */ protected function addValue ($stackerName, $value) { - // Is the stack not yet initialized or full? - if (!$this->isStackInitialized($stackerName)) { - // Then do it here - $this->initStack($stackerName); } elseif ($this->isStackFull($stackerName)) { // Stacker is full throw new FullStackerException(array($this, $stackerName, $value), self::EXCEPTION_STACKER_IS_FULL); @@ -502,14 +439,9 @@ class BaseFileStack extends BaseStacker { * * @param $stackerName Name of the stack * @return $value Value of last added value - * @throws NoStackerException If the named stacker was not found - * @throws EmptyStackerException If the named stacker is empty */ protected function getLastValue ($stackerName) { // Is the stack not yet initialized or full? - if (!$this->isStackInitialized($stackerName)) { - // Throw an exception - throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); } elseif ($this->isStackEmpty($stackerName)) { // Throw an exception throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); @@ -528,14 +460,9 @@ class BaseFileStack extends BaseStacker { * * @param $stackerName Name of the stack * @return $value Value of last added value - * @throws NoStackerException If the named stacker was not found - * @throws EmptyStackerException If the named stacker is empty */ protected function getFirstValue ($stackerName) { // Is the stack not yet initialized or full? - if (!$this->isStackInitialized($stackerName)) { - // Throw an exception - throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); } elseif ($this->isStackEmpty($stackerName)) { // Throw an exception throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); @@ -554,14 +481,9 @@ class BaseFileStack extends BaseStacker { * * @param $stackerName Name of the stack * @return $value Value "poped" from array - * @throws NoStackerException If the named stacker was not found - * @throws EmptyStackerException If the named stacker is empty */ protected function popLast ($stackerName) { // Is the stack not yet initialized or full? - if (!$this->isStackInitialized($stackerName)) { - // Throw an exception - throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); } elseif ($this->isStackEmpty($stackerName)) { // Throw an exception throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); @@ -582,9 +504,6 @@ class BaseFileStack extends BaseStacker { */ protected function popFirst ($stackerName) { // Is the stack not yet initialized or full? - if (!$this->isStackInitialized($stackerName)) { - // Throw an exception - throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); } elseif ($this->isStackEmpty($stackerName)) { // Throw an exception throw new EmptyStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_IS_EMPTY); @@ -594,6 +513,65 @@ class BaseFileStack extends BaseStacker { $this->partialStub('stackerName=' . $stackerName); return NULL; } + + /** + * 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 ($stackerName, $forceReInit = FALSE) { + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), 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, $forceReInit = FALSE) { + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); + } + + /** + * Checks whether the given stack is initialized (set in array $stackers) + * + * @param $stackerName Name of the stack + * @return $isInitialized Whether the stack is initialized + * @throws UnsupportedOperationException This method is not (and maybe never will be) supported + */ + public function isStackInitialized ($stackerName) { + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); + } + + /** + * Getter for size of given stack (array count) + * + * @param $stackerName Name of the stack + * @return $count Size of stack (array count) + */ + public function getStackCount ($stackerName) { + // Now, count the array of entries + $this->partialStub('stackerName=' . $stackerName); + $count = 0; + + // Return result + return $count; + } + + /** + * Checks whether the given stack is empty + * + * @param $stackerName Name of the stack + * @return $isEmpty Whether the stack is empty + * @throws UnsupportedOperationException This method is not (and maybe never will be) supported + */ + public final function isStackEmpty ($stackerName) { + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); + } } // [EOF] -- 2.30.2