X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fship-simu%2Fmain%2Fpersonell%2Fclass_SimulatorPersonell.php;h=ba7883f7264edc55b4991d4acefbee0070c50455;hb=b3d612dc053c999af135677df431f73d9d26154f;hp=86b1ba0d42ee944af5607f0351d64c0acad01c94;hpb=6019ae86707cb6decaddc63f191e3ef6eb5e4d44;p=shipsimu.git diff --git a/application/ship-simu/main/personell/class_SimulatorPersonell.php b/application/ship-simu/main/personell/class_SimulatorPersonell.php index 86b1ba0..ba7883f 100644 --- a/application/ship-simu/main/personell/class_SimulatorPersonell.php +++ b/application/ship-simu/main/personell/class_SimulatorPersonell.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -39,15 +39,6 @@ class SimulatorPersonell extends BasePersonell { protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); - - // Set description - $this->setObjectDescription("Simulationspersonal"); - - // Create unique ID - $this->generateUniqueId(); - - // Clean-up a little - $this->removeSystemArray(); } /** @@ -63,7 +54,6 @@ class SimulatorPersonell extends BasePersonell { $this->removePersonellList(); $this->removeMinMaxAge(); $this->removeCache(); - $this->removeSystemArray(); } /** @@ -74,7 +64,7 @@ class SimulatorPersonell extends BasePersonell { * @return $personellInstance An instance of this object with a * list of personells */ - public final static function createSimulatorPersonell ($amountPersonell) { + public static final function createSimulatorPersonell ($amountPersonell) { // Make sure only integer can pass $amountPersonell = (int) $amountPersonell; @@ -82,7 +72,7 @@ class SimulatorPersonell extends BasePersonell { $personellInstance = new SimulatorPersonell(); // Debug message - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] Es werden %d Personal bereitgestellt.", + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] Es werden %d Personal bereitgestellt.", __CLASS__, __LINE__, $amountPersonell @@ -97,7 +87,7 @@ class SimulatorPersonell extends BasePersonell { } // Debug message - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] %d Personal bereitgestellt.", + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] %d Personal bereitgestellt.", __CLASS__, __LINE__, $amountPersonell @@ -110,9 +100,7 @@ class SimulatorPersonell extends BasePersonell { $personellInstance->removeSalary(); $personellInstance->removeEmployed(); $personellInstance->removeMarried(); - $personellInstance->removeNumberFormaters(); //$personellInstance->removeCache(); - $personellInstance->removeSystemArray(); // Instanz zurueckgeben return $personellInstance; @@ -127,64 +115,28 @@ class SimulatorPersonell extends BasePersonell { * @throws InvalidIDFormatException If the given id number * $idNumber is invalid * @throws MissingSimulatorIdException If an ID number was not found + * @deprecated */ - public final static function createSimulatorPersonellByID ($idNumber) { - // Add the class name if it was not found - if (count(explode("@", $idNumber)) < 2) { - // Add class name in front of the incomplete ID number - $tempID = sprintf("%s@%s", __CLASS__, $idNumber); - } else { - // Use the direct ID number - $tempID = $idNumber; - } - - // Validate the ID number - if (!preg_match(sprintf("/%s\@([a-f0-9]){32}/i", __CLASS__), $tempID)) { - // Invalid format - throw new InvalidIDFormatException(new SimulatorPersonell(), self::EXCEPTION_ID_IS_INVALID_FORMAT); - } - + public static final function createSimulatorPersonellByID ($idNumber) { // Get instance $personellInstance = new SimulatorPersonell(false); - - // Get database instance - $dbInstance = $personellInstance->getDatabaseInstance(); - - // Is the unique ID already used? Then it must be there! - if (!$dbInstance->isUniqueIdUsed($tempID)) { - // Entry not found! - throw new MissingSimulatorIdException(array($personellInstance, $idNumber), self::EXCEPTION_SIMULATOR_ID_INVALID); - } - - // Load the personell list and add it to this object - $personellInstance->loadPersonellList($tempID); - - // Clean-up a little - $personellInstance->removeGender(); - $personellInstance->removeNames(); - $personellInstance->removeBirthday(); - $personellInstance->removeSalary(); - $personellInstance->removeEmployed(); - $personellInstance->removeMarried(); - $personellInstance->removeNumberFormaters(); - //$personellInstance->removeCache(); - $personellInstance->removeSystemArray(); - - // Return instance - return $personellInstance; + $personellInstance->makeDeprecated(); } // Create personell list public function createPersonellList () { - if (is_null($this->personellList)) { - $this->personellList = new FrameworkArrayObject("FakedPersonellList"); - } else { + // Is the list already created? + if ($this->personelllList instanceof FrameworkArrayObject) { + // Throw an exception throw new PersonellListAlreadyCreatedException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID); - } + } // END - if + + // Initialize the array + $this->personellList = new FrameworkArrayObject("FakedPersonellList"); } // Remove the personell list - private function removePersonellList () { + private final function removePersonellList () { unset($this->personellList); } @@ -209,7 +161,6 @@ class SimulatorPersonell extends BasePersonell { $personellInstance->removePersonellList(); $personellInstance->removeMinMaxAge(); $personellInstance->removeCache(); - $personellInstance->removeSystemArray(); // Add new member to the list $this->personellList->append($personellInstance); @@ -226,7 +177,7 @@ class SimulatorPersonell extends BasePersonell { // The same (last) conditions? if (($serialized == $this->cacheCond) && (!is_null($this->cacheCond))) { - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Gecachte Liste wird verwendet.", + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Gecachte Liste wird verwendet.", __CLASS__, __LINE__ )); @@ -236,7 +187,7 @@ class SimulatorPersonell extends BasePersonell { } // Output debug message - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...", + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...", __CLASS__, __LINE__ )); @@ -365,16 +316,10 @@ class SimulatorPersonell extends BasePersonell { * @param $idNumber The ID number we shall use for looking up * the right data. * @return void - * @throws ContainerItemIsNullException If a container item is null - * @throws ContainerItemIsNoArrayException If a container item is - * not an array - * @throws ContainerMaybeDamagedException If the container item - * is missing the indexes - * 'name' and/or 'value' + * @deprecated */ public function loadPersonellList ($idNumber) { - // Cleared because old code - $this->partialStub("Cleared because old lost code was used."); + $this->makeDeprecated(); } }