Debug mailer finished and debug messages removed:
[shipsimu.git] / application / ship-simu / main / companies / class_ShippingCompany.php
index 18c0e747a69156965e76c284b398d574be9a514f..a7f12ef410e559594d6730f2b07a8ad5088e0e44 100644 (file)
@@ -4,9 +4,9 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @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
+ * @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
@@ -19,7 +19,7 @@
  * 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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class ShippingCompany extends BaseSimulator implements Customer, ContractPartner {
        /**
@@ -38,14 +38,14 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        private $founderInstance = null;
 
        /**
-        * Employed people by this company
+        * Headquarter harbor instance
         */
-       private $employeeList    = null;
+       private $hqInstance      = null;
 
        /**
-        * Headquarter harbor instance
+        * Employed people by this company
         */
-       private $hqInstance      = null;
+       private $employeeList    = null;
 
        /**
         * List of all assigned shipyards
@@ -62,101 +62,167 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
         */
        private $contractList    = null;
 
+       // Exception constants
+       const EXCEPTION_USER_OWNS_NO_COMPANY = 0x200;
+
        /**
-        * Main constructor
+        * Protected constructor
         *
         * @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.<br />\n",
-                               __CLASS__,
-                               __LINE__
-                       ));
-               }
+               parent::__construct(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Reederei");
+               $this->setObjectDescription("A shipping company class");
 
                // Generate unique ID number
-               $this->createUniqueID();
+               $this->generateUniqueId();
 
                // Clean up a little
                $this->removeSystemArray();
        }
 
-       // Reederei gruenden (create wegen Namenskonvention)
-       public final static function createShippingCompany ($companyName, Harbor $hqInstance) {
+       /**
+        * Creates an instance of this company class or throws an exception if the
+        * given user owns no company.
+        *
+        * @param       $userInstance           A user class
+        * @return      $companyInstance        Prepared company instance
+        */
+       public final static function createShippingCompany (BaseUser $userInstance) {
                // 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",
-                       __CLASS__,
-                       __LINE__,
-                       $companyName
-               ));
+               // Does the given user owns a company?
+               if ($companyInstance->ifUserParticipatesInCompany($userInstance)) {
+                       // Then do some nastly caching here but don't throw an exception
+                       // because then you will hurt our web helpers... :/
+                       $companyInstance->partialStub("Don&#39;t throw exceptions here.");
+               } // END - if
 
-               // Firmennamen setzen
-               $companyInstance->setCompanyName($companyName);
+               // Init all lists
+               $companyInstance->initCompanyLists();
 
-               // Kuerzel setzen
-               $companyInstance->createShortName();
+               // Return instance
+               return $companyInstance;
+       }
 
-               // Sitz festlegen
-               $companyInstance->setHQInstance($hqInstance);
+       /**
+        * Checks wether the given user participates in a company
+        *
+        * @param       $userInstance   An instance of a user class
+        * @return      $participates   Wether the user participates at lease in one company
+        */
+       protected function ifUserParticipatesInCompany (BaseUser $userInstance)  {
+               // By default no user owns any company... ;)
+               $participates = false;
 
-               // Werftenliste erstellen
-               $companyInstance->createshipyardList();
+               // Get a company database wrapper class
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class');
 
-               // Angestellten-Liste erstellen
-               $companyInstance->createEmployeeList();
+               // Ask the wrapper if this user participates
+               $participates = $wrapperInstance->ifUserParticipatesInCompany($userInstance);
 
-               // Auftragsliste erstellen
-               $companyInstance->createContractList();
+               // Get the result instance
+               $resultInstance = $wrapperInstance->getResultInstance();
 
-               // Clean up a little
-               $companyInstance->removeWidth();
-               $companyInstance->removeHeight();
-               $companyInstance->removeLength();
-               $companyInstance->removeDraught();
-               $companyInstance->removePartInstance();
+               // Caches the result instance here, if set (we don't the wrapper anymore!)
+               if ($resultInstance instanceof SearchableResult) {
+                       // Set the result instance
+                       $this->setResultInstance($resultInstance);
+               } // END - if
 
-               // Instanz zurueckgeben
-               return $companyInstance;
+               // Return result
+               return $participates;
        }
 
-       // Angestellten-Liste erstellen
-       private function createEmployeeList () {
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt eine Angestelltenliste.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $this->getCompanyName()
-               ));
-               $this->employeeList = new FrameworkArrayObject();
+       /**
+        * Checks wether the current user in registry is the company founder
+        *
+        * @return      $isFounder      Wether the current user is the company founder
+        */
+       public function ifUserIsFounder () {
+               // Default is not the founder
+               $isFounder = false;
+
+               // Get result instance
+               $resultInstance = $this->getResultInstance();
+
+               // Is it set?
+               if ($resultInstance instanceof SearchableResult) {
+                       // Result found so analyse it
+                       $this->partialStub("Check if user is company founder.");
+               } // END - if
+
+               // Return result
+               return $isFounder;
        }
 
