]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/companies/class_ShippingCompany.php
getter, setter are all final; several code clean-ups
[shipsimu.git] / application / ship-simu / main / companies / class_ShippingCompany.php
index bac3bbfecd0eab85144a2aa8590c7e51b7616ba2..3fca7ead55b1f29b18f3b59c672bc25daf197eaf 100644 (file)
@@ -2,31 +2,51 @@
 
 // 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__);
@@ -51,7 +71,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // 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&uuml;ndet.<br />\n",
@@ -78,7 +98,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                // Auftragsliste erstellen
                $companyInstance->createContractList();
 
-               // Etwas aufraeumen
+               // Clean up a little
                $companyInstance->removeWidth();
                $companyInstance->removeHeight();
                $companyInstance->removeLength();
@@ -120,17 +140,17 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // 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;
        }
 
@@ -165,7 +185,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // 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&uuml;ndet worden.<br />\n",
                        __CLASS__,
                        __LINE__,
@@ -177,7 +197,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // Getter for founder instance
-       public function getFounderInstance () {
+       public final function getFounderInstance () {
                return $this->founderInstance;
        }
 
@@ -327,7 +347,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        } 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);
                        }
@@ -341,7 +361,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // Getter for total employees
-       public function getTotalEmployee () {
+       public final function getTotalEmployee () {
                // Count all...
                $total = $this->employeeList->count();
 
@@ -358,7 +378,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // 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&uuml;r die Reederei <strong>%s</strong> werden die Anzahl der Werften in allen H&auml;fen ermittelt.<br />\n",
                        __CLASS__,
                        __LINE__,
@@ -423,7 +443,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        } 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);
                        }
@@ -498,7 +518,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        } 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);
                        }
@@ -540,7 +560,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // Get latest added contract instance
-       public function getLastContractInstance () {
+       public final function getLastContractInstance () {
                // Get iterator
                $iter = $this->contractList->getIterator();
 
@@ -596,7 +616,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // Setter for merchant instance
-       public function setMerchantInstance (Merchant $merchantInstance) {
+       public final function setMerchantInstance (Merchant $merchantInstance) {
                // Get contract
                $contractInstance = $this->getLastContractInstance();
 
@@ -606,7 +626,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                } 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);
                }