Creates an iterator element.
Element Information
| Element class | IteratorConfig |
| Implementation class | DatamixerIterator |
| Nested elements | listener |
Attributes
| Name | Type | Required | Description |
|---|---|---|---|
| collection | String | no | The id of the collection that creates this iterator. |
| current | boolean | no |
Use the iterator's current value if true. Used with the
reference attribute. Default = false.
|
| format | String | no | The format pattern to apply to each generated value. There is no default. |
| name | String | no | The name to give each generated value. By default, no name is given to generated values. |
| random | boolean | no |
If true, select elements randomly from the associated collection. Can
be used with the replace and seed
attributes. Default = false.
|
| reference | String | no |
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.
|
| repeat | boolean | no |
If true, then the iterator is automatically reset when
hasNext() would return false. As a result,
hasNext() never returns false. Default =
false.
|
| replace | boolean | no |
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.
|
| seed | long | no |
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"/>