class_BaseCabinStructure.php
Go to the documentation of this file.00001 <?php
00024 class BaseCabinStructure extends BaseStructure {
00025
00026
00027 private $numCabin = 0;
00028
00029
00030 private $numRooms = 0;
00031
00032
00033 private $numBeds = 0;
00034
00035
00036 protected function __construct ($className) {
00037
00038 parent::__construct($className);
00039 }
00040
00041
00042 public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $cabinInstance) {
00043
00044 parent::addShipPartToShip ($shipInstance, $cabinInstance);
00045
00046
00047 $this->setNumCabin($cabinInstance->numCabin);
00048 $this->setNumRooms($cabinInstance->numRooms);
00049 $this->setNumBeds($cabinInstance->numBeds);
00050
00051
00052 $cabinInstance->removeNumCabin();
00053 $cabinInstance->removeNumRooms();
00054 $cabinInstance->removeNumBeds();
00055
00056
00057 $this->setDeckInstance($cabinInstance);
00058 }
00059
00060
00061 public final function setDeckInstance ($deck) {
00062 parent::setPartInstance($deck);
00063 }
00064
00065
00066 public final function getNumBeds () {
00067 return $this->numBeds;
00068 }
00069
00070
00071 public final function getNumCabin () {
00072 return $this->numCabin;
00073 }
00074
00075
00076 public final function setNumBeds ($numBeds) {
00077 $this->numBeds = $numBeds;
00078 }
00079
00080
00081 public final function setNumRooms ($numRooms) {
00082 $this->numRooms = $numRooms;
00083 }
00084
00085
00086 public final function setNumCabin ($numCabin) {
00087 $this->numCabin = $numCabin;
00088 }
00089
00090
00091 public final function removeNumBeds() {
00092 unset($this->numBeds);
00093 }
00094
00095
00096 public final function removeNumCabin() {
00097 unset($this->numCabin);
00098 }
00099
00100
00101 public final function removeNumRooms() {
00102 unset($this->numRooms);
00103 }
00104
00105
00106 public function calcTotalBedsByCabin () {
00107
00108 $beds = $this->getNumBeds();
00109 $num = $this->getNumCabin();
00110 $cabinBeds = $beds * $num;
00111 if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) {
00112
00113 $cabType = "Kabine ohne Namen";
00114 $cab = $this->getPartInstance();
00115 if (!is_null($cab)) {
00116
00117 $cabType = $cab->__toString();
00118 }
00119
00120
00121 $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.",
00122 __CLASS__,
00123 __LINE__,
00124 $num,
00125 $cabType,
00126 $beds,
00127 $cabinBeds
00128 ));
00129 }
00130 return $cabinBeds;
00131 }
00132 }
00133
00134
00135 ?>