Continued:
[core.git] / framework / main / interfaces / stacker / class_Stackable.php
1 <?php
2 // Own namespace
3 namespace CoreFramework\Stacker;
4
5 // Import framework stuff
6 use CoreFramework\Generic\FrameworkInterface;
7
8 /**
9  * A Stackable interface
10  *
11  * @author              Roland Haeder <webmaster@shipsimu.org>
12  * @version             0.0.0
13  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
14  * @license             GNU GPL 3.0 or any newer version
15  * @link                http://www.shipsimu.org
16  *
17  * This program is free software: you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation, either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program. If not, see <http://www.gnu.org/licenses/>.
29  */
30 interface Stackable extends FrameworkInterface {
31         /**
32          * Pushs a value on a named stacker
33          *
34          * @param       $stackerName    Name of the stacker
35          * @param       $value                  Value to push on it
36          * @return      void
37          * @throws      StackerFullException    If the stacker is full
38          */
39         function pushNamed ($stackerName, $value);
40
41         /**
42          * 'Pops' a value from a named stacker and returns it's value
43          *
44          * @param       $stackerName    Name of the stacker
45          * @return      $value                  Value of the current stack entry
46          * @throws      NoStackerException      If the named stacker was not found
47          * @throws      EmptyStackerException   If the named stacker is empty
48          */
49         function popNamed ($stackerName);
50
51         /**
52          * Get value from named stacker but don't "pop" it
53          *
54          * @param       $stackerName    Name of the stacker
55          * @return      $value                  Value of last added value
56          * @throws      NoStackerException      If the named stacker was not found
57          * @throws      EmptyStackerException   If the named stacker is empty
58          */
59         function getNamed ($stackerName);
60
61         /**
62          * Checks whether the given stack is initialized (set in array $stackers)
63          *
64          * @param       $stackerName    Name of the stack
65          * @return      $isInitialized  Whether the stack is initialized
66          */
67         function isStackInitialized ($stackerName);
68
69         /**
70          * Checks whether the given stack is empty
71          *
72          * @param       $stackerName    Name of the stack
73          * @return      $isEmpty                        Whether the stack is empty
74          * @throws      NoStackerException      If given stack is missing
75          */
76         function isStackEmpty ($stackerName);
77
78 }