X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fstacker%2Fclass_BaseStacker.php;h=d86598233e7b4ab4aad67ee76e62e94dce8b3d88;hb=1dbbf8cc5f7a167559b23d41ffa3bab8e8ebf5e1;hp=2fdc0d2556dd62494b3902bc066e053f5b2861d4;hpb=7dd76b61aa39deab983fecadef400ee9e8c95ebc;p=core.git diff --git a/inc/classes/main/stacker/class_BaseStacker.php b/inc/classes/main/stacker/class_BaseStacker.php index 2fdc0d25..d8659823 100644 --- a/inc/classes/main/stacker/class_BaseStacker.php +++ b/inc/classes/main/stacker/class_BaseStacker.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -48,12 +48,13 @@ class BaseStacker extends BaseFrameworkSystem { * Initializes given stacker * * @param $stackerName Name of the stack + * @param $forceReInit Force re-initialization * @return void * @throws AlreadyInitializedStackerException If the stack is already initialized */ - protected final function initStacker ($stackerName) { + public final function initStacker ($stackerName, $forceReInit = false) { // Is the stack already initialized? - if ($this->isStackInitialized($stackerName)) { + if (($forceReInit === false) && ($this->isStackInitialized($stackerName))) { // Then throw the exception throw new AlreadyInitializedStackerException(array($this, $stackerName), self::EXCEPTION_STACKER_ALREADY_INITIALIZED); } // END - if @@ -66,10 +67,10 @@ class BaseStacker extends BaseFrameworkSystem { } /** - * Checks wether the given stack is initialized (set in array $stackers) + * Checks whether the given stack is initialized (set in array $stackers) * * @param $stackerName Name of the stack - * @return $isInitialized Wether the stack is initialized + * @return $isInitialized Whether the stack is initialized */ public final function isStackInitialized ($stackerName) { // Is is there? @@ -80,10 +81,10 @@ class BaseStacker extends BaseFrameworkSystem { } /** - * Checks wether the given stack is full + * Checks whether the given stack is full * * @param $stackerName Name of the stack - * @return $isFull Wether the stack is full + * @return $isFull Whether the stack is full * @throws NoStackerException If given stack is missing */ protected final function isStackFull ($stackerName) { @@ -101,10 +102,10 @@ class BaseStacker extends BaseFrameworkSystem { } /** - * Checks wether the given stack is empty + * Checks whether the given stack is empty * - * @param $stackerName Name of the stack - * @return $isEmpty Wether the stack is empty + * @param $stackerName Name of the stack + * @return $isEmpty Whether the stack is empty * @throws NoStackerException If given stack is missing */ public final function isStackEmpty ($stackerName) { @@ -114,11 +115,11 @@ class BaseStacker extends BaseFrameworkSystem { throw new NoStackerException(array($this, $stackerName), self::EXCEPTION_NO_STACKER_FOUND); } // END - if - // So, is the stack full? - $isFull = (($this->getStackCount($stackerName)) == 0); + // So, is the stack empty? + $isEmpty = (($this->getStackCount($stackerName)) == 0); // Return result - return $isFull; + return $isEmpty; } /** @@ -128,7 +129,7 @@ class BaseStacker extends BaseFrameworkSystem { * @return $count Size of stack (array count) * @throws NoStackerException If given stack is missing */ - protected final function getStackCount ($stackerName) { + public final function getStackCount ($stackerName) { // Is the stack not yet initialized? if (!$this->isStackInitialized($stackerName)) { // Throw an exception