application/ship-simu/interfaces/class_Customer.php -text
application/ship-simu/interfaces/class_ItemIsTradeable.php -text
application/ship-simu/interfaces/class_Personellizer.php -text
+application/ship-simu/interfaces/class_SignableContract.php -text
application/ship-simu/loader.php -text
application/ship-simu/main/.htaccess -text
application/ship-simu/main/class_ -text
* @return boolean true = can be a contract partner,
* false = no partner for contracts
*/
- function isContractPartner (WorksContract $contractInstance);
+ function isContractPartner (SignableContract $contractInstance);
}
// [EOF]
* @param $contractInstance A valid instance to WorksContract
* @return void
*/
- function addNewWorksContract (WorksContract $contractInstance);
+ function addNewWorksContract (SignableContract $contractInstance);
/**
* Signs a works contract.
* set contract partner is
* not the expected
*/
- function signContract (WorksContract $contractInstance, ContractPartner $partnerInstance);
+ function signContract (SignableContract $contractInstance, ContractPartner $partnerInstance);
/**
* Withdraw from a signed contract
* @param $contractInstance A valid instance to WorksContract
* @return void
*/
- function withdrawFromContract (WorksContract $contractInstance);
+ function withdrawFromContract (SignableContract $contractInstance);
}
// [EOF]
--- /dev/null
+<?php
+/**
+ * An interface for signable contracts
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface SignableContract extends FrameworkInterface {
+ // Sign the contract
+ function signContract (ContractPartner $partnerInstance, ContractPartner $partyInstance);
+}
+
+// [EOF]
+?>
\ No newline at end of file
// Debug message
if ((defined('DEBUG_PERSONELL')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[PersonellBase:] Konstruktor erreicht.<br />\n");
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Personal");
}
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Händler");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
// Iterate throw whole list
for ($iter = $this->priceList->getIterator(); $iter->valid(); $iter->next()) {
- // Get current item
+ //�Get current item
$item = $iter->current();
// Does this item match? The unique ID may not work...
<?php
// Bauvertrag-Klasse
-class WorksContract extends BaseFrameworkSystem {
+class WorksContract extends BaseFrameworkSystem implements SignableContract {
// Zukuenftiger Schiffsname
private $shipName = "";
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Bauvertrag");
// Unique-ID generieren
if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Ship:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
htmlentities($eval)
));
-
+
// Code ausfuhren
@eval($eval);
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Reederei");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
// 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ündet.<br />\n",
__CLASS__,
// Element holen
$employee = $iterator->current();
} else {
- // Should normally not happen... :(
+ // Should�normally not happen... :(
throw new StructuresOutOfBoundsException($idx, self::EXCEPTION_INDEX_OUT_OF_BOUNDS);
}
}
}
// 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üft den Bauauftrag der <strong>%s</strong>.<br />\n",
__CLASS__,
__LINE__,
// 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!
}
}
// 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ür ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.<br />\n",
__CLASS__,
__LINE__,
}
// 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>");
}
}
// 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
}
// 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()));
}
));
}
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Liegeplatz");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
}
$this->__toString()
));
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Namenlose Landkonstruktion");
// Etwas aufraeumen (brauchen wir hier nicht)
private function __construct () {
if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[DryDock:] Konstruktor erreicht.<br />\n");
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Trockendock");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
}
// Namen des Hafens (z.B. Hamburger Hafen)
private $harborName = "Unbekannter Hafen";
- // Schiffsliste aller gebauten Schiffe
+ //�Schiffsliste aller gebauten Schiffe
private $constructedShips = null;
// Liegeplatz-Liste
// Constructor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
if (((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[Harbor:] Konstruktor erreicht.<br />\n");
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Hafen");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
));
}
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Anlegebrücke");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
}
// Constructor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Werft");
// Staff-Liste/Schiffstyp-Liste erzeugen
$this->createStaffList();
$this->createShipTypeList();
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
}
// Konstruktor
private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor($class);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Namenloser Antrieb");
// Etwas aufraeumen
class Motor extends BaseDrive implements ItemIsTradeable, ConstructableShipPart {
// Constructor
private function __construct() {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Namenloser Motor");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
// Konstruktor
private function __construct($class) {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor($class);
// Debug message
class MaschineRoom extends BaseShipPart {
// Constructor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Maschinenraum");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
* @return void
*/
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
if (((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.<br />\n",
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Firmenangestellte(r)");
// Create unique ID
// Namenloses Ship generieren
private function __construct($class) {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor($class);
// Beim Schiff angelangt
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Passagier-Schiff");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
// Konstruktor (hier keine Exceptions aendern!)
private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor($class);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Schiffsstrukturen");
// Etwas aufraeumen
class BaseCabin extends BaseCabinStructure {
// Konstruktor
private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor($class);
- // Debug message
+ //�Debug message
if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
$this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\n",
__CLASS__,
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Kabine");
// Maybe clean up a little
__LINE__
));
- // Unique-ID erzeugen
+ // Generate unique ID number
$cabinInstance->createUniqueID();
// Instanz zurueckgeben
class EconomyCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Economy-Class-Kabine");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
class LowCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
__LINE__
));
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("2Star-Class-Kabine");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
class LuxuryCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ //�Call parent constructor
parent::constructor(__CLASS__);
// Debug message
__LINE__
));
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Luxuskabine");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
class PremierCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
__LINE__
));
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Premier-Class-Kabine");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
// Konstruktor
private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor($class);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Kabinenstruktur");
}
// Konstruktor
private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor($class);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Deckstruktur");
}
* Constructor for all super structures on a ship
*/
private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor($class);
// Debug message
));
}
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Aufbauten");
// Shall we clean up?
class CarDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
__LINE__
));
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Autodeck");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
class TrainDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
__LINE__
));
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Zug-Deck");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
class TruckDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
// Konstruktor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
__LINE__
));
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("LKW-Deck");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
* Constructor for cargo decks in general
*/
private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor($class);
// Debub message
__LINE__
));
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Deck");
// Maybe clean up?
class Bridge extends BaseUpperStructure implements ItemIsTradeable, ConstructableShipPart {
// Constructor
private function __construct () {
- // Eltern-Konstruktor aufrufen
+ // Call parent constructor
parent::constructor(__CLASS__);
// Debug message
__LINE__
));
- // Beschreibung setzen
+ // Set description
$this->setPartDescr("Brücke");
- // Unique-ID erzeugen
+ // Generate unique ID number
$this->createUniqueID();
// Clean up a little
$bridgeInstance->setHeight($height);
$bridgeInstance->setLength($length);
- // Instanz zurueckgeben
+ //�Instanz zurueckgeben
return $bridgeInstance;
}