]> git.mxchange.org Git - core.git/blob - framework/main/classes/states/class_BaseState.php
Some updates:
[core.git] / framework / main / classes / states / class_BaseState.php
1 <?php
2 // Own namespace
3 namespace Org\Mxchange\CoreFramework\State;
4
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;
10
11 /**
12  * A general state class
13  *
14  * @author              Roland Haeder <webmaster@shipsimu.org>
15  * @version             0.0.0
16 <<<<<<< HEAD:framework/main/classes/states/class_BaseState.php
17  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
18 =======
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
23  *
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.
28  *
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.
33  *
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/>.
36  */
37 abstract class BaseState extends BaseFrameworkSystem implements Stateable {
38         // Exception code constants
39         const EXCEPTION_INVALID_STATE = 0xc00;
40
41         /**
42          * State name for printing out (except debug output where you want to use
43          * $stateInstance->__toString() instead of this).
44          */
45         private $stateName = '';
46
47         /**
48          * Protected constructor
49          *
50          * @param       $className      Name of the class
51          * @return      void
52          */
53         protected function __construct ($className) {
54                 // Call parent constructor
55                 parent::__construct($className);
56         }
57
58         /**
59          * Getter for state name
60          *
61          * @return      $stateName      Name of this state in a printable maner
62          */
63         public final function getStateName () {
64                 return $this->stateName;
65         }
66
67         /**
68          * Setter for state name
69          *
70          * @param       $stateName      Name of this state in a printable maner
71          * @return      void
72          */
73         protected final function setStateName ($stateName) {
74                 $this->stateName = $stateName;
75         }
76
77         /**
78          * Executes the state with given Executor instance
79          *
80          * @param       $executorInstance       An instance of a Executor class
81          * @return      void
82          * @throws      UnsupportedOperationException   This method should be overwritten
83          */
84         public function executeState (Executor $executorInstance) {
85                 throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION);
86         }
87
88 }