3 namespace Org\Mxchange\CoreFramework\State;
5 // Import framework stuff
6 use Org\Mxchange\CoreFramework\Executor\Executor;
7 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
8 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
9 use Org\Mxchange\CoreFramework\State\Stateable;
12 * A general state class
14 * @author Roland Haeder <webmaster@shipsimu.org>
16 <<<<<<< HEAD:framework/main/classes/states/class_BaseState.php
17 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
19 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
20 >>>>>>> Some updates::inc/main/classes/states/class_BaseState.php
21 * @license GNU GPL 3.0 or any newer version
22 * @link http://www.shipsimu.org
24 * This program is free software: you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation, either version 3 of the License, or
27 * (at your option) any later version.
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with this program. If not, see <http://www.gnu.org/licenses/>.
37 abstract class BaseState extends BaseFrameworkSystem implements Stateable {
38 // Exception code constants
39 const EXCEPTION_INVALID_STATE = 0xc00;
42 * State name for printing out (except debug output where you want to use
43 * $stateInstance->__toString() instead of this).
45 private $stateName = '';
48 * Protected constructor
50 * @param $className Name of the class
53 protected function __construct ($className) {
54 // Call parent constructor
55 parent::__construct($className);
59 * Getter for state name
61 * @return $stateName Name of this state in a printable maner
63 public final function getStateName () {
64 return $this->stateName;
68 * Setter for state name
70 * @param $stateName Name of this state in a printable maner
73 protected final function setStateName ($stateName) {
74 $this->stateName = $stateName;
78 * Executes the state with given Executor instance
80 * @param $executorInstance An instance of a Executor class
82 * @throws UnsupportedOperationException This method should be overwritten
84 public function executeState (Executor $executorInstance) {
85 throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION);