dm:iterator

Creates an iterator element.

Element Information

Element class IteratorConfig
Implementation class DatamixerIterator
Nested elements listener

Attributes

Name Type Required Description
collectionStringno The id of the collection that creates this iterator.
currentbooleanno Use the iterator's current value if true. Used with the reference attribute. Default = false.
formatStringno The format pattern to apply to each generated value. There is no default.
nameStringno The name to give each generated value. By default, no name is given to generated values.
randombooleanno If true, select elements randomly from the associated collection. Can be used with the replace and seed attributes. Default = false.
referenceStringno Get values from the iterator whose id is given by reference. Used with the current attribute, to get that iterator's current values. If the format attribute is also used, it overrides any format value given to the referenced iterator. Similarly, if the name attribute is used, it overrides the name given to the referenced iterator.
repeatbooleanno If true, then the iterator is automatically reset when hasNext() would return false. As a result, hasNext() never returns false. Default = false.
replacebooleanno If true, then while iterating over the collection, allow repeated selection of the same element. If false, require each element to be different. Default = true.
seedlongno The seed used to initialize the random number generator. Used when the random attribute is true. Default = current timestamp.

Examples

    
    <!-- nested inside a collection -->
    <dm:ints range="[10,20]2">
      <dm:iterator id="iter1" repeat="true"/>
    </dm:ints>

    <!-- references a collection -->
    <dm:doubles id="doubles" range="[0,1)0.01"/>
    <dm:iterator id="iter2" collection="doubles" format="0.00"/>

    <!-- random -->
    <dm:ints range="[1,100]">
      <dm:iterator id="age" random="true" replace="false" seed="0"/>
    </dm:ints>

    <!-- references another iterator and names its values -->
    <dm:iterator id="iter3" reference="iter2" name="probability" current="true"/>