3 namespace Org\Mxchange\CoreFramework\Lists;
5 // Import framework stuff
6 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
7 use Org\Mxchange\CoreFramework\Visitor\Visitable;
10 use \IteratorAggregate;
13 * An interface for lists
15 * @author Roland Haeder <webmaster@shipsimu.org>
17 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
18 * @license GNU GPL 3.0 or any newer version
19 * @link http://www.shipsimu.org
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.
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.
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/>.
34 interface Listable extends FrameworkInterface, IteratorAggregate {
36 * Checks whether the given group is set
38 * @param $groupName Group to check if found in list
39 * @return $isset Whether the group is valid
41 function isGroupSet (string $groupName);
44 * Adds the given group or if already added issues a ListGroupAlreadyAddedException
46 * @param $groupName Group to add
48 * @throws ListGroupAlreadyAddedException If the given group is already added
50 function addGroup (string $groupName);
53 * Adds the given instance to list group and sub group
55 * @param $groupName Group to add instance to
56 * @param $subGroup Sub group to add instance to
57 * @param $visitableInstance An instance of Visitable
59 * @throws NoListGroupException If the given group is not found
61 function addInstance (string $groupName, string $subGroup, Visitable $visitableInstance);
64 * Adds the given entry to list group
66 * @param $groupName Group to add instance to
67 * @param $entry An entry of any type
69 * @throws NoListGroupException If the given group is not found
71 function addEntry (string $groupName, $entry);
74 * Updates the given entry by hash with given array
76 * @param $hash Hash for this entry
77 * @param $entryArray Array with entry we should update
79 * @throws InvalidListHashException If the solved hash index is invalid
81 function updateCurrentEntryByHash (string $hash, array $entryArray);
84 * "Getter" for an iterator instance of this list
86 * @return $iteratorInstance An instance of a Iterator class
88 function getListIterator ();
91 * Clears this list (mostly by clearing all groups together)
95 function clearList ();
98 * Setter for call-back instance
100 * @param $callbackInstance An instance of a FrameworkInterface class
103 function setCallbackInstance (FrameworkInterface $callbackInstance);