public function isAvailable()
 {
     if (!$this->isStarted()) {
         return parent::isAvailable();
     }
     if ($this->order_type == Ezer_IntForeach::TYPE_PARALLEL) {
         foreach ($this->step_instances as $index => $step_instance) {
             if (!$step_instance->isDone()) {
                 return false;
             }
         }
         $this->done();
     }
     if ($this->order_type == Ezer_IntForeach::TYPE_SERIAL) {
         $step_instance = $this->step_instances[$this->current_index];
         if (!$step_instance->isDone()) {
             return false;
         }
         $this->current_index++;
         if ($this->current_index >= count($this->step_instances)) {
             $this->done();
         } else {
             $step_instance = $this->step_instances[$this->current_index];
             $step_instance->start();
         }
     }
     return false;
 }
 public function isAvailable()
 {
     if (!parent::isStarted()) {
         return parent::isAvailable();
     }
     if (!count($this->step_instances)) {
         $this->done();
         return false;
     }
     $step_instance = $this->step_instances[0];
     if ($step_instance->isDone()) {
         $this->done();
     }
     return false;
 }
 public function isAvailable()
 {
     if (!parent::isStarted()) {
         return parent::isAvailable();
     }
     $found_undone = false;
     foreach ($this->step_instances as $index => &$step_instance) {
         if (!$step_instance->isDone()) {
             $found_undone = true;
         } else {
             $this->handleDoneStep($step_instance);
         }
     }
     if (!$found_undone) {
         $this->done();
     }
     return false;
 }
 public function isAvailable()
 {
     if (!parent::isStarted()) {
         return parent::isAvailable();
     }
     foreach ($this->step_instances as $index => $step_instance) {
         if (!$step_instance->isDone()) {
             break;
         }
         //			echo get_class($step_instance) . "(" . $step_instance->getName() . ") is done\n";
         $index++;
         if (count($this->step_instances) <= $index) {
             $this->done();
         } else {
             $next_step =& $this->step_instances[$index];
             $next_step->flow($step_instance->getStepId());
         }
     }
     return false;
 }
 public function isAvailable()
 {
     if (!parent::isStarted()) {
         return parent::isAvailable();
     }
     if ($this->condition_results) {
         $step_instance = $this->step_instances[0];
         if ($step_instance->isDone()) {
             $this->done();
         }
         return false;
     }
     if ($this->elseif_instance && $this->elseif_instance->condition_results) {
         if ($this->elseif_instance->isDone()) {
             $this->done();
         }
         return false;
     }
     if ($this->else_instance) {
         if ($this->else_instance->isDone()) {
             $this->done();
         }
     }
     return false;
 }
 public function isAvailable()
 {
     $this->tryClose();
     return parent::isAvailable();
 }