}
// Remover-Methode fuer die Teil-Instanz
- public function removePartInstance () {
+ 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.<br />\n",
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Maschinenraum mit Motor <strong>%s</strong> wird fuer das Schiff <strong>%s</strong> konstruiert.<br />\n",
$this->__toString(),
- $this->currPart->getPartDescr(),
+ $this->getCurrPart()->getPartDescr(),
$this->currShip->getShipName()
));
// Berechnungen fuer umliegendes Objekt anpassen
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Das Schiffsteil <strong>%s</strong> vom Typ <strong>%s</strong> passt in das Schiff <strong>%s</strong> hinein.<br />\n",
$this->__toString(),
- $this->currPart->getPartDescr(),
- $this->currPart->__toString(),
+ $this->getCurrPart()->getPartDescr(),
+ $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.)
- $this->newWidth = (float) $this->currPart->getWidth() * $this->resizeFactorArray['width'];
- $this->newHeight = (float) $this->currPart->getHeight() * $this->resizeFactorArray['height'];
- $this->newLength = (float) $this->currPart->getLength() * $this->resizeFactorArray['length'];
+ $this->newWidth = (float) $this->getCurrPart()->getWidth() * $this->resizeFactorArray['width'];
+ $this->newHeight = (float) $this->getCurrPart()->getHeight() * $this->resizeFactorArray['height'];
+ $this->newLength = (float) $this->getCurrPart()->getLength() * $this->resizeFactorArray['length'];
// Passt dies nun immer noch?
if ($this->isNewSizeValid()) {
} else {
// Passt nicht! Also wieder Exception werfen...
throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil <strong>%s</strong> vom Typ <strong>%s</strong> ist zu gross für das Schiff!",
- $this->currPart->__toString(),
- $this->currPart->getPartDescr(),
- $this->currPart->__toString()
+ $this->getCurrPart()->__toString(),
+ $this->getCurrPart()->getPartDescr(),
+ $this->getCurrPart()->__toString()
), 2);
}
} elseif ($this->currPart != null) {
// Aktuelle Masse setzen
- $this->setWidth($this->currPart->getWidth());
- $this->setHeight($this->currPart->getHeight());
- $this->setLength($this->currPart->getLength());
+ $this->setWidth($this->getCurrPart()->getWidth());
+ $this->setHeight($this->getCurrPart()->getHeight());
+ $this->setLength($this->getCurrPart()->getLength());
}
// Existiert ein Schiffsteil?
if (!is_null($this->currPart)) {
// Debug-Meldung ausgeben
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Schiffsteil <strong>%s</strong> gefunden.<br />\n",
- $this->currPart->realClass,
- $this->currPart->getPartDescr()
+ $this->getCurrPart()->realClass,
+ $this->getCurrPart()->getPartDescr()
));
// Schiffsteil-Instanz setzen
$this->setPartInstance($this->currPart);
// Instanzen entfernen
- $this->currPart->removeCurrShip();
- $this->currPart->removeCurrPart();
- $this->currPart->removePartInstance();
- $this->currPart->removeResizeFactorArray();
+ $this->getCurrPart()->removeCurrShip();
+ $this->getCurrPart()->removeCurrPart();
+ $this->getCurrPart()->removePartInstance();
+ $this->getCurrPart()->removeResizeFactorArray();
}
} else {
// Exception werfen!
throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil <u>%s</u> vom Typ <u>%s</u> passt nicht in das Schiff!",
- $this->currPart->realClass,
- $this->currPart->getPartDescr(),
- $this->currPart->__toString()
+ $this->getCurrPart()->realClass,
+ $this->getCurrPart()->getPartDescr(),
+ $this->getCurrPart()->__toString()
), 1);
}
}
// Array fuer Umrechnungstabelle entfernen
- public function removeResizeFactorArray () {
+ public final function removeResizeFactorArray () {
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeResizeFactor erreicht.<br />\n",
$this->__toString()
));
*
* @return void
*/
- public function removeAllNewAttr () {
+ public final function removeAllNewAttr () {
unset($this->newWidth);
unset($this->newHeight);
unset($this->newLength);
*
* @return void
*/
- public function removeCurrShip () {
+ public final function removeCurrShip () {
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrShip erreicht.<br />\n",
$this->__toString()
));
}
// Aktuelle Schiffsteil-Instanz entfernen
- public function removeCurrPart () {
+ public final function removeCurrPart () {
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrPart erreicht.<br />\n",
$this->__toString()
));
}
// Breite entfernen
- public function removeWidth () {
+ public final function removeWidth () {
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Breite entfernt.<br />\n",
$this->__toString()
));
}
// Hoehe entfernen
- public function removeHeight () {
+ public final function removeHeight () {
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Höhe entfernt.<br />\n",
$this->__toString()
));
}
// Laenge entfernen
- public function removeLength () {
+ public final function removeLength () {
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge entfernt.<br />\n",
$this->__toString()
));
}
// Tiefgang entfernen
- public function removeDraught () {
+ public final function removeDraught () {
if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Tiefgang entfernt.<br />\n",
$this->__toString()
));
return (
(
( // Already defined ship messurings
- ($this->currPart->getWidth() < $this->currShip->getWidth())
- && ($this->currPart->getHeight() < $this->currShip->getDraught())
- && ($this->currPart->getLength() < $this->currShip->getLength())
+ ($this->getCurrPart()->getWidth() < $this->currShip->getWidth())
+ && ($this->getCurrPart()->getHeight() < $this->currShip->getDraught())
+ && ($this->getCurrPart()->getLength() < $this->currShip->getLength())
) || ( // Ship messurings shall be calculated
($this->currShip->getWidth() == 0)
&& ($this->currShip->getHeight() == 0)
&& ($this->currShip->getLength() == 0)
)
// The inserted part must be messured!
- ) && ($this->currPart->getWidth() > 0)
- && ($this->currPart->getHeight() > 0)
- && ($this->currPart->getLength() > 0)
+ ) && ($this->getCurrPart()->getWidth() > 0)
+ && ($this->getCurrPart()->getHeight() > 0)
+ && ($this->getCurrPart()->getLength() > 0)
);
}
throw new DimNotFoundInArrayException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID);
}
}
+
+ /**
+ * Getter for current part instance
+ *
+ * @return $currPart Instance of the current ship part object
+ */
+ public final function getCurrPart () {
+ return $this->currPart;
+ }
}
// [EOF]
/**
* Creates an instance of the class TemplateEngine and prepares it for usage
*
- * @param $basePath The local base path for all templates
- * @param $langInstance An instance of LanguageSystem (default)
- * @param $ioInstance An instance of FileIOHandler (default, middleware!)
+ * @param $basePath The local base path for all templates
+ * @param $langInstance An instance of LanguageSystem (default)
+ * @param $ioInstance An instance of FileIOHandler (default, middleware!)
* @return $tplInstance An instance of TemplateEngine
* @throws BasePathIsEmptyException If the provided $basePath is empty
* @throws InvalidBasePathStringException If $basePath is no string
* @throws BasePathIsNoDirectoryException If $basePath is no
- * directory or not found
+ * directory or not found
* @throws BasePathReadProtectedException If $basePath is
- * read-protected
+ * read-protected
*/
public final static function createTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIOHandler $ioInstance) {
// Get a new instance
/**
* Extract variables from a given raw data stream
*
- * @param $rawData The raw template data we shall analyze
+ * @param $rawData The raw template data we shall analyze
* @return void
* @throws InvalidTemplateVariableNameException If a variable name
- * in a template is
- * invalid
+ * in a template is
+ * invalid
*/
private function extractVariablesFromRawData ($rawData) {
// Cast to string
$this->assignVariable($var, $varMatches[3][$key]);
} else {
// Non-string found so we need some deeper analysis...
+ // @TODO Unfinished work or don't die here.
die("Deeper analysis not yet implemented!");
}