TODO: We should find something better than BaseFrameworkSystem as a type-hint
[shipsimu.git] / ship-simu / application / ship-simu / main / drives / class_BaseDrive.php
1 <?php
2
3 // Die abstrakte Antrieb-Klasse
4 class BaseDrive extends BaseSimulator {
5         // Price of this drive
6         private $price      = 0.00;
7         // PS-Zahl
8         private $horsePower = 0;
9         // Anzahl Nocken
10         private $numCams    = 0;
11
12         // Konstruktor
13         private function __construct ($class) {
14                 // Eltern-Konstruktor aufrufen
15                 parent::constructor($class);
16
17                 // Debug message
18                 if (((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
19                         $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\n",
20                                 __CLASS__,
21                                 __LINE__
22                         ));
23                 }
24
25                 // Beschreibung setzen
26                 $this->setPartDescr("Namenloser Antrieb");
27
28                 // Etwas aufraeumen
29                 $this->removeNumberFormaters();
30                 $this->removePartInstance();
31         }
32
33         // Konstruktor aufrufen
34         public function constructor ($class) {
35                 $this->__construct($class);
36         }
37
38         // Setter-Methode fuert PS-Zahl
39         public function setHorsePower ($hp) {
40                 if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Antriebsleistung wird auf <strong>%d</strong> PS gesetzt.<br />\n",
41                         __CLASS__,
42                         __LINE__,
43                         $hp
44                 ));
45                 $this->horsePower = (int) $hp;
46         }
47
48         // Setter-Methode fuer Nockenanzahl
49         public function setNumCams ($cams) {
50                 if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Nockenanzahl wird auf <strong>%d</strong> Nocken gesetzt.<br />\n",
51                         __CLASS__,
52                         __LINE__,
53                         $cams
54                 ));
55                 $this->numCams = (int) $cams;
56         }
57
58         // Setter for price
59         public function setPrice ($price) {
60                 $this->price = (float) $price;
61         }
62
63         // Getter for price
64         public function getPrice () {
65                 return $this->price;
66         }
67
68         public function removePrice () {
69                 unset($this->price);
70         }
71 }
72
73 // [EOF]
74 ?>