A utility class for iterating through a collection of GMLDOM objects, based on the ordering defined by a specified walker function.<q ref="core.gml:Object">Object</q>The following example shows the typical way for using the ModelIterator class: <pre> method deepStateScan(state) ... var iterator = $ENV.createObject('gml:ModelIterator'); var object; iterator.search(state, walkMembers); while (object = iterator.next()) { ... do something with object ... } ... return; function walkMembers(object, iterator) { iterator.addObject(object); if (!ISA(object, 'gml:State')) return null; return object.members; } end </pre>(c) SAP AG 2003-2006. All rights reserved. Constructs and initializes a new model iterator. Indicates whether the iterator is at the beginning (before the position of the first object). Gets the object at the current iterator position. Indicates whether the iterator is at the end (after the position of the last object). Gets the iterator length (number of objects). Gets the current iterator position (between 0 and <q ref="core.gml:ModelIterator!length">length</q>-1). A callback method for adding an object to the iterator.The object to add to the iterator.This method is intended for use by the walker function during a search. A callback method for adding a list of objects to the iterator.The list of objects to add to the iterator.This method is intended for use by the walker function during a search. Empties the iterator. Moves the iterator to the object at the specified position.The new iterator position.Returns the object at the new iterator position, or <code>null</code> if the iterator is out of bounds.The iterator position can be any number between 0 and <q ref="core.gml:ModelIterator!length">length</q>-1. Values smaller than 0 imply the position just before the beginning of the iterator. Values greater than or equal to <q ref="core.gml:ModelIterator!length">length</q> imply the position just after the end of the iterator. Advances the iterator to the next object.Returns the object at the new iterator position, or <code>null</code> if the iterator is out of bounds. Moves the iterator to the previous object.Returns the object at the new iterator position, or <code>null</code> if the iterator is out of bounds. Reverses the list of objects in the iterator.When the operation is completed the iterator position is reset to the beginning of the reversed iterator (just before the first object). Rewinds the iterator to the beginning. Performs the iterator search by recursively calling the walker function.The object from which the search should be started.The walker function for iterating over the objects.The ModelIterator constructor performs a search by recursively calling the given <code>walker</code> function: <ul><li>The <code>walker</code> function has the following signature: <code>walker(object, iterator)</code>, where <code>object</code> is the object currently in the search focus and <code>iterator</code> is this ModelIterator object. </li><li>The walker function should return the list of objects that will be searched during the next search step using either an array or a hash table. The walker function can return <code>null</code> to indicate that there are no more objects to search. </li><li>Before the walker function returns it can use the <q ref="core.gml:ModelIterator!addObject">addObject</q> or <q ref="core.gml:ModelIterator!addObjects">addObjects</q> callback methods to add any desired objects to the iterator. The order in which the objects are added defines their order in the iterator. </li><li>The <code>walker</code> function does not need to check for cycles since cyclic references are checked and avoided by the iterator. </li></ul> When the search is completed the iterator is reset to the beginning (just before the first object). Sorts the list of objects in the iterator by a specified property in alphabetical order.When the sort is completed the iterator position is reset to the beginning of the sorted iterator (just before the first object). Sorts the list of objects in the iterator by a specified property in numeric order.When the sort is completed the iterator position is reset to the beginning of the sorted iterator (just before the first object).