Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcWorkflowNodeLoop

Workflow::ezcWorkflowNodeLoop

Class ezcWorkflowNodeLoop

The Loop node type is a special type of conditional branch node that has two incoming nodes instead of just one. It is used to conveniently express loops.

Incoming nodes: 2..* Outgoing nodes: 2..*

The example below shows the equivalent of a for-loop that iterates the variable i from 1 to 10:

  1.  <?php
  2.  $workflow = new ezcWorkflow( 'IncrementingLoop' );
  3.  
  4.  $set      = new ezcWorkflowNodeVariableSet( array( 'i' => 1 ) );
  5.  $step     = new ezcWorkflowNodeVariableIncrement( 'i' );
  6.  $break    = new ezcWorkflowConditionVariable( 'i', new ezcWorkflowConditionIsEqual( 10 ) );
  7.  $continue = new ezcWorkflowConditionVariable( 'i', new ezcWorkflowConditionIsLessThan( 10 ) );
  8.  
  9.  $workflow->startNode->addOutNode( $set );
  10.  
  11.  $loop = new ezcWorkflowNodeLoop;
  12.  $loop->addInNode( $set );
  13.  $loop->addInNode( $step );
  14.  
  15.  $loop->addConditionalOutNode( $continue, $step );
  16.  $loop->addConditionalOutNode( $break, $workflow->endNode );
  17.  ?>

Source for this file: /Workflow/src/nodes/control_flow/loop.php

ezcWorkflowNode
   |
   --ezcWorkflowNodeBranch
      |
      --ezcWorkflowNodeConditionalBranch
         |
         --ezcWorkflowNodeLoop
Version:   //autogen//

Inherited Constants

From ezcWorkflowNode:
ezcWorkflowNode::WAITING_FOR_ACTIVATION    The node is waiting to be activated.
ezcWorkflowNode::WAITING_FOR_EXECUTION    The node is activated and waiting to be executed.

Member Variables

protected integer $maxInNodes = false
Constraint: The maximum number of incoming nodes this node has to have to be valid. Set to false to disable this constraint.
protected integer $maxOutNodes = false
Constraint: The maximum number of outgoing nodes this node has to have to be valid. Set to false to disable this constraint.
protected integer $minInNodes = 2
Constraint: The minimum number of incoming nodes this node has to have to be valid. Set to false to disable this constraint.
protected integer $minOutNodes = 2
Constraint: The minimum number of outgoing nodes this node has to have to be valid. Set to false to disable this constraint.
protected bool $startNewThreadForBranch = false
Whether or not to start a new thread for a branch.

Inherited Member Variables

From ezcWorkflowNodeConditionalBranch
protected ezcWorkflowNodeConditionalBranch::$configuration
protected ezcWorkflowNodeConditionalBranch::$maxActivatedConditionalOutNodes
protected ezcWorkflowNodeConditionalBranch::$minActivatedConditionalOutNodes
protected ezcWorkflowNodeConditionalBranch::$minConditionalOutNodes
From ezcWorkflowNode
protected ezcWorkflowNode::$activatedFrom
protected ezcWorkflowNode::$activationState
protected ezcWorkflowNode::$id
protected ezcWorkflowNode::$inNodes
protected ezcWorkflowNode::$internalCall
protected ezcWorkflowNode::$numInNodes
protected ezcWorkflowNode::$numOutNodes
protected ezcWorkflowNode::$outNodes
protected ezcWorkflowNode::$state
protected ezcWorkflowNode::$threadId

Inherited Methods

From ezcWorkflowNodeConditionalBranch
public ezcWorkflowNode ezcWorkflowNodeConditionalBranch::addConditionalOutNode()
Adds the conditional outgoing node $outNode to this node with the condition $condition. Optionally, an $else node can be specified that is activated when the $condition evaluates to false.
public void ezcWorkflowNodeConditionalBranch::verify()
Checks this node's constraints.
From ezcWorkflowNodeBranch
protected boolean ezcWorkflowNodeBranch::activateOutgoingNodes()
Activates this node's outgoing nodes.
From ezcWorkflowNode
public ezcWorkflowNode ezcWorkflowNode::__construct()
Constructs a new node with the configuration $configuration.
public void ezcWorkflowNode::accept()
Reimplementation of accept() calls accept on all out nodes.
protected void ezcWorkflowNode::activateNode()
Convenience method for activating an (outgoing) node.
public ezcWorkflowNode ezcWorkflowNode::addInNode()
Adds a node to the incoming nodes of this node.
public ezcWorkflowNode ezcWorkflowNode::addOutNode()
Adds a node to the outgoing nodes of this node.
public mixed ezcWorkflowNode::getConfiguration()
Returns the configuration of this node.
public ezcWorkflowNode[] ezcWorkflowNode::getInNodes()
Returns the incoming nodes of this node.
public ezcWorkflowNode[] ezcWorkflowNode::getOutNodes()
Returns the outgoing nodes of this node.
public boolean ezcWorkflowNode::removeInNode()
Removes a node from the incoming nodes of this node.
public boolean ezcWorkflowNode::removeOutNode()
Removes a node from the outgoing nodes of this node.
public void ezcWorkflowNode::verify()
Checks this node's constraints.
Documentation generated by phpDocumentor 1.4.3