-       // Werftenliste erstellen
-       public function createShipyardList () {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt eine Werftsliste.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $this->getCompanyName()
-               ));
-               $this->shipyardList = new FrameworkArrayObject();
+       /**
+        * Checks wether the current user in registry is the company owner
+        *
+        * @return      $isOwner        Wether the current user is the company owner
+        */
+       public function ifUserIsOwner () {
+               // Default is not the owner
+               $isOwner = false;
+
+               // Get result instance
+               $resultInstance = $this->getResultInstance();
+
+               // Is it set?
+               if ($resultInstance instanceof SearchableResult) {
+                       // Result found so analyse it
+                       $this->partialStub("Check if user is company owner.");
+               } // END - if
+
+               // Return result
+               return $isOwner;
        }
 
-       // Auftragsliste erstellen
-       public function createContractList () {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt eine Auftragsliste.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $this->getCompanyName()
-               ));
-               $this->contractList = new FrameworkArrayObject();
+       /**
+        * Checks wether the current user in registry is an employee in this company
+        *
+        * @return      $isOwner        Wether the current user is an employee in this company
+        */
+       public function ifUserIsEmployee () {
+               // Default is no employee
+               $isEmployee = false;
+
+               // Get result instance
+               $resultInstance = $this->getResultInstance();
+
+               // Is it set?
+               if ($resultInstance instanceof SearchableResult) {
+                       // Result found so he is employee
+                       $isEmployee = true;
+               } // END - if
+
+               // Return result
+               return $isEmployee;
+       }
+
+       //----------------------------------------------------------------------------
+       // From here is very old code which needs to be translated and changed heavily
+       //----------------------------------------------------------------------------
+
+       /**
+        * Intialize all lists
+        *
+        * @return      void
+        * @todo        Maybe we don't need these big lists anymore?! So we can deprecate/remove it
+        */
+       protected function initCompanyLists () {
+               // Employees
+               $this->employeeList = new FrameworkArrayObject("FakedEmployeeList");
+
+               // Ship yards
+               $this->shipyardList = new FrameworkArrayObject("FakedShipyardList");
+
+               // Contracts
+               $this->contractList = new FrameworkArrayObject("FakedContractList");
        }
 
        // Setter-Methode fuer Firmennamen
@@ -175,17 +241,17 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
        }
 
        // Kuerzel setzen
-       private function createShortName () {
+       private function initShortName () {
                // Mindestens eine Leerstelle?
                $dummy = explode(" ", $this->getCompanyName());
                foreach ($dummy as $part) {
                        $this->shortName .= substr($part, 0, 1);
-               }
+               } // END - if
        }
 
        // Reedereien Werften bauen lassen
        public function createShipyardInHarbor($shipyardName, Harbor $harborInstance) {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -206,13 +272,6 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Setter fuer Reederei-Gruender
        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__,
-                       $this->getCompanyName(),
-                       $founderInstance->getSurname(),
-                       $founderInstance->getFamily()
-               ));
                $this->founderInstance = $founderInstance;
        }
 
@@ -223,26 +282,11 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Neue(n) Angestellte(n) in Angestellten-Liste aufnehmen
        public function addNewEmployee (SimulatorPersonell $employeeInstance) {
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s %s</strong> tritt der Reederei <strong>%s</strong> als <strong>%s</strong> bei und erh&auml;lt ein Gehalt von <strong>%s</strong>.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $employeeInstance->getSurname(),
-                       $employeeInstance->getFamily(),
-                       $this->getCompanyName(),
-                       $employeeInstance->getPartDescr(),
-                       $this->formatCurrency($employeeInstance->getSalary())
-               ));
                $this->employeeList->append($employeeInstance);
        }
 
        // Neue Werft in Liste aufnehmen
        public function addNewShipyard (Shipyard $shipyardInstance) {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt die Werft <strong>%s</strong> hinzugef&uuml;gt.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $this->getCompanyName(),
-                       $shipyardInstance->getShipyardName()
-               ));
                $this->shipyardList->append($shipyardInstance);
        }
 
@@ -252,7 +296,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $amount = (int) $amount;
 
                // Debug-Meldung ausgeben
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt per Zufall <strong>%d</strong> neue Mitarbeiter ein.<br />\n",
+               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt per Zufall <strong>%d</strong> neue Mitarbeiter ein.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -266,7 +310,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                if ($totalUnemployed < $amount) {
                        // Reichte nicht aus!
                        throw new ToMuchEmployeesException(array($amount, $personellInstance->getAllUnemployed()), self::EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES);
-               }
+               } // END - if
 
                // Get list for all unemployed people
                $list = $personellInstance->getSpecialPersonellList(false); // Should be cached
