X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fship-simu%2Fmain%2Fcompanies%2Fclass_ShippingCompany.php;h=dec3a3228f0316d3467e2536b03d8f15df224b4f;hb=3d9c48e0066be8f20fa08f8517f9cbb943504de5;hp=3fca7ead55b1f29b18f3b59c672bc25daf197eaf;hpb=a76d51b4096b47436e269156547f02713d95af5b;p=shipsimu.git diff --git a/application/ship-simu/main/companies/class_ShippingCompany.php b/application/ship-simu/main/companies/class_ShippingCompany.php index 3fca7ea..dec3a32 100644 --- a/application/ship-simu/main/companies/class_ShippingCompany.php +++ b/application/ship-simu/main/companies/class_ShippingCompany.php @@ -1,6 +1,26 @@ + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner { /** * Full name of this company @@ -47,20 +67,12 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) { - $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Reederei"); + $this->setObjectDescription("Reederei"); // Generate unique ID number $this->createUniqueID(); @@ -70,7 +82,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner } // Reederei gruenden (create wegen Namenskonvention) - public static function createShippingCompany ($companyName, Harbor $hqInstance) { + public final static function createShippingCompany ($companyName, Harbor $hqInstance) { // Get new instance $companyInstance = new ShippingCompany(); @@ -209,7 +221,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner $employeeInstance->getSurname(), $employeeInstance->getFamily(), $this->getCompanyName(), - $employeeInstance->getPartDescr(), + $employeeInstance->getObjectDescription(), $this->formatCurrency($employeeInstance->getSalary()) )); $this->employeeList->append($employeeInstance); @@ -271,7 +283,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner // Element holen $employee = $iterator->current(); } else { - // Should�normally not happen... :( + // Should normally not happen... :( throw new StructuresOutOfBoundsException($idx, self::EXCEPTION_INDEX_OUT_OF_BOUNDS); } } @@ -281,7 +293,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner // Make this person employed and give him some money to work $employee->setEmployed(true); - $employee->setPartDescr($dummy->getPartDescr()); + $employee->setObjectDescription($dummy->getObjectDescription()); $employee->setRealClass($dummy->__toString()); $employee->increaseSalary((mt_rand(7, 14) * 100)); // Are 700 to 1400 EUR for the begin okay? @@ -347,7 +359,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->isSameClass("Shipyard")) { + } elseif (!$shipyard->isClass("Shipyard")) { // Nope, so throw exception throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); } @@ -414,7 +426,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner // Is the class there? if (!class_exists($shipType)) { // Throw exception - throw new ClassNotFoundException($shipType, 0); + throw new ClassNotFoundException($shipType, self::EXCEPTION_CLASS_NOT_FOUND); } // Create dummy ship @@ -428,7 +440,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner __CLASS__, __LINE__, $this->getCompanyName(), - $shipInstance->getPartDescr() + $shipInstance->getObjectDescription() )); // Iterate shipyard list @@ -443,7 +455,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->isSameClass("Shipyard")) { + } elseif (!$shipyard->isClass("Shipyard")) { // Class is not a shipyard throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); } @@ -483,7 +495,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner __LINE__, $this->getCompanyName(), $contractInstance->getShipName(), - $shipInstance->getPartDescr() + $shipInstance->getObjectDescription() )); // Now check if the ship type is in any list and return the result @@ -518,7 +530,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->isSameClass("Shipyard")) { + } elseif (!$shipyard->isClass("Shipyard")) { // Class is not a shipyard throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); } @@ -526,7 +538,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! } @@ -548,7 +560,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner __CLASS__, __LINE__, $this->getCompanyName(), - $contractInstance->getShipInstance()->getPartDescr(), + $contractInstance->getShipInstance()->getObjectDescription(), $contractInstance->getShipInstance()->getShipName() )); $this->contractList->append($contractInstance); @@ -586,7 +598,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner __CLASS__, __LINE__, $this->getCompanyName(), - $contractInstance->getShipInstance()->getPartDescr(), + $contractInstance->getShipInstance()->getObjectDescription(), $contractInstance->getShipInstance()->getShipName() )); } else { @@ -595,7 +607,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner __CLASS__, __LINE__, $this->getCompanyName(), - $contractInstance->getShipInstance()->getPartDescr(), + $contractInstance->getShipInstance()->getObjectDescription(), $contractInstance->getShipInstance()->getShipName(), $partnerInstance->getCompanyName() )); @@ -626,7 +638,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->isSameClass('WorksContract')) { + } elseif (!$contractInstance->isClass('WorksContract')) { // Is not a merchant throw new ClassMismatchException(array($contractInstance->__toString(), "WorksContract"), self::EXCEPTION_CLASSES_NOT_MATCHING); }