0d96e791e773230417d3ebd6c4f4cb45623a64b7
[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 /**
9  * An interface for lists
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 Listable extends FrameworkInterface, IteratorAggregate {
31         /**
32          * Checks whether the given group is set
33          *
34          * @param       $groupName      Group to check if found in list
35          * @return      $isset          Whether the group is valid
36          */
37         function isGroupSet ($groupName);
38
39         /**
40          * Adds the given group or if already added issues a ListGroupAlreadyAddedException
41          *
42          * @param       $groupName      Group to add
43          * @return      void
44          * @throws      ListGroupAlreadyAddedException  If the given group is already added
45          */
46         function addGroup ($groupName);
47
48         /**
49          * Adds the given instance to list group and sub group
50          *
51          * @param       $groupName                      Group to add instance to
52          * @param       $subGroup                       Sub group to add instance to
53          * @param       $visitableInstance      An instance of Visitable
54          * @return      void
55          * @throws      NoListGroupException    If the given group is not found
56          */
57         function addInstance ($groupName, $subGroup, Visitable $visitableInstance);
58
59         /**
60          * Adds the given entry to list group
61          *
62          * @param       $groupName      Group to add instance to
63          * @param       $entry          An entry of any type
64          * @return      void
65          * @throws      NoListGroupException    If the given group is not found
66          */
67         function addEntry ($groupName, $entry);
68
69         /**
70          * Updates the given entry by hash with given array
71          *
72          * @param       $hash           Hash for this entry
73          * @param       $entryArray     Array with entry we should update
74          * @return      void
75          * @throws      InvalidListHashException        If the solved hash index is invalid
76          */
77         function updateCurrentEntryByHash ($hash, array $entryArray);
78
79         /**
80          * "Getter" for an iterator instance of this list
81          *
82          * @return      $iteratorInstance       An instance of a Iterator class
83          */
84         function getListIterator ();
85
86         /**
87          * Clears this list (mostly by clearing all groups together)
88          *
89          * @return      void
90          */
91         function clearList ();
92
93 }