]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/companies/class_ShippingCompany.php
Fake class names added, insertDataSet() stub added, dataset criteria added
[shipsimu.git] / application / ship-simu / main / companies / class_ShippingCompany.php
index 18c0e747a69156965e76c284b398d574be9a514f..f7616b32a8545dcce9eaa53896ab2fa34b6e68a7 100644 (file)
@@ -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 {
        /**
@@ -67,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.<br />\n",
-                               __CLASS__,
-                               __LINE__
-                       ));
-               }
+               parent::__construct(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Reederei");
+               $this->setObjectDescription("Reederei");
 
                // Generate unique ID number
                $this->createUniqueID();
@@ -136,7 +128,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        __LINE__,
                        $this->getCompanyName()
                ));
-               $this->employeeList = new FrameworkArrayObject();
+               $this->employeeList = new FrameworkArrayObject("FakedEmployeeList");
        }
 
        // Werftenliste erstellen
@@ -146,7 +138,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        __LINE__,
                        $this->getCompanyName()
                ));
-               $this->shipyardList = new FrameworkArrayObject();
+               $this->shipyardList = new FrameworkArrayObject("FakedShipyardList");
        }
 
        // Auftragsliste erstellen
@@ -156,7 +148,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        __LINE__,
                        $this->getCompanyName()
                ));
-               $this->contractList = new FrameworkArrayObject();
+               $this->contractList = new FrameworkArrayObject("FakedContractList");
        }
 
        // Setter-Methode fuer Firmennamen
@@ -229,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);
@@ -301,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?
 
@@ -367,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);
                        }
@@ -434,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
@@ -448,7 +440,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
-                       $shipInstance->getPartDescr()
+                       $shipInstance->getObjectDescription()
                ));
 
                // Iterate shipyard list
@@ -463,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);
                        }
@@ -503,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
@@ -538,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);
                        }
@@ -568,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);
@@ -606,7 +598,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                                __CLASS__,
                                __LINE__,
                                $this->getCompanyName(),
-                               $contractInstance->getShipInstance()->getPartDescr(),
+                               $contractInstance->getShipInstance()->getObjectDescription(),
                                $contractInstance->getShipInstance()->getShipName()
                        ));
                } else {
@@ -615,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()
                        ));
@@ -646,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);
                }
@@ -654,23 +646,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]