:orphan: .. **************************************************************************** .. CUI .. .. The Advanced Framework for Simulation, Integration, and Modeling (AFSIM) .. .. The use, dissemination or disclosure of data in this file is subject to .. limitation or restriction. See accompanying README and LICENSE for details. .. **************************************************************************** SetIterator ----------- .. class:: SetIterator inherits Iterator SetIterator is a type that allows the user to iterate over a range of elements in a :class:`Set>` container. Use the :method:`GetIterator.GetIterator>` method to obtain an iterator to the beginning of the set. Usage:: Set set = Set(); SetIterator iter = set.GetIterator(); while (iter.HasNext()) { iter.Next(); int data = (int)iter.Data(); } When iterating over the entire range of the Set, the :ref:`foreach>` loop is a more convenient method:: Set set = Set(); foreach (int data in set) { ... } Methods ======= .. note:: Return values from methods that return :class:`Object` should be cast to the correct data type. .. method:: bool HasPrev() Returns true if another element exists before the current element. .. method:: Object Prev() Decrements the iterator to the previous element and returns its associated data, which should be cast to the data type of the Set before usage. If at the beginning of the set and no previous element exists, invalid data is returned, so :method:`HasPrev()` should be queried before using this method. .. method:: Object Data() Returns the data associated with the current element, which should be cast to the data type of the Set before usage. See :class:`Iterator` for a list of methods inherited by all iterator types.