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