<?xml version="1.0" encoding="Windows-1255" ?><Class name="ModelIterator" inherit="core.gml:Object" alias="iter" id="core.gml:ModelIterator" sort="21" urn="core.gml:core.ModelIterator.gs" toc="\Core"><Summary>A utility class for iterating through a collection of GMLDOM objects,
   based on the ordering defined by a specified walker function.</Summary><Inherit>&lt;q ref=&quot;core.gml:Object&quot;&gt;Object&lt;/q&gt;</Inherit><Remarks>The following example shows the typical way for using the ModelIterator class:
      
&lt;pre&gt;
   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 
&lt;/pre&gt;</Remarks><Copyright>(c) SAP AG 2003-2006. All rights reserved.</Copyright>
<Topics>
<Constructor sortGroup="true" scope="public" name="Constructor" id="core.gml:ModelIterator!Constructor" sort="31" group="Constructor" seq="0000"><Summary>Constructs and initializes a new model iterator.</Summary><Parameters signature="constructor:: new &lt;b&gt;ModelIterator&lt;/b&gt;() &amp;rarr; ModelIterator"></Parameters></Constructor>
<Property name="bof" access="RO" type="Boolean" default="false" sortGroup="true" scope="public" id="core.gml:ModelIterator!bof" sort="34" group="Properties" seq="0001"><Summary>Indicates whether the iterator is at the beginning (before the position of the first object).</Summary></Property>
<Property name="current" access="RO" type="Object" default="null" sortGroup="true" scope="public" id="core.gml:ModelIterator!current" sort="34" group="Properties" seq="0002"><Summary>Gets the object at the current iterator position.</Summary></Property>
<Property name="eof" access="RO" type="Boolean" default="false" sortGroup="true" scope="public" id="core.gml:ModelIterator!eof" sort="34" group="Properties" seq="0003"><Summary>Indicates whether the iterator is at the end (after the position of the last object).</Summary></Property>
<Property name="length" access="RO" type="Number" default="0" sortGroup="true" scope="public" id="core.gml:ModelIterator!length" sort="34" group="Properties" seq="0004"><Summary>Gets the iterator length (number of objects).</Summary></Property>
<Property name="pos" access="RO" type="Number" default="0" sortGroup="true" scope="public" id="core.gml:ModelIterator!pos" sort="34" group="Properties" seq="0005"><Summary>Gets the current iterator position (between 0 and &lt;q ref=&quot;core.gml:ModelIterator!length&quot;&gt;length&lt;/q&gt;-1).</Summary></Property>
<Method name="addObject" sortGroup="true" scope="public" id="core.gml:ModelIterator!addObject" sort="35" group="Methods" seq="0006"><Summary>A callback method for adding an object to the iterator.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;addObject&lt;/b&gt;(&lt;i&gt;object&lt;/i&gt;) &amp;rarr; void"><Param name="object" type="Object">The object to add to the iterator.</Param></Parameters><Return></Return><Remarks>This method is intended for use by the walker function during a search.</Remarks></Method>
<Method name="addObjects" sortGroup="true" scope="public" id="core.gml:ModelIterator!addObjects" sort="35" group="Methods" seq="0007"><Summary>A callback method for adding a list of objects to the iterator.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;addObjects&lt;/b&gt;(&lt;i&gt;objects&lt;/i&gt;) &amp;rarr; void"><Param name="objects" type="Object[]">The list of objects to add to the iterator.</Param></Parameters><Return></Return><Remarks>This method is intended for use by the walker function during a search.</Remarks></Method>
<Method name="clear" sortGroup="true" scope="public" id="core.gml:ModelIterator!clear" sort="35" group="Methods" seq="0008"><Summary>Empties the iterator.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;clear&lt;/b&gt;() &amp;rarr; void"></Parameters><Return></Return></Method>
<Method name="goto" sortGroup="true" scope="public" id="core.gml:ModelIterator!goto" sort="35" group="Methods" seq="0009"><Summary>Moves the iterator to the object at the specified position.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;goto&lt;/b&gt;(&lt;i&gt;pos&lt;/i&gt;) &amp;rarr; Object"><Param name="pos" type="Integer">The new iterator position.</Param></Parameters><Return type="Object">Returns the object at the new iterator position, or &lt;code&gt;null&lt;/code&gt; if the iterator is out of bounds.</Return><Remarks>The iterator position can be any number between 0 and &lt;q ref=&quot;core.gml:ModelIterator!length&quot;&gt;length&lt;/q&gt;-1.
      Values smaller than 0 imply the position just before the beginning of the iterator.
      Values greater than or equal to &lt;q ref=&quot;core.gml:ModelIterator!length&quot;&gt;length&lt;/q&gt; imply the position just after the end of the iterator.</Remarks></Method>
