ad52dd2390a89c5b0a079e3dedb455f2a082aee5
[shipsimu.git] / 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                 // Call parent constructor
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                 // Set description
26                 $this->setPartDescr("Namenloser Antrieb");
27
28                 // Clean up a little
29                 $this->removeNumberFormaters();
30                 $this->removePartInstance();
31         }
32
33         /**
34          * Calls the private constructor
35          *
36          * @param       $class  The class' name
37          * @return      void
38          */
39         public function constructor ($class) {
40                 $this->__construct($class);
41         }
42
43         // Setter-Methode fuert PS-Zahl
44         public final function setHorsePower ($hp) {
45                 if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Antriebsleistung wird auf <strong>%d</strong> PS gesetzt.<br />\n",
46                         __CLASS__,
47                         __LINE__,
48                         $hp
49                 ));
50                 $this->horsePower = (int) $hp;
51         }
52
53         // Setter-Methode fuer Nockenanzahl
54         public final function setNumCams ($cams) {
55                 if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Nockenanzahl wird auf <strong>%d</strong> Nocken gesetzt.<br />\n",
56                         __CLASS__,
57                         __LINE__,
58                         $cams
59                 ));
60                 $this->numCams = (int) $cams;
61         }
62
63         // Setter for price
64         public final function setPrice ($price) {
65                 $this->price = (float) $price;
66         }
67
68         // Getter for price
69         public final function getPrice () {
70                 return $this->price;
71         }
72
73         public function removePrice () {
74                 unset($this->price);
75         }
76 }
77
78 // [EOF]
79 ?>