]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/pools/class_BasePool.php
Added a new task for listener pools and network package readers (for abstract Network...
[hub.git] / application / hub / main / pools / class_BasePool.php
index 9c9690322770d4de674c1c6c17893cb28fa87b34..458dc656dac16e5d977308a95d64dfb866403ff3 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 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -41,6 +41,15 @@ class BasePool extends BaseHubSystem implements Visitable {
                $this->poolEntriesInstance = ObjectFactory::createObjectByConfiguredName('pool_entries_list_class');
        }
 
+       /**
+        * Getter for pool entries instance
+        *
+        * @return      $poolEntriesInstance    An instance for pool entries (list)
+        */
+       public final function getPoolEntriesInstance () {
+               return $this->poolEntriesInstance;
+       }
+
        /**
         * Adds an instance to a pool segment
         *
@@ -51,13 +60,13 @@ class BasePool extends BaseHubSystem implements Visitable {
         */
        protected final function addInstance ($group, $poolName, Visitable $instance) {
                // Is the pool group there?
-               if (!$this->poolEntriesInstance->isGroupSet($group)) {
+               if (!$this->getPoolEntriesInstance()->isGroupSet($group)) {
                        // Create the missing pool group
-                       $this->poolEntriesInstance->addGroup($group);
+                       $this->getPoolEntriesInstance()->addGroup($group);
                } // END - if
 
                // Add it to given pool group
-               $this->poolEntriesInstance->addInstance($group, $poolName, $instance);
+               $this->getPoolEntriesInstance()->addInstance($group, $poolName, $instance);
        }
 
        /**
@@ -67,24 +76,24 @@ class BasePool extends BaseHubSystem implements Visitable {
         * @return      void
         */
        protected final function addPoolEntry ($poolEntry) {
-               $this->poolEntriesInstance->addEntry('generic', $poolEntry);
+               $this->getPoolEntriesInstance()->addEntry('generic', $poolEntry);
        }
 
        /**
-        * Accepts the visitor to rpocess the visit "request"
+        * Accepts the visitor to process the visit "request"
         *
         * @param       $visitorInstance        An instance of a Visitor class
         * @return      void
         */
        public function accept (Visitor $visitorInstance) {
                // Debug message
-               //* DEBUG: */ $this->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - START');
+               //* NOISY-DEBUG: */ $this->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - START');
 
                // Visit this pool
                $visitorInstance->visitPool($this);
 
                // Get a new iterator instance
-               $iteratorInstance = ObjectFactory::createObjectByConfiguredName($visitorInstance->getVisitorMode() . '_pool_iterator_class', array($this->poolEntriesInstance));
+               $iteratorInstance = ObjectFactory::createObjectByConfiguredName($visitorInstance->getVisitorMode() . '_pool_iterator_class', array($this->getPoolEntriesInstance()));
 
                // Reset the counter
                $iteratorInstance->rewind();
@@ -97,7 +106,6 @@ class BasePool extends BaseHubSystem implements Visitable {
                        // Is this entry visitable?
                        if ($poolEntry instanceof Visitable) {
                                // Visit this entry as well
-                               print __METHOD__.':'.$poolEntry."\n";
                                $poolEntry->accept($visitorInstance);
                        } else {
                                // Cannot visit this entry
@@ -109,7 +117,21 @@ class BasePool extends BaseHubSystem implements Visitable {
                } // END - while
 
                // Debug message
-               //* DEBUG: */ $this->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - FINISHED');
+               //* NOISY-DEBUG: */ $this->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - FINISHED');
+       }
+
+       /**
+        * Gets the array from specified list
+        *
+        * @param       $list   The list identifier we should return
+        * @return      $array  The requested array
+        */
+       protected final function getArrayFromList ($list) {
+               // Get the array
+               $array = $this->getPoolEntriesInstance()->getArrayFromList($list);
+
+               // Return it
+               return $array;
        }
 }