]> git.mxchange.org Git - shipsimu.git/blobdiff - ship-simu/application/ship-simu/main/drives/class_BaseDrive.php
Initial import of current development status
[shipsimu.git] / ship-simu / application / ship-simu / main / drives / class_BaseDrive.php
diff --git a/ship-simu/application/ship-simu/main/drives/class_BaseDrive.php b/ship-simu/application/ship-simu/main/drives/class_BaseDrive.php
new file mode 100644 (file)
index 0000000..7ebef58
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+
+// Die abstrakte Antrieb-Klasse
+class BaseDrive extends BaseSimulator {
+       // Price of this drive
+       private $price      = 0.00;
+       // PS-Zahl
+       private $horsePower = 0;
+       // Anzahl Nocken
+       private $numCams    = 0;
+
+       // Konstruktor
+       private function __construct ($class) {
+               // Eltern-Konstruktor aufrufen
+               parent::constructor($class);
+
+               // Debug message
+               if (((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+                       $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\n",
+                               __CLASS__,
+                               __LINE__
+                       ));
+               }
+
+               // Beschreibung setzen
+               $this->setPartDescr("Namenloser Antrieb");
+
+               // Etwas aufraeumen
+               $this->removeNumberFormaters();
+               $this->removePartInstance();
+       }
+
+       // Konstruktor aufrufen
+       public function constructor ($class) {
+               $this->__construct($class);
+       }
+
+       // Setter-Methode fuert PS-Zahl
+       public function setHorsePower ($hp) {
+               if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Antriebsleistung wird auf <strong>%d</strong> PS gesetzt.<br />\n",
+                       __CLASS__,
+                       __LINE__,
+                       $hp
+               ));
+               $this->horsePower = (int) $hp;
+       }
+
+       // Setter-Methode fuer Nockenanzahl
+       public function setNumCams ($cams) {
+               if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Nockenanzahl wird auf <strong>%d</strong> Nocken gesetzt.<br />\n",
+                       __CLASS__,
+                       __LINE__,
+                       $cams
+               ));
+               $this->numCams = (int) $cams;
+       }
+
+       // Setter for price
+       public function setPrice ($price) {
+               $this->price = (float) $price;
+       }
+
+       // Getter for price
+       public function getPrice () {
+               return $this->price;
+       }
+
+       public function removePrice () {
+               unset($this->price);
+       }
+}
+
+// [EOF]
+?>