Pages: [1]
  Print  
Author Topic: Consistent loop behaviour when iterating zero times  (Read 682 times)
tennenrishin
Full Member
***
Posts: 175


WWW
« on: June 16, 2012, 02:51:24 PM »

The following process generates an error when it runs, simply because the number of loop iterations happens to be zero. But if any other number of attributes matched, there would not have been an error.

Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.006">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.2.006" expanded="true" name="Process">
    <process expanded="true" height="486" width="907">
      <operator activated="true" class="generate_data" compatibility="5.2.006" expanded="true" height="60" name="Generate Data" width="90" x="112" y="75"/>
      <operator activated="true" class="loop_attributes" compatibility="5.2.006" expanded="true" height="60" name="Loop Attributes" width="90" x="313" y="75">
        <parameter key="attribute_filter_type" value="regular_expression"/>
        <parameter key="regular_expression" value="regexThatMayMatchZeroAttributes"/>
        <process expanded="true" height="486" width="907">
          <connect from_port="example set" to_port="example set"/>
          <portSpacing port="source_example set" spacing="0"/>
          <portSpacing port="sink_example set" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Generate Data" from_port="output" to_op="Loop Attributes" to_port="example set"/>
      <connect from_op="Loop Attributes" from_port="example set" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>

Certain loop operators (e.g. Loop Attributes) can be considered a repetitive chain of their contents. Extrapolating this principle down to zero iterations, the consistent behavior would be that the loop operator has no effect (rather than generating an error).
Logged
Marius
Administrator
Hero Member
*****
Posts: 1794



WWW
« Reply #1 on: June 18, 2012, 10:13:40 AM »

Hi, thank's for the hint, indeed some of the loop operators need some love.
Logged

Please add [SOLVED] to the topic title when your problem has been solved! (do so by editing the first post in the thread and modifying the title)
Please click here before posting.
Pages: [1]
  Print  
 
Jump to: