More renamed
[shipsimu.git] / application / ship-simu / main / structures / extended / class_BaseCabinStructure.php
index 7d7d7fb8a817b785ff508319eadf14fcb4e6ba8d..77a81ae4f42073b772989f40b694cd4702b0f865 100644 (file)
@@ -1,5 +1,26 @@
 <?php
-// Kabinen allgemein
+/**
+ * General cabin structure class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
 class BaseCabinStructure extends BaseStructure {
        // --- Besondere Eigenschaften dazufuegen: ---
        // Anzahl der Kabinen im Schiff
@@ -12,36 +33,13 @@ class BaseCabinStructure extends BaseStructure {
        private $numBeds = 0;
 
        // Konstruktor
-       private function __construct ($class) {
-               // Eltern-Konstruktor aufrufen
-               parent::constructor($class);
-
-               // Debug message
-               if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
-                       $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\n",
-                               __CLASS__,
-                               __LINE__
-                       ));
-               }
-
-               // Beschreibung setzen
-               $this->setPartDescr("Kabinenstruktur");
-       }
-
-       // Konstruktor aufrufen
-       public function constructor ($class) {
-               $this->__construct($class);
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
        }
 
        // Kabine hinzufuegen
        public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $cabinInstance) {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Kabine <strong>%s</strong> wird f&uuml;r das Schiff <strong>%s</strong> konstruiert.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $cabinInstance->getPartDescr(),
-                       $shipInstance->getShipName()
-               ));
-
                // Eltern-Methode aufrufen
                parent::addShipPartToShip ($shipInstance, $cabinInstance);
 
@@ -57,99 +55,50 @@ class BaseCabinStructure extends BaseStructure {
 
                // Instanz setzen
                $this->setDeckInstance($cabinInstance);
-
-               // Einbaut-Meldung ausgeben
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Kabine <strong>%s</strong> wurde in das Schiff eingebaut.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $cabinInstance->getPartDescr(),
-                       $shipInstance->getShipName()
-               ));
        }
 
        // Wrapper fuer setDeckInstance->setPartInstance
-       public function setDeckInstance ($deck) {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Wrapper setDeckInstance->setPartInstance erreicht.<br />\n",
-                       __CLASS__,
-                       __LINE__
-               ));
+       public final function setDeckInstance ($deck) {
                parent::setPartInstance($deck);
        }
 
        // Getter-Methode fuer Anzahl Betten
-       public function getNumBeds () {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%d</strong> Betten angefordert.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $this->numBeds
-               ));
+       public final function getNumBeds () {
                return $this->numBeds;
        }
 
        // Getter-Methode fuer Anzahl Kabinen
-       public function getNumCabin () {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%d</strong> Kabine(n) angefordert.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $this->numCabin
-               ));
+       public final function getNumCabin () {
                return $this->numCabin;
        }
 
        // Setter-Methode fuer Anzahl Betten
-       public function setNumBeds ($numBeds) {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%d</strong> Betten gesetzt.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $numBeds
-               ));
+       public final function setNumBeds ($numBeds) {
                $this->numBeds = $numBeds;
        }
 
        // Setter-Methode fuer Anzahl Raeume
-       public function setNumRooms ($numRooms) {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%d</strong> Raum/R&auml;ume gesetzt.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $numRooms
-               ));
+       public final function setNumRooms ($numRooms) {
                $this->numRooms = $numRooms;
        }
 
        // Setter-Methode fuer Anzahl Kabinen
-       public function setNumCabin ($numCabin) {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%d</strong> Kabine(n) gesetzt.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $numCabin
-               ));
+       public final function setNumCabin ($numCabin) {
                $this->numCabin = $numCabin;
        }
 
        // Loesch-Methode fuer Anzahl Betten
-       public function removeNumBeds() {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gel&ouml;scht.<br />\n",
-                       __CLASS__,
-                       __LINE__
-               ));
+       public final function removeNumBeds() {
                unset($this->numBeds);
        }
 
        // Loesch-Methode fuer Anzahl Kabinen
-       public function removeNumCabin() {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gel&ouml;scht.<br />\n",
-                       __CLASS__,
-                       __LINE__
-               ));
+       public final function removeNumCabin() {
                unset($this->numCabin);
        }
 
        // Loesch-Methode fuer Anzahl Raeume
-       public function removeNumRooms() {
-               if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl R&auml;ume gel&ouml;scht.<br />\n",
-                       __CLASS__,
-                       __LINE__
-               ));
+       public final function removeNumRooms() {
                unset($this->numRooms);
        }
 
@@ -160,7 +109,7 @@ class BaseCabinStructure extends BaseStructure {
                $num  = $this->getNumCabin();
                $cabinBeds = $beds * $num;
                if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) {
-                       // Instanz holen
+                       // Get new instance
                        $cabType = "Kabine ohne Namen";
                        $cab = $this->getPartInstance();
                        if (!is_null($cab)) {
@@ -169,7 +118,7 @@ class BaseCabinStructure extends BaseStructure {
                        }
 
                        // Debug-Meldung ausgeben
-                       $this->getDebugInstance()->output(sprintf("[%s:%d] Es exisitieren <strong>%d</strong> Kabinen vom Typ <strong>%s</strong> zu je <strong>%d</strong> Betten. Das sind <strong>%d</strong> Betten.<br />\n",
+                       $this->debugOutput(sprintf("[%s:%d] Es exisitieren <strong>%d</strong> Kabinen vom Typ <strong>%s</strong> zu je <strong>%d</strong> Betten. Das sind <strong>%d</strong> Betten.",
                                __CLASS__,
                                __LINE__,
                                $num,