]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/companies/class_ShippingCompany.php
New interface SignableContract introduced, some comments translated
[shipsimu.git] / application / ship-simu / main / companies / class_ShippingCompany.php
index 54b3e285cd0c246ae684e56506ced4b45d525592..bac3bbfecd0eab85144a2aa8590c7e51b7616ba2 100644 (file)
@@ -28,7 +28,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Konstruktor
        private function __construct () {
-               // Eltern-Konstruktor aufrufen
+               // Call parent constructor
                parent::constructor(__CLASS__);
 
                // Debug message
@@ -39,10 +39,10 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        ));
                }
 
-               // Beschreibung setzen
+               // Set description
                $this->setPartDescr("Reederei");
 
-               // Unique-ID erzeugen
+               // Generate unique ID number
                $this->createUniqueID();
 
                // Clean up a little
@@ -52,7 +52,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        // Reederei gruenden (create wegen Namenskonvention)
        public static function createShippingCompany ($companyName, Harbor $hqInstance) {
                // Instanz holen
-               $companyInstance = new ShippingCompany();               
+               $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",
                        __CLASS__,
@@ -251,7 +251,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                                        // Element holen
                                        $employee = $iterator->current();
                                } else {
-                                       // Should normally not happen... :(
+                                       // Shouldnormally not happen... :(
                                        throw new StructuresOutOfBoundsException($idx, self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
                                }
                        }
@@ -434,7 +434,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // Validate the requested ship type with the company if they can construct it
-       public function validateWorksContractShipType (WorksContract $contractInstance) {
+       public function validateWorksContractShipType (SignableContract $contractInstance) {
                if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> pr&uuml;ft den Bauauftrag der <strong>%s</strong>.<br />\n",
                        __CLASS__,
                        __LINE__,
@@ -506,7 +506,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        // Validate if the first found shipyard can construct the requested type
                        $result = $shipyard->isShipTypeConstructable($shipType);
 
-                       // Does this shipyard construct the requested ship type?
+                       //Does this shipyard construct the requested ship type?
                        if ($result) break; // Then abort the search!
                }
 
@@ -523,7 +523,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // As a customer the shipping company can add new contracts
-       public function addNewWorksContract (WorksContract $contractInstance) {
+       public function addNewWorksContract (SignableContract $contractInstance) {
                if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erstellt einen Bauauftrag f&uuml;r ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.<br />\n",
                        __CLASS__,
                        __LINE__,
@@ -535,7 +535,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // As a customer the shippng company can withdraw from a contract
-       public function withdrawFromContract (WorksContract $contractInstance) {
+       public function withdrawFromContract (SignableContract $contractInstance) {
                ApplicationEntryPoint::app_die("WITHDRAW:<pre>".print_r($contractInstance, true)."</pre>");
        }
 
@@ -552,12 +552,13 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // Sign a contract with an other party which must also implement Customer
-       public function signContract (WorksContract $contractInstance, ContractPartner $partnerInstance) {
+       public function signContract (SignableContract $contractInstance, ContractPartner $partnerInstance) {
+               // Check wether the other party is our contract partner
                if (!$partnerInstance->isContractPartner($contractInstance)) {
                        // Invalid contract partner!
                        throw new InvalidContractPartnerException($partnerInstance, self::EXCEPTION_CONTRACT_PARTNER_INVALID);
                }
-               
+
                // Determine if company "signs" own contract (must be done) or with an other party
                if ($this->equals($partnerInstance)) {
                        // With itself
@@ -589,7 +590,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // Is this the right contract partner?
-       public function isContractPartner (WorksContract $contractInstance) {
+       public function isContractPartner (SignableContract $contractInstance) {
                // Get contract partner instance and compare it with $this contract partner
                return ($this->equals($contractInstance->getContractPartner()));
        }