3 namespace CoreFramework\Lists;
5 // Import framework stuff
6 use CoreFramework\Generic\FrameworkInterface;
9 use \IteratorAggregate;
12 * An interface for lists
14 * @author Roland Haeder <webmaster@shipsimu.org>
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
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.
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.
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/>.
33 interface Listable extends FrameworkInterface, IteratorAggregate {
35 * Checks whether the given group is set
37 * @param $groupName Group to check if found in list
38 * @return $isset Whether the group is valid
40 function isGroupSet ($groupName);
43 * Adds the given group or if already added issues a ListGroupAlreadyAddedException
45 * @param $groupName Group to add
47 * @throws ListGroupAlreadyAddedException If the given group is already added
49 function addGroup ($groupName);
52 * Adds the given instance to list group and sub group
54 * @param $groupName Group to add instance to
55 * @param $subGroup Sub group to add instance to
56 * @param $visitableInstance An instance of Visitable
58 * @throws NoListGroupException If the given group is not found
60 function addInstance ($groupName, $subGroup, Visitable $visitableInstance);
63 * Adds the given entry to list group
65 * @param $groupName Group to add instance to
66 * @param $entry An entry of any type
68 * @throws NoListGroupException If the given group is not found
70 function addEntry ($groupName, $entry);
73 * Updates the given entry by hash with given array
75 * @param $hash Hash for this entry
76 * @param $entryArray Array with entry we should update
78 * @throws InvalidListHashException If the solved hash index is invalid
80 function updateCurrentEntryByHash ($hash, array $entryArray);
83 * "Getter" for an iterator instance of this list
85 * @return $iteratorInstance An instance of a Iterator class
87 function getListIterator ();
90 * Clears this list (mostly by clearing all groups together)
94 function clearList ();