]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/class_BaseHubSystem.php
Updated core as $stateInstance is now in BaseFrameworkSystem
[hub.git] / application / hub / main / class_BaseHubSystem.php
index bf644d940d82cb8480d9a91b247ab0ee25338838..c8e141df12a15628d38714eab2a97e364b721ec9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -49,26 +49,6 @@ class BaseHubSystem extends BaseFrameworkSystem {
         */
        private $nodeInstance = NULL;
 
-       /**
-        * An instance of a communicator
-        */
-       private $communicatorInstance = NULL;
-
-       /**
-        * An instance of a crawler
-        */
-       private $crawlerInstance = NULL;
-
-       /**
-        * An instance of a cruncher
-        */
-       private $cruncherInstance = NULL;
-
-       /**
-        * An instance of a miner
-        */
-       private $minerInstance = NULL;
-
        /**
         * A network package handler instance
         */
@@ -79,11 +59,6 @@ class BaseHubSystem extends BaseFrameworkSystem {
         */
        private $receiverInstance = NULL;
 
-       /**
-        * State instance
-        */
-       private $stateInstance = NULL;
-
        /**
         * Listener pool instance
         */
@@ -94,11 +69,6 @@ class BaseHubSystem extends BaseFrameworkSystem {
         */
        private $fragmenterInstance = NULL;
 
-       /**
-        * Decoder instance
-        */
-       private $decoderInstance = NULL;
-
        /**
         * Assembler instance
         */
@@ -144,82 +114,6 @@ class BaseHubSystem extends BaseFrameworkSystem {
                $this->nodeInstance = $nodeInstance;
        }
 
-       /**
-        * Getter for communicator instance
-        *
-        * @return      $communicatorInstance   An instance of a Communicator class
-        */
-       public final function getCommunicatorInstance () {
-               return $this->communicatorInstance;
-       }
-
-       /**
-        * Setter for communicator instance
-        *
-        * @param       $communicatorInstance   An instance of a Communicator class
-        * @return      void
-        */
-       protected final function setCommunicatorInstance (Communicator $communicatorInstance) {
-               $this->communicatorInstance = $communicatorInstance;
-       }
-
-       /**
-        * Getter for crawler instance
-        *
-        * @return      $crawlerInstance        An instance of a Crawler class
-        */
-       public final function getCrawlerInstance () {
-               return $this->crawlerInstance;
-       }
-
-       /**
-        * Setter for crawler instance
-        *
-        * @param       $crawlerInstance        An instance of a Crawler class
-        * @return      void
-        */
-       protected final function setCrawlerInstance (Crawler $crawlerInstance) {
-               $this->crawlerInstance = $crawlerInstance;
-       }
-
-       /**
-        * Getter for cruncher instance
-        *
-        * @return      $cruncherInstance       An instance of a cruncher cruncher
-        */
-       public final function getCruncherInstance () {
-               return $this->cruncherInstance;
-       }
-
-       /**
-        * Setter for cruncher instance
-        *
-        * @param       $cruncherInstance       An instance of a cruncher cruncher
-        * @return      void
-        */
-       protected final function setCruncherInstance (CruncherHelper $cruncherInstance) {
-               $this->cruncherInstance = $cruncherInstance;
-       }
-
-       /**
-        * Getter for miner instance
-        *
-        * @return      $minerInstance  An instance of a miner miner
-        */
-       public final function getMinerInstance () {
-               return $this->minerInstance;
-       }
-
-       /**
-        * Setter for miner instance
-        *
-        * @param       $minerInstance  An instance of a miner miner
-        * @return      void
-        */
-       protected final function setMinerInstance (MinerHelper $minerInstance) {
-               $this->minerInstance = $minerInstance;
-       }
-
        /**
         * Setter for network package handler instance
         *
@@ -258,25 +152,6 @@ class BaseHubSystem extends BaseFrameworkSystem {
                return $this->receiverInstance;
        }
 
-       /**
-        * Setter for state instance
-        *
-        * @param       $stateInstance  A Stateable instance
-        * @return      void
-        */
-       public final function setStateInstance (Stateable $stateInstance) {
-               $this->stateInstance = $stateInstance;
-       }
-
-       /**
-        * Getter for state instance
-        *
-        * @return      $stateInstance  A Stateable instance
-        */
-       public final function getStateInstance () {
-               return $this->stateInstance;
-       }
-
        /**
         * Setter for listener pool instance
         *
@@ -315,29 +190,10 @@ class BaseHubSystem extends BaseFrameworkSystem {
                return $this->fragmenterInstance;
        }
 
-       /**
-        * Setter for decoder instance
-        *
-        * @param       $decoderInstance        A Decodeable instance
-        * @return      void
-        */
-       protected final function setDecoderInstance (Decodeable $decoderInstance) {
-               $this->decoderInstance = $decoderInstance;
-       }
-
-       /**
-        * Getter for decoder instance
-        *
-        * @return      $decoderInstance        A Decodeable instance
-        */
-       protected final function getDecoderInstance () {
-               return $this->decoderInstance;
-       }
-
        /**
         * Setter for assembler instance
         *
-        * @param       $assemblerInstance      A Decodeable instance
+        * @param       $assemblerInstance      An instance of an Assembler class
         * @return      void
         */
        protected final function setAssemblerInstance (Assembler $assemblerInstance) {
@@ -347,7 +203,7 @@ class BaseHubSystem extends BaseFrameworkSystem {
        /**
         * Getter for assembler instance
         *
-        * @return      $assemblerInstance      A Decodeable instance
+        * @return      $assemblerInstance      An instance of an Assembler class
         */
        protected final function getAssemblerInstance () {
                return $this->assemblerInstance;
@@ -366,7 +222,7 @@ class BaseHubSystem extends BaseFrameworkSystem {
        /**
         * Getter for info instance
         *
-        * @return      $infoInstance   A Decodeable instance
+        * @return      $infoInstance   An instance of a ShareableInfo class
         */
        public final function getInfoInstance () {
                return $this->infoInstance;
@@ -483,7 +339,7 @@ class BaseHubSystem extends BaseFrameworkSystem {
         */
        protected function getSocketErrorHandlerFromCode ($errorCode) {
                // Create a name from translated error code
-               $handlerName = 'socketError' . $this->convertToClassName($this->translateSocketErrorCodeToName($errorCode)) . 'Handler';
+               $handlerName = 'socketError' . self::convertToClassName($this->translateSocketErrorCodeToName($errorCode)) . 'Handler';
 
                // Is the call-back method there?
                if (!method_exists($this, $handlerName)) {
@@ -541,36 +397,6 @@ class BaseHubSystem extends BaseFrameworkSystem {
                socket_clear_error($socketResource);
        }
 
-       /**
-        * Checks whether the final (last) chunk is valid
-        *
-        * @param       $chunks         An array with chunks and (hopefully) a valid final chunk
-        * @return      $isValid        Whether the final (last) chunk is valid
-        */
-       protected function isValidFinalChunk (array $chunks) {
-               // Default is all fine
-               $isValid = TRUE;
-
-               // Split the (possible) EOP chunk
-               $chunkSplits = explode(PackageFragmenter::CHUNK_DATA_HASH_SEPARATOR, $chunks[count($chunks) - 1]);
-
-               // Make sure chunks with only 3 elements are parsed (for details see ChunkHandler)
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('eopChunk=' . $chunks[count($chunks) - 1] . ',chunkSplits=' . print_r($chunkSplits, TRUE));
-               assert(count($chunkSplits) == 3);
-
-               // Validate final chunk
-               if (substr($chunkSplits[ChunkHandler::CHUNK_SPLITS_INDEX_RAW_DATA], 0, strlen(PackageFragmenter::END_OF_PACKAGE_IDENTIFIER)) != PackageFragmenter::END_OF_PACKAGE_IDENTIFIER) {
-                       // Not fine
-                       $isValid = FALSE;
-               } elseif (substr_count($chunkSplits[ChunkHandler::CHUNK_SPLITS_INDEX_RAW_DATA], PackageFragmenter::CHUNK_HASH_SEPARATOR) != 1) {
-                       // CHUNK_HASH_SEPARATOR shall only be found once
-                       $isValid = FALSE;
-               }
-
-               // Return status
-               return $isValid;
-       }
-
        /**
         * Translates socket error codes into our own internal names which can be
         * used for call-backs.