X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=application%2Fship-simu%2Fmain%2Fclass_BaseSimulator.php;h=d26ea246fe2ed5e23f4165ff880bc52155a4f801;hp=ffdbc66179afa49418ac7b38e2f5294550d7495f;hb=b3d612dc053c999af135677df431f73d9d26154f;hpb=86553167136d11d44e1d938e964134c038785e3e diff --git a/application/ship-simu/main/class_BaseSimulator.php b/application/ship-simu/main/class_BaseSimulator.php index ffdbc66..d26ea24 100644 --- a/application/ship-simu/main/class_BaseSimulator.php +++ b/application/ship-simu/main/class_BaseSimulator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -46,9 +46,6 @@ class BaseSimulator extends BaseFrameworkSystem { // Call highest constructor parent::__construct($className); - // Set part description and class name - $this->setObjectDescription("Simulator-Basis-Einheit"); - // Clean up a little, dies sollte ganz zum Schluss erfolgen! $this->removeResizeFactorArray(); $this->removeCurrPart(); @@ -57,52 +54,31 @@ class BaseSimulator extends BaseFrameworkSystem { // Setter-Methode fuer Laenge public final function setLength ($length) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] %dm Länge gesetzt.
\n", - $this->__toString(), - $length - )); $this->length = (float) $length; } // Setter-Methode fuer Breite public final function setWidth ($width) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] %dm Breite gesetzt.
\n", - $this->__toString(), - $width - )); $this->width = (float) $width; } // Setter-Methode fuer Hoehe public final function setHeight ($height) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] %dm Höhe gesetzt.
\n", - $this->__toString(), - $height - )); $this->height = (float) $height; } // Getter-Methode fuer Laenge public final function getLength () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge angefordert.
\n", - $this->__toString() - )); return $this->length; } // Getter-Methode fuer Breite public final function getWidth () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge angefordert.
\n", - $this->__toString() - )); return $this->width; } // Getter-Methode fuer Hoehe public final function getHeight () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Höhe angefordert.
\n", - $this->__toString() - )); return $this->height; } @@ -121,18 +97,7 @@ class BaseSimulator extends BaseFrameworkSystem { // Remover-Methode fuer die Teil-Instanz public final function removePartInstance () { - if ($this->getPartInstance() !== null) { - // Warnung ausgeben - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] partInstance ist nicht null! Instanz-Attribut wird nicht entfernt.
\n", - $this->__toString() - )); - } else { - // Leere Instanz kann entfernt werden - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] partInstance wurde entfernt.
\n", - $this->__toString() - )); - unset($this->partInstance); - } + unset($this->partInstance); } // Prueft ob all Umberechnungsfaktoren gesetzt sind @@ -149,22 +114,8 @@ class BaseSimulator extends BaseFrameworkSystem { $this->currShip = $shipInstance; $this->currPart = $partInstance; - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Maschinenraum mit Motor %s wird fuer das Schiff %s konstruiert.
\n", - $this->__toString(), - $this->getCurrPart()->getObjectDescription(), - $this->currShip->getShipName() - )); - // Passt ueberhaupt das Schiffsteil in's Schiff? if ($this->isShipPartSizeValid()) { - // Berechnungen fuer umliegendes Objekt anpassen - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Das Schiffsteil %s vom Typ %s passt in das Schiff %s hinein.
\n", - $this->__toString(), - $this->getCurrPart()->getObjectDescription(), - $this->getCurrPart()->__toString(), - $this->currShip->getShipName() - )); - // Muessen die Masse angepasst werden? if ($this->isResizeFactorValid()) { // Neue Angaben berechnen (wir lassen etwas Lust fuer Kabelbaeume, Roehren, Maschinisten, etc.) @@ -175,11 +126,6 @@ class BaseSimulator extends BaseFrameworkSystem { // Passt dies nun immer noch? if ($this->isNewSizeValid()) { // Das passt auch, dann Werte setzen und Motor-Instanz merken - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Das Schiffsteil %s passt in das Schiff %s hinein.
\n", - $this->__toString(), - $this->getObjectDescription(), - $this->currShip->getShipName() - )); $this->setWidth($this->newWidth); $this->setHeight($this->newHeight); $this->setLength($this->newLength); @@ -203,12 +149,6 @@ class BaseSimulator extends BaseFrameworkSystem { // Existiert ein Schiffsteil? if (!is_null($this->currPart)) { - // Debug-Meldung ausgeben - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Schiffsteil %s gefunden.
\n", - $this->getCurrPart()->realClass, - $this->getCurrPart()->getObjectDescription() - )); - // Schiffsteil-Instanz setzen $this->setPartInstance($this->currPart); @@ -235,9 +175,6 @@ class BaseSimulator extends BaseFrameworkSystem { // Array fuer Umrechnungstabelle entfernen public final function removeResizeFactorArray () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeResizeFactor erreicht.
\n", - $this->__toString() - )); unset($this->resizeFactorArray); } @@ -258,82 +195,52 @@ class BaseSimulator extends BaseFrameworkSystem { * @return void */ public final function removeCurrShip () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrShip erreicht.
\n", - $this->__toString() - )); unset($this->currShip); } // Aktuelle Schiffsteil-Instanz entfernen public final function removeCurrPart () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrPart erreicht.
\n", - $this->__toString() - )); unset($this->currPart); } // Breite entfernen public final function removeWidth () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Breite entfernt.
\n", - $this->__toString() - )); unset($this->width); } // Hoehe entfernen public final function removeHeight () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Höhe entfernt.
\n", - $this->__toString() - )); unset($this->height); } // Laenge entfernen public final function removeLength () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge entfernt.
\n", - $this->__toString() - )); unset($this->length); } // Tiefgang entfernen public final function removeDraught () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Tiefgang entfernt.
\n", - $this->__toString() - )); unset($this->draught); } // Getter-Methode fuer Element aus resizeFactor public final function getResizeFactorElement ($el) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] getResizeFactorElement erreicht. (element=%s)
\n", - $this->__toString(), - $el - )); if (isset($this->resizeFactorArray[$el])) { // Element gefunden return $this->resizeFactorArray[$el]; } else { // Element nicht gefunden! - return 0; + return null; } } // Setter-Methode fuer Element in resizeFactor public final function setResizeFactorElement ($el, $value) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Umberechnungsfaktor %s=%s gesetzt.
\n", - $this->__toString(), - $el, - $value - )); $this->resizeFactorArray[$el] = (float) $value; } // Kontrolliert, ob die Abmasse Schiffsteil->Schiff stimmen public function isShipPartSizeValid () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] isShipPartSizeValid erreicht.
\n", - $this->__toString() - )); return ( ( ( // Already defined ship messurings @@ -354,9 +261,6 @@ class BaseSimulator extends BaseFrameworkSystem { // Kontrolliert, ob die Abmasse Maschinenraum->Schiff stimmen public function isNewSizeValid () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] isNewSizeValid erreicht.
\n", - $this->__toString() - )); return ( ( // Already defined ship messurings ($this->newWidth < $this->currShip->getWidth()) @@ -372,11 +276,6 @@ class BaseSimulator extends BaseFrameworkSystem { // Masse extrahieren public function extractDimensions ($dim) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] extractDimensions erreicht für %s.
\n", - $this->__toString(), - $this->getObjectDescription() - )); - // Abmasse setzen if ((isset($dim)) && (is_array($dim)) && (count($dim) == 3)) { // Abmasse aus Array holen