From: Roland Haeder Date: Tue, 24 Mar 2015 17:18:05 +0000 (+0100) Subject: Imported from 'hub' code. X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=cee0ca90f0e79e9529f608be15ea8adc18aec459;hp=c3021952494266e05bfa9046baf9bcd11bfe7d13 Imported from 'hub' code. Signed-off-by: Roland Häder --- diff --git a/inc/classes/main/decorator/class_BaseDecorator.php b/inc/classes/main/decorator/class_BaseDecorator.php index e580577f..3ef6c49a 100644 --- a/inc/classes/main/decorator/class_BaseDecorator.php +++ b/inc/classes/main/decorator/class_BaseDecorator.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class BaseDecorator extends BaseHubSystem { +class BaseDecorator extends BaseFrameworkSystem { /** * Protected constructor * diff --git a/inc/classes/main/states/.htaccess b/inc/classes/main/states/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/main/states/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/states/class_ b/inc/classes/main/states/class_ new file mode 100644 index 00000000..b2505a4e --- /dev/null +++ b/inc/classes/main/states/class_ @@ -0,0 +1,40 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team + * @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 ???State extends BaseState implements ??Stateable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set state name + $this->setStateName('!!!'); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/states/class_BaseState.php b/inc/classes/main/states/class_BaseState.php new file mode 100644 index 00000000..73970992 --- /dev/null +++ b/inc/classes/main/states/class_BaseState.php @@ -0,0 +1,77 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 BaseState extends BaseFrameworkSystem implements Stateable { + // Exception code constants + const EXCEPTION_INVALID_STATE = 0xc00; + + /** + * State name for printing out (except debug output where you want to use + * $stateInstance->__toString() instead of this). + */ + private $stateName = ''; + + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * Getter for state name + * + * @return $stateName Name of this state in a printable maner + */ + public final function getStateName () { + return $this->stateName; + } + + /** + * Setter for state name + * + * @param $stateName Name of this state in a printable maner + * @return void + */ + protected final function setStateName ($stateName) { + $this->stateName = $stateName; + } + + /** + * Executes the state with given Executor instance + * + * @param $executorInstance An instance of a Executor class + * @return void + * @throws UnsupportedOperationException This method should be overwritten + */ + public function executeState (Executor $executorInstance) { + throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); + } +} + +// [EOF] +?>