]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/lists/class_BaseList.php
Continued rewrite:
[hub.git] / application / hub / main / lists / class_BaseList.php
index db8699b7d0568e142de50da83ef47f5a63860031..cb9840262417bebb1221c2c971469c8ad9c728d1 100644 (file)
@@ -82,7 +82,7 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
         * @return      $isset          Whether the group is valid
         */
        public function isGroupSet ($groupName) {
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.': '.$groupName);
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName);
                return isset($this->listGroups[$groupName]);
        }
 
@@ -94,7 +94,7 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
         * @throws      ListGroupAlreadyAddedException  If the given group is already added
         */
        public function addGroup ($groupName) {
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.': '.$groupName . ' - START');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
                // Is the group already added?
                if ($this->isGroupSet($groupName)) {
                        // Throw the exception here
@@ -103,7 +103,7 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
 
                // Add the group which is a simple array
                $this->listGroups[$groupName] = ObjectFactory::createObjectByConfiguredName('list_group_class');
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.': '.$groupName . ' - FINISHED');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - EXIT!');
        }
 
        /**
@@ -116,7 +116,9 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
         * @throws      NoListGroupException    If the given group is not found
         */
        public function addInstance ($groupName, $subGroup, Visitable $visitableInstance) {
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.': '.$groupName  . '/' . $subGroup . ' - START');
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName  . ',subGroup=' . $subGroup . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!');
+
                // Is the group there?
                if (!$this->isGroupSet($groupName)) {
                        // Throw the exception here
@@ -132,15 +134,21 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
                // Generate the hash
                $hash = $this->generateHash($groupName, $subGroup, $visitableInstance);
 
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName  . ',subGroup=' . $subGroup . ',hash=' . $hash . ' - Calling addEntry() ...');
+
                // Now add it to the group list and hash it
-               $this->listGroups[$groupName]->addEntry($subGroup, $hash);
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',this->listGroups[' . $groupName . ']=' . $this->listGroups[$groupName]->__toString());
+               //$this->listGroups[$groupName]->addEntry($subGroup, $hash);
 
                // Add the hash to the index
                array_push($this->listIndex, $hash);
 
                // Add the instance itself to the list
                $this->listEntries[$hash] = $visitableInstance;
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.': '.$groupName  . '/' . $subGroup . ' - FINISHED');
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName  . ',subGroup=' . $subGroup . ' - EXIT!');
        }
 
        /**
@@ -151,6 +159,9 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
         * @throws      NoListGroupException    If the given group is not found
         */
        public final function getArrayFromList ($list) {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',list[' . gettype($list) . ']=' . $list . ' - CALLED!');
+
                // Is the group there?
                if ((!is_null($list)) && (!$this->isGroupSet($list))) {
                        // Throw the exception here
@@ -168,15 +179,20 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
 
                // Walk through all entries
                foreach ($this->listIndex as $hash) {
-                       //* DEBUG: */ print __METHOD__.':hash='.$hash.chr(10);
+                       // Debug message
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: hash=' . $hash);
+
                        // Is the list entry set?
                        if ($this->isHashValid($hash)) {
                                // Add it
                                array_push($array, $this->listEntries[$hash]);
-                               //* DEBUG: */ print __METHOD__.": ADDED!\n";
+                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: hash=' . $hash . ',array(' . count($array) . ')=' . print_r($array, TRUE) . ' - ADDED!');
                        } // END - if
                } // END - foreach
 
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',list[' . gettype($list) . ']=' . $list . ',array()=' . count($array) . ' - EXIT!');
+
                // Return it
                return $array;
        }
@@ -190,7 +206,9 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
         * @throws      NoListGroupException    If the given group is not found
         */
        public function addEntry ($groupName, $entry) {
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.'('.$this->__toString().'): '.$groupName . ' - START');
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
+
                // Is the group already added?
                if (!$this->isGroupSet($groupName)) {
                        // Throw the exception here
@@ -199,16 +217,21 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
 
                // Generate hash
                $hash = $this->generateHash($groupName, $groupName, $entry);
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-LIST[' . __METHOD__ . ':' . __LINE__ . ']:  groupName=' . $groupName . ', entry=' . $entry . ', hash=' . $hash);
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . print_r($entry, TRUE) . ', hash=' . $hash);
 
                // Add the hash to the index
                array_push($this->listIndex, $hash);
-               //* DEBUG: */ print $groupName.'/'.$this->count().chr(10);
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',listEntries()=' . count($this->listEntries));
 
                // Now add the entry to the list
                $this->listEntries[$hash] = $entry;
-               //* DEBUG: */ print $groupName.'/'.count($this->listEntries).chr(10);
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.'('.$this->__toString().'): '.$groupName . ' - FINISHED');
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',listEntries()=' . count($this->listEntries) . ' - EXIT!');
        }
 
        /**
@@ -220,7 +243,9 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
         * @throws      NoListGroupException    If the given group is not found
         */
        public function removeEntry ($groupName, $entry) {
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.'('.$this->__toString().'): '.$groupName . ' - START');
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - CALLED!');
+
                // Is the group already added?
                if (!$this->isGroupSet($groupName)) {
                        // Throw the exception here
@@ -229,14 +254,18 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
 
                // Generate hash
                $hash = $this->generateHash($groupName, $groupName, $entry);
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-LIST[' . __METHOD__ . ':' . __LINE__ . ']:  groupName=' . $groupName . ', entry=' . $entry . ', hash=' . $hash);
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . $entry . ', hash=' . $hash);
 
                // Remove it from the list ...
                unset($this->listEntries[$hash]);
 
                // ... and hash list as well
                unset($this->listIndex[array_search($hash, $this->listIndex)]);
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.'('.$this->__toString().'): '.$groupName . ' - FINISHED');
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ' - EXIT!');
        }
 
        /**
@@ -390,7 +419,7 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
         * @return      $entries        The array with all entries
         * @throws      NoListGroupException    If the specified group is invalid
         */
-       public function getArrayFromGroup ($groupName) {
+       public function getArrayFromProtocolInstance ($groupName) {
                // Is the group valid?
                if (!$this->isGroupSet($groupName)) {
                        // Throw the exception here
@@ -448,5 +477,5 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable {
        }
 }
 
-//
+// [EOF]
 ?>