// Die Reederei-Klasse
class ShippingCompany extends BaseSimulator implements Customer, ContractPartner {
- // Firmenname
+ /**
+ * Full name of this company
+ */
private $companyName = "Namenlose Reederei";
- // Firmenkuerzel
+ /**
+ * Shorted name of this company
+ */
private $shortName = "";
- // Reederei-Gruender
+ /**
+ * Instance of the founder
+ */
private $founderInstance = null;
- // Angestellten-Liste
+ /**
+ * Employed people by this company
+ */
private $employeeList = null;
- // Zugewiesener Hafen
+ /**
+ * Headquarter harbor instance
+ */
private $hqInstance = null;
- // Werftenliste
+ /**
+ * List of all assigned shipyards
+ */
private $shipyardList = null;
- // Der Reederei gehoerenden Schiffe
+ /**
+ * List of owned ships
+ */
private $ownedShips = null;
- // Bauauftraege als Kunde
+ /**
+ * Work constracts this company is currently working on
+ */
private $contractList = null;
- // Konstruktor
+ /**
+ * Main constructor
+ *
+ * @return void
+ */
private function __construct () {
// Call parent constructor
parent::constructor(__CLASS__);
// Reederei gruenden (create wegen Namenskonvention)
public static function createShippingCompany ($companyName, Harbor $hqInstance) {
- // Instanz holen
+ // Get new instance
$companyInstance = new ShippingCompany();
if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $companyInstance->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> wird gegründet.<br />\n",
// Auftragsliste erstellen
$companyInstance->createContractList();
- // Etwas aufraeumen
+ // Clean up a little
$companyInstance->removeWidth();
$companyInstance->removeHeight();
$companyInstance->removeLength();
}
// Setter-Methode fuer Firmennamen
- public function setCompanyName ($companyName) {
+ public final function setCompanyName ($companyName) {
$this->companyName = (string) $companyName;
}
// Getter-Methode fuer Firmennamen
- public function getCompanyName () {
+ public final function getCompanyName () {
return $this->companyName;
}
// Setter-Methode fuer Firmensitz
- public function setHQInstance (Harbor $hqInstance) {
+ public final function setHQInstance (Harbor $hqInstance) {
$this->hqInstance = $hqInstance;
}
}
// Setter fuer Reederei-Gruender
- public function setCompanyFounder(CompanyEmployee $founderInstance) {
+ public final function setCompanyFounder(CompanyEmployee $founderInstance) {
if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> ist von <strong>%s %s</strong> gegründet worden.<br />\n",
__CLASS__,
__LINE__,
}
// Getter for founder instance
- public function getFounderInstance () {
+ public final function getFounderInstance () {
return $this->founderInstance;
}
} elseif (!is_object($shipyard)) {
// Not an object! ;-(
throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!$shipyard->isClass("Shipyard")) {
+ } elseif (!$shipyard->isSameClass("Shipyard")) {
// Nope, so throw exception
throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
}
}
// Getter for total employees
- public function getTotalEmployee () {
+ public final function getTotalEmployee () {
// Count all...
$total = $this->employeeList->count();
}
// Getter for total shipyards
- public function getTotalShipyards () {
+ public final function getTotalShipyards () {
if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Für die Reederei <strong>%s</strong> werden die Anzahl der Werften in allen Häfen ermittelt.<br />\n",
__CLASS__,
__LINE__,
} elseif (!is_object($shipyard)) {
// Not an object! ;-(
throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!$shipyard->isClass("Shipyard")) {
+ } elseif (!$shipyard->isSameClass("Shipyard")) {
// Class is not a shipyard
throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
}
} elseif (!is_object($shipyard)) {
// Not an object! ;-(
throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!$shipyard->isClass("Shipyard")) {
+ } elseif (!$shipyard->isSameClass("Shipyard")) {
// Class is not a shipyard
throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
}
}
// Get latest added contract instance
- public function getLastContractInstance () {
+ public final function getLastContractInstance () {
// Get iterator
$iter = $this->contractList->getIterator();
}
// Setter for merchant instance
- public function setMerchantInstance (Merchant $merchantInstance) {
+ public final function setMerchantInstance (Merchant $merchantInstance) {
// Get contract
$contractInstance = $this->getLastContractInstance();
} elseif (!is_object($contractInstance)) {
// Not an object! ;-(
throw new NoObjectException($contractInstance, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!$contractInstance->isClass('WorksContract')) {
+ } elseif (!$contractInstance->isSameClass('WorksContract')) {
// Is not a merchant
throw new ClassMismatchException(array($contractInstance->__toString(), "WorksContract"), self::EXCEPTION_CLASSES_NOT_MATCHING);
}