@@ -301,12 +345,12 @@ 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?
 
                        // Debug message
-                       if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> ein.<br />\n",
+                       if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> ein.",
                                __CLASS__,
                                __LINE__,
                                $this->getCompanyName(),
@@ -322,7 +366,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $personellInstance->resetCache();
 
                // Debug-Meldung ausgeben
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat per Zufall <strong>%d</strong> neue Mitarbeiter eingestellt.<br />\n",
+               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat per Zufall <strong>%d</strong> neue Mitarbeiter eingestellt.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -332,7 +376,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Distribute all personells on all shipyards
        public function distributeAllPersonellOnShipyards () {
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> Werft(en).<br />\n",
+               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> Werft(en).",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -367,7 +411,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);
                        }
@@ -386,7 +430,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $total = $this->employeeList->count();
 
                // Debug message
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Mitarbeiter.<br />\n",
+               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Mitarbeiter.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -399,7 +443,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Getter for total shipyards
        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",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] F&uuml;r die Reederei <strong>%s</strong> werden die Anzahl der Werften in allen H&auml;fen ermittelt.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName()
@@ -415,7 +459,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $total = $this->shipyardList->count();
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Werft(en).<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Werft(en).",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -434,7 +478,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
@@ -444,11 +488,11 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                ));
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut in allen Werften bald Schiffe vom Typ <strong>%s</strong>.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut in allen Werften bald Schiffe vom Typ <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
-                       $shipInstance->getPartDescr()
+                       $shipInstance->getObjectDescription()
                ));
 
                // Iterate shipyard list
@@ -463,7 +507,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);
                        }
@@ -475,7 +519,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Validate the requested ship type with the company if they can construct it
        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",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> pr&uuml;ft den Bauauftrag der <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -498,12 +542,12 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $shipType = $shipInstance->__toString();
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> pr&uuml;ft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> pr&uuml;ft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
                        $contractInstance->getShipName(),
-                       $shipInstance->getPartDescr()
+                       $shipInstance->getObjectDescription()
                ));
 
                // Now check if the ship type is in any list and return the result
@@ -516,7 +560,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $shipType = (string) $shipType;
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> bauen k&ouml;nnen.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> bauen k&ouml;nnen.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -538,7 +582,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);
                        }
@@ -551,7 +595,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                }
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> bauen kann.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> bauen kann.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -564,11 +608,11 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // As a customer the shipping company can add new contracts
        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",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erstellt einen Bauauftrag f&uuml;r ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
-                       $contractInstance->getShipInstance()->getPartDescr(),
+                       $contractInstance->getShipInstance()->getObjectDescription(),
                        $contractInstance->getShipInstance()->getShipName()
                ));
                $this->contractList->append($contractInstance);
@@ -602,20 +646,20 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                // Determine if company "signs" own contract (must be done) or with an other party
                if ($this->equals($partnerInstance)) {
                        // With itself
-                       if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erteilt an sich selbst einen Bauauftrag f&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot;.<br />\n",
+                       if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erteilt an sich selbst einen Bauauftrag f&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot;.",
                                __CLASS__,
                                __LINE__,
                                $this->getCompanyName(),
-                               $contractInstance->getShipInstance()->getPartDescr(),
+                               $contractInstance->getShipInstance()->getObjectDescription(),
                                $contractInstance->getShipInstance()->getShipName()
                        ));
                } else {
                        // Other external company
-                       if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> unterzeichnet einen Bauauftrag f&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot; mit der <strong>%s</strong>.<br />\n",
+                       if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> unterzeichnet einen Bauauftrag f&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot; mit der <strong>%s</strong>.",
                                __CLASS__,
                                __LINE__,
                                $this->getCompanyName(),
-                               $contractInstance->getShipInstance()->getPartDescr(),
+                               $contractInstance->getShipInstance()->getObjectDescription(),
                                $contractInstance->getShipInstance()->getShipName(),
                                $partnerInstance->getCompanyName()
                        ));
@@ -646,7 +690,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);
                }
@@ -654,23 +698,6 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                // Set the merchant in the contract (for getting prices)
                $contractInstance->setMerchantInstance($merchantInstance);
        }
-
-       /**
-        * Stub!
-        */
-       public function saveObjectToDatabase () {
-               $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
-                       $this->__toString(),
-                       __FUNCTION__
-               ));
-       }
-
-       /**
-        * Limits this object with an ObjectLimits instance
-        */
-       public function limitObject (ObjectLimits $limitInstance) {
-               ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
-       }
 }
 
 // [EOF]