<Method name="next" sortGroup="true" scope="public" id="core.gml:ModelIterator!next" sort="35" group="Methods" seq="0010"><Summary>Advances the iterator to the next object.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;next&lt;/b&gt;() &amp;rarr; Object"></Parameters><Return type="Object">Returns the object at the new iterator position, or &lt;code&gt;null&lt;/code&gt; if the iterator is out of bounds.</Return></Method>
<Method name="previous" sortGroup="true" scope="public" id="core.gml:ModelIterator!previous" sort="35" group="Methods" seq="0011"><Summary>Moves the iterator to the previous object.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;previous&lt;/b&gt;() &amp;rarr; Object"></Parameters><Return type="Object">Returns the object at the new iterator position, or &lt;code&gt;null&lt;/code&gt; if the iterator is out of bounds.</Return></Method>
<Method name="reverse" sortGroup="true" scope="public" id="core.gml:ModelIterator!reverse" sort="35" group="Methods" seq="0012"><Summary>Reverses the list of objects in the iterator.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;reverse&lt;/b&gt;() &amp;rarr; void"></Parameters><Return></Return><Remarks>When the operation is completed the iterator position is reset to the beginning of the reversed iterator (just before the first object).</Remarks></Method>
<Method name="rewind" sortGroup="true" scope="public" id="core.gml:ModelIterator!rewind" sort="35" group="Methods" seq="0013"><Summary>Rewinds the iterator to the beginning.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;rewind&lt;/b&gt;() &amp;rarr; void"></Parameters><Return></Return></Method>
<Method name="search" sortGroup="true" scope="public" id="core.gml:ModelIterator!search" sort="35" group="Methods" seq="0014"><Summary>Performs the iterator search by recursively calling the walker function.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;search&lt;/b&gt;(&lt;i&gt;start&lt;/i&gt;, &lt;i&gt;walker&lt;/i&gt;) &amp;rarr; void"><Param name="start" type="Object">The object from which the search should be started.</Param><Param name="walker" type="Function">The walker function for iterating over the objects.</Param></Parameters><Return></Return><Remarks>The ModelIterator constructor performs a search by recursively calling the given &lt;code&gt;walker&lt;/code&gt; function:
      &lt;ul&gt;&lt;li&gt;The &lt;code&gt;walker&lt;/code&gt; function has the following signature: &lt;code&gt;walker(object, iterator)&lt;/code&gt;, where &lt;code&gt;object&lt;/code&gt; is the object currently in the search focus and &lt;code&gt;iterator&lt;/code&gt; is this ModelIterator object. &lt;/li&gt;&lt;li&gt;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 &lt;code&gt;null&lt;/code&gt; to indicate that there are no more objects to search. &lt;/li&gt;&lt;li&gt;Before the walker function returns it can use the &lt;q ref=&quot;core.gml:ModelIterator!addObject&quot;&gt;addObject&lt;/q&gt; or &lt;q ref=&quot;core.gml:ModelIterator!addObjects&quot;&gt;addObjects&lt;/q&gt; callback methods to add any desired objects to the iterator. The order in which the objects are added defines their order in the iterator. &lt;/li&gt;&lt;li&gt;The &lt;code&gt;walker&lt;/code&gt; function does not need to check for cycles since cyclic references are checked and avoided by the iterator. &lt;/li&gt;&lt;/ul&gt;
      When the search is completed the iterator is reset to the beginning (just before the first object).</Remarks></Method>
<Method name="sort" sortGroup="true" scope="public" id="core.gml:ModelIterator!sort" sort="35" group="Methods" seq="0015"><Summary>Sorts the list of objects in the iterator by a specified property in alphabetical order.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;sort&lt;/b&gt;() &amp;rarr; void"></Parameters><Return></Return><Remarks>When the sort is completed the iterator position is reset to the beginning of the sorted iterator (just before the first object).</Remarks></Method>
<Method name="sortn" sortGroup="true" scope="public" id="core.gml:ModelIterator!sortn" sort="35" group="Methods" seq="0016"><Summary>Sorts the list of objects in the iterator by a specified property in numeric order.</Summary><Parameters signature="method:: &lt;i&gt;iter&lt;/i&gt;.&lt;b&gt;sortn&lt;/b&gt;() &amp;rarr; void"></Parameters><Return></Return><Remarks>When the sort is completed the iterator position is reset to the beginning of the sorted iterator (just before the first object).</Remarks></Method>
</Topics>
</Class>