3 namespace CoreFramework\Lists;
5 // Import framework stuff
6 use CoreFramework\Generic\FrameworkInterface;
9 * An interface for lists
11 * @author Roland Haeder <webmaster@shipsimu.org>
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
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.
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.
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/>.
30 interface Listable extends FrameworkInterface, IteratorAggregate {
32 * Checks whether the given group is set
34 * @param $groupName Group to check if found in list
35 * @return $isset Whether the group is valid
37 function isGroupSet ($groupName);
40 * Adds the given group or if already added issues a ListGroupAlreadyAddedException
42 * @param $groupName Group to add
44 * @throws ListGroupAlreadyAddedException If the given group is already added
46 function addGroup ($groupName);
49 * Adds the given instance to list group and sub group
51 * @param $groupName Group to add instance to
52 * @param $subGroup Sub group to add instance to
53 * @param $visitableInstance An instance of Visitable
55 * @throws NoListGroupException If the given group is not found
57 function addInstance ($groupName, $subGroup, Visitable $visitableInstance);
60 * Adds the given entry to list group
62 * @param $groupName Group to add instance to
63 * @param $entry An entry of any type
65 * @throws NoListGroupException If the given group is not found
67 function addEntry ($groupName, $entry);
70 * Updates the given entry by hash with given array
72 * @param $hash Hash for this entry
73 * @param $entryArray Array with entry we should update
75 * @throws InvalidListHashException If the solved hash index is invalid
77 function updateCurrentEntryByHash ($hash, array $entryArray);
80 * "Getter" for an iterator instance of this list
82 * @return $iteratorInstance An instance of a Iterator class
84 function getListIterator ();
87 * Clears this list (mostly by clearing all groups together)
91 function clearList ();