]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/cruncher/class_BaseHubCruncher.php
Renamed 'stacker' -> 'stack'
[hub.git] / application / hub / main / cruncher / class_BaseHubCruncher.php
index 39471d34dca5da6286f48f774c76a96d2714c8ed..0f68adc7c27cd3d1314eb6fec06f2d2989b7eaba 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @copyright  Copyright (c) 2011 - 2012 Cruncher Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -30,12 +30,22 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
        /**
         * By default no cruncher is active
         */
-       private $isActive = false;
+       private $isActive = FALSE;
 
        /**
         * All buffer queue instances (a FIFO)
         */
-       private $bufferInstance = null;
+       private $bufferInstance = NULL;
+
+       /**
+        * Stacker name for incoming queue
+        */
+       const STACKER_NAME_IN_QUEUE = 'in_queue';
+
+       /**
+        * Stacker name for outcoming queue
+        */
+       const STACKER_NAME_OUT_QUEUE = 'out_queue';
 
        /**
         * Protected constructor
@@ -81,14 +91,14 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
        }
 
        /**
-        * Checks wether the in-buffer queue is filled by comparing it's current
+        * Checks whether the in-buffer queue is filled by comparing it's current
         * amount of entries against a threshold.
         *
-        * @return      $isFilled       Wether the in-buffer is filled
+        * @return      $isFilled       Whether the in-buffer is filled
         */
        protected function isInBufferQueueFilled () {
                // Determine it
-               $isFilled = ($this->bufferInstance->getStackCount('in_queue') > $this->getConfigInstance()->getConfigEntry('cruncher_in_buffer_min_threshold'));
+               $isFilled = ($this->bufferInstance->getStackCount(self::STACKER_NAME_IN_QUEUE) > $this->getConfigInstance()->getConfigEntry('cruncher_in_buffer_min_threshold'));
 
                // And return the result
                return $isFilled;
@@ -121,14 +131,14 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
         * @param       $version        Version number of this cruncher
         * @return      void
         */
-       public final function enableIsActive ($isActive = true) {
+       public final function enableIsActive ($isActive = TRUE) {
                $this->isActive = (bool) $isActive;
        }
 
        /**
-        * Determines wether the cruncher is active
+        * Determines whether the cruncher is active
         *
-        * @return      $isActive       Wether the cruncher is active
+        * @return      $isActive       Whether the cruncher is active
         */
        public final function isActive () {
                return $this->isActive;
@@ -148,11 +158,13 @@ abstract class BaseHubCruncher extends BaseHubSystem implements Updateable {
                $this->bufferInstance = ObjectFactory::createObjectByConfiguredName('cruncher_buffer_stacker_class');
 
                // Initialize common stackers, like in/out
-               $this->bufferInstance->initStacker('in_queue');
-               $this->bufferInstance->initStacker('out_queue');
+               $this->bufferInstance->initStacks(array(
+                       self::STACKER_NAME_IN_QUEUE,
+                       self::STACKER_NAME_OUT_QUEUE
+               ));
 
                // Output debug message
-               $this->debugOutput('CRUNCHER: All buffers are now initialized.');
+               self::createDebugInstance(__CLASS__)->debugOutput('CRUNCHER: All buffers are now initialized.');
        }
 
        /**