Continued:
[core.git] / framework / main / interfaces / lists / class_Listable.php
1 <?php
2 // Own namespace
3 namespace CoreFramework\Lists;
4
5 // Import framework stuff
6 use CoreFramework\Generic\FrameworkInterface;
7
8 // Import SPL stuff
9 use \IteratorAggregate;
10
11 /**
12  * An interface for lists
13  *
14  * @author              Roland Haeder <webmaster@shipsimu.org>
15  * @version             0.0.0
16  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
17  * @license             GNU GPL 3.0 or any newer version
18  * @link                http://www.shipsimu.org
19  *
20  * This program is free software: you can redistribute it and/or modify
21  * it under the terms of the GNU General Public License as published by
22  * the Free Software Foundation, either version 3 of the License, or
23  * (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28  * GNU General Public License for more details.
29  *
30  * You should have received a copy of the GNU General Public License
31  * along with this program. If not, see <http://www.gnu.org/licenses/>.
32  */
33 interface Listable extends FrameworkInterface, IteratorAggregate {
34         /**
35          * Checks whether the given group is set
36          *
37          * @param       $groupName      Group to check if found in list
38          * @return      $isset          Whether the group is valid
39          */
40         function isGroupSet ($groupName);
41
42         /**
43          * Adds the given group or if already added issues a ListGroupAlreadyAddedException
44          *
45          * @param       $groupName      Group to add
46          * @return      void
47          * @throws      ListGroupAlreadyAddedException  If the given group is already added
48          */
49         function addGroup ($groupName);
50
51         /**
52          * Adds the given instance to list group and sub group
53          *
54          * @param       $groupName                      Group to add instance to
55          * @param       $subGroup                       Sub group to add instance to
56          * @param       $visitableInstance      An instance of Visitable
57          * @return      void
58          * @throws      NoListGroupException    If the given group is not found
59          */
60         function addInstance ($groupName, $subGroup, Visitable $visitableInstance);
61
62         /**
63          * Adds the given entry to list group
64          *
65          * @param       $groupName      Group to add instance to
66          * @param       $entry          An entry of any type
67          * @return      void
68          * @throws      NoListGroupException    If the given group is not found
69          */
70         function addEntry ($groupName, $entry);
71
72         /**
73          * Updates the given entry by hash with given array
74          *
75          * @param       $hash           Hash for this entry
76          * @param       $entryArray     Array with entry we should update
77          * @return      void
78          * @throws      InvalidListHashException        If the solved hash index is invalid
79          */
80         function updateCurrentEntryByHash ($hash, array $entryArray);
81
82         /**
83          * "Getter" for an iterator instance of this list
84          *
85          * @return      $iteratorInstance       An instance of a Iterator class
86          */
87         function getListIterator ();
88
89         /**
90          * Clears this list (mostly by clearing all groups together)
91          *
92          * @return      void
93          */
94         function clearList ();
95
